disable-fetching-field-trials.patch 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # NOTE: Modified to remove usage of compiler #if macros
  2. From: csagan5 <32685696+csagan5@users.noreply.github.com>
  3. Date: Sun, 8 Jul 2018 18:16:34 +0200
  4. Subject: Disable fetching of all field trials
  5. ---
  6. .../src/org/chromium/chrome/browser/ChromeFeatureList.java | 12 +++---------
  7. components/variations/service/variations_service.cc | 4 ++++
  8. 2 files changed, 7 insertions(+), 9 deletions(-)
  9. --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
  10. +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
  11. @@ -138,9 +138,7 @@ public abstract class ChromeFeatureList
  12. * the specified parameter does not exist.
  13. */
  14. public static String getFieldTrialParamByFeature(String featureName, String paramName) {
  15. - if (FeatureList.hasTestFeatures()) return "";
  16. - assert isInitialized();
  17. - return ChromeFeatureListJni.get().getFieldTrialParamByFeature(featureName, paramName);
  18. + return "";
  19. }
  20. /**
  21. @@ -157,10 +155,7 @@ public abstract class ChromeFeatureList
  22. */
  23. public static int getFieldTrialParamByFeatureAsInt(
  24. String featureName, String paramName, int defaultValue) {
  25. - if (FeatureList.hasTestFeatures()) return defaultValue;
  26. - assert isInitialized();
  27. - return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsInt(
  28. - featureName, paramName, defaultValue);
  29. + return defaultValue;
  30. }
  31. /**
  32. @@ -177,10 +172,7 @@ public abstract class ChromeFeatureList
  33. */
  34. public static double getFieldTrialParamByFeatureAsDouble(
  35. String featureName, String paramName, double defaultValue) {
  36. - if (FeatureList.hasTestFeatures()) return defaultValue;
  37. - assert isInitialized();
  38. - return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsDouble(
  39. - featureName, paramName, defaultValue);
  40. + return defaultValue;
  41. }
  42. /**
  43. @@ -197,10 +189,7 @@ public abstract class ChromeFeatureList
  44. */
  45. public static boolean getFieldTrialParamByFeatureAsBoolean(
  46. String featureName, String paramName, boolean defaultValue) {
  47. - if (FeatureList.hasTestFeatures()) return defaultValue;
  48. - assert isInitialized();
  49. - return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsBoolean(
  50. - featureName, paramName, defaultValue);
  51. + return defaultValue;
  52. }
  53. /** Alphabetical: */
  54. --- a/components/variations/service/variations_service.cc
  55. +++ b/components/variations/service/variations_service.cc
  56. @@ -243,17 +243,7 @@ bool GetInstanceManipulations(const net:
  57. // Variations seed fetching is only enabled in official Chrome builds, if a URL
  58. // is specified on the command line, and for testing.
  59. bool IsFetchingEnabled() {
  60. -#if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
  61. - if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
  62. - switches::kVariationsServerURL) &&
  63. - !g_should_fetch_for_testing) {
  64. - DVLOG(1)
  65. - << "Not performing repeated fetching in unofficial build without --"
  66. - << switches::kVariationsServerURL << " specified.";
  67. - return false;
  68. - }
  69. -#endif
  70. - return true;
  71. + return false;
  72. }
  73. std::unique_ptr<SeedResponse> MaybeImportFirstRunSeed(