From 3d2e44fe0e7994b083504c249b654e20d76228e0 Mon Sep 17 00:00:00 2001 From: danduong Date: Tue, 4 Aug 2015 19:09:37 -0700 Subject: Add a new gyp flag: fieldtrial_testing_like_official_build When set to 1, this will NOT activate the field trial test specified in the fieldtrial_testing_config_*.json. This gives Chromium packagers the flexibility to disable field trial testing config for their package as we have on our Google Chrome build. BUG=515686 Review URL: https://codereview.chromium.org/1266113002 Cr-Commit-Position: refs/heads/master@{#341845} --- build/common.gypi | 9 +++++++++ build/config/BUILD.gn | 3 +++ build/config/features.gni | 5 +++++ chrome/browser/chrome_browser_main.cc | 4 ++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/build/common.gypi b/build/common.gypi index 5915055..fe2c57a 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -368,6 +368,11 @@ # Note: this setting is ignored if buildtype=="Official". 'tracing_like_official_build%': 0, + # Set to 1 to make a build that disables activation of field trial tests + # specified in testing/variations/fieldtrial_testing_config_*.json. + # Note: this setting is ignored if branding=="Chrome". + 'fieldtrial_testing_like_official_build%': 0, + # Disable image loader component extension by default. 'image_loader_extension%': 0, @@ -1142,6 +1147,7 @@ 'win_z7%': '<(win_z7)', 'dcheck_always_on%': '<(dcheck_always_on)', 'tracing_like_official_build%': '<(tracing_like_official_build)', + 'fieldtrial_testing_like_official_build%': '<(fieldtrial_testing_like_official_build)', 'arm_version%': '<(arm_version)', 'arm_neon%': '<(arm_neon)', 'arm_neon_optional%': '<(arm_neon_optional)', @@ -2857,6 +2863,9 @@ ['tracing_like_official_build!=0', { 'defines': ['TRACING_IS_OFFICIAL_BUILD=1'], }], # tracing_like_official_build!=0 + ['fieldtrial_testing_like_official_build==0 and branding!="Chrome"', { + 'defines': ['FIELDTRIAL_TESTING_ENABLED'], + }], # fieldtrial_testing_like_official_build==0 and branding!="Chrome" ['OS=="win"', { 'defines': ['NO_TCMALLOC'], 'conditions': [ diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index b6b9520..75fa3aa 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -289,6 +289,9 @@ config("feature_flags") { "MEMORY_SANITIZER_INITIAL_SIZE", ] } + if (!fieldtrial_testing_like_official_build && !is_chrome_branded) { + defines += [ "FIELDTRIAL_TESTING_ENABLED" ] + } } # Debug/release ---------------------------------------------------------------- diff --git a/build/config/features.gni b/build/config/features.gni index 3a34bd2..6d8f25a 100644 --- a/build/config/features.gni +++ b/build/config/features.gni @@ -110,6 +110,11 @@ declare_args() { } else { safe_browsing_mode = 1 } + + # Set to true make a build that disables activation of field trial tests + # specified in testing/variations/fieldtrial_testing_config_*.json. + # Note: this setting is ignored if is_chrome_branded. + fieldtrial_testing_like_official_build = is_chrome_branded } # Additional dependent variables ----------------------------------------------- diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index cb5e28f..669b84e 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -634,12 +634,12 @@ void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() { << " list specified."; } -#if !defined(GOOGLE_CHROME_BUILD) +#if defined(FIELDTRIAL_TESTING_ENABLED) if (!command_line->HasSwitch(switches::kDisableFieldTrialTestingConfig) && !command_line->HasSwitch(switches::kForceFieldTrials) && !command_line->HasSwitch(switches::kVariationsServerURL)) chrome_variations::AssociateDefaultFieldTrialConfig(); -#endif // !defined(GOOGLE_CHROME_BUILD) +#endif // defined(FIELDTRIAL_TESTING_ENABLED) if (command_line->HasSwitch(switches::kForceVariationIds)) { // Create default variation ids which will always be included in the -- cgit v1.1