disable-fetching-field-trials.patch 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. .../browser/flags/ChromeFeatureList.java | 19 ++++---------------
  7. .../variations/service/variations_service.cc | 12 +-----------
  8. 2 files changed, 5 insertions(+), 26 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. @@ -123,11 +123,7 @@ public abstract class ChromeFeatureList
  12. * the specified parameter does not exist.
  13. */
  14. public static String getFieldTrialParamByFeature(String featureName, String paramName) {
  15. - String testValue = FeatureList.getTestValueForFieldTrialParam(featureName, paramName);
  16. - if (testValue != null) return testValue;
  17. - if (FeatureList.hasTestFeatures()) return "";
  18. - assert FeatureList.isInitialized();
  19. - return ChromeFeatureListJni.get().getFieldTrialParamByFeature(featureName, paramName);
  20. + return "";
  21. }
  22. /**
  23. @@ -144,12 +140,7 @@ public abstract class ChromeFeatureList
  24. */
  25. public static int getFieldTrialParamByFeatureAsInt(
  26. String featureName, String paramName, int defaultValue) {
  27. - String testValue = FeatureList.getTestValueForFieldTrialParam(featureName, paramName);
  28. - if (testValue != null) return Integer.valueOf(testValue);
  29. - if (FeatureList.hasTestFeatures()) return defaultValue;
  30. - assert FeatureList.isInitialized();
  31. - return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsInt(
  32. - featureName, paramName, defaultValue);
  33. + return defaultValue;
  34. }
  35. /**
  36. @@ -166,12 +157,7 @@ public abstract class ChromeFeatureList
  37. */
  38. public static double getFieldTrialParamByFeatureAsDouble(
  39. String featureName, String paramName, double defaultValue) {
  40. - String testValue = FeatureList.getTestValueForFieldTrialParam(featureName, paramName);
  41. - if (testValue != null) return Double.valueOf(testValue);
  42. - if (FeatureList.hasTestFeatures()) return defaultValue;
  43. - assert FeatureList.isInitialized();
  44. - return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsDouble(
  45. - featureName, paramName, defaultValue);
  46. + return defaultValue;
  47. }
  48. /**
  49. @@ -202,12 +188,7 @@ public abstract class ChromeFeatureList
  50. */
  51. public static boolean getFieldTrialParamByFeatureAsBoolean(
  52. String featureName, String paramName, boolean defaultValue) {
  53. - String testValue = FeatureList.getTestValueForFieldTrialParam(featureName, paramName);
  54. - if (testValue != null) return Boolean.valueOf(testValue);
  55. - if (FeatureList.hasTestFeatures()) return defaultValue;
  56. - assert FeatureList.isInitialized();
  57. - return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsBoolean(
  58. - featureName, paramName, defaultValue);
  59. + return defaultValue;
  60. }
  61. /* Alphabetical: */
  62. --- a/components/variations/service/variations_service.cc
  63. +++ b/components/variations/service/variations_service.cc
  64. @@ -240,17 +240,7 @@ bool GetInstanceManipulations(const net:
  65. // Variations seed fetching is only enabled in official Chrome builds, if a URL
  66. // is specified on the command line, and for testing.
  67. bool IsFetchingEnabled() {
  68. -#if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
  69. - if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
  70. - switches::kVariationsServerURL) &&
  71. - !g_should_fetch_for_testing) {
  72. - DVLOG(1)
  73. - << "Not performing repeated fetching in unofficial build without --"
  74. - << switches::kVariationsServerURL << " specified.";
  75. - return false;
  76. - }
  77. -#endif
  78. - return true;
  79. + return false;
  80. }
  81. std::unique_ptr<SeedResponse> MaybeImportFirstRunSeed(