diff options
author | stevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-13 21:49:07 +0000 |
---|---|---|
committer | stevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-13 21:49:07 +0000 |
commit | 2ac73f60740f1f6f2d0ee06b9ec4707db175251e (patch) | |
tree | 27a72c0b2e8d5c441484fe3dbe515c352cf5d525 /chrome | |
parent | 01334e4502eb0239236c05c0871f269dc5149986 (diff) | |
download | chromium_src-2ac73f60740f1f6f2d0ee06b9ec4707db175251e.zip chromium_src-2ac73f60740f1f6f2d0ee06b9ec4707db175251e.tar.gz chromium_src-2ac73f60740f1f6f2d0ee06b9ec4707db175251e.tar.bz2 |
Rename all of experiments_helper to variations_helper, including files, namespaces, and various function names.
TEST=none
BUG=none
Review URL: https://chromiumcodereview.appspot.com/10795060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
20 files changed, 88 insertions, 88 deletions
diff --git a/chrome/app/breakpad_field_trial_win.cc b/chrome/app/breakpad_field_trial_win.cc index b0e6499..77ef389 100644 --- a/chrome/app/breakpad_field_trial_win.cc +++ b/chrome/app/breakpad_field_trial_win.cc @@ -25,7 +25,7 @@ extern "C" void __declspec(dllexport) __cdecl SetExperimentList2( size_t current_experiment = 0; string16 current_chunk(google_breakpad::CustomInfoEntry::kValueMaxLength, 0); while (current_experiment < experiment_strings_size && - num_chunks < kMaxReportedExperimentChunks) { + num_chunks < kMaxReportedVariationChunks) { // Check if we have enough room to add another experiment to the current // chunk string. If not, we commit the current chunk string and start over. if (current_chunk.size() + wcslen(experiment_strings[current_experiment]) > @@ -46,7 +46,7 @@ extern "C" void __declspec(dllexport) __cdecl SetExperimentList2( } // Commit the last chunk that didn't get big enough yet. - if (!current_chunk.empty() && num_chunks < kMaxReportedExperimentChunks) { + if (!current_chunk.empty() && num_chunks < kMaxReportedVariationChunks) { base::wcslcpy( (*breakpad_win::g_custom_entries)[ breakpad_win::g_experiment_chunks_offset + num_chunks].value, @@ -55,7 +55,7 @@ extern "C" void __declspec(dllexport) __cdecl SetExperimentList2( } // Make note of the total number of experiments, - // even if it's > kMaxReportedExperimentChunks. This is useful when + // even if it's > kMaxReportedVariationChunks. This is useful when // correlating stability with the number of experiments running // simultaneously. base::wcslcpy( diff --git a/chrome/app/breakpad_unittest_win.cc b/chrome/app/breakpad_unittest_win.cc index 09406aa..d2e5464 100644 --- a/chrome/app/breakpad_unittest_win.cc +++ b/chrome/app/breakpad_unittest_win.cc @@ -29,7 +29,7 @@ class ChromeAppBreakpadTest : public testing::Test { (*g_custom_entries)[g_num_of_experiments_offset].value); // We make a copy of the array that we empty as we find the experiments. Experiments experiments_left(experiments); - for (int i = 0; i < kMaxReportedExperimentChunks; ++i) { + for (int i = 0; i < kMaxReportedVariationChunks; ++i) { EXPECT_STREQ(base::StringPrintf(L"experiment-chunk-%i", i + 1).c_str(), (*g_custom_entries)[g_experiment_chunks_offset + i].name); if (experiments_left.empty()) { diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index 8dc1f3e..d4f7eed 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -422,7 +422,7 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path, // And the test code depends on this. DCHECK_EQ(g_num_of_experiments_offset + 1, g_experiment_chunks_offset); // one-based index for the name suffix. - for (int i = 1; i <= kMaxReportedExperimentChunks; ++i) { + for (int i = 1; i <= kMaxReportedVariationChunks; ++i) { g_custom_entries->push_back(google_breakpad::CustomInfoEntry( base::StringPrintf(L"experiment-chunk-%i", i).c_str(), L"")); } diff --git a/chrome/browser/autocomplete/autocomplete_field_trial.cc b/chrome/browser/autocomplete/autocomplete_field_trial.cc index 3295d253..a5db087 100644 --- a/chrome/browser/autocomplete/autocomplete_field_trial.cc +++ b/chrome/browser/autocomplete/autocomplete_field_trial.cc @@ -8,7 +8,7 @@ #include "base/metrics/field_trial.h" #include "base/string_number_conversions.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/common/metrics/variation_ids.h" namespace { @@ -84,7 +84,7 @@ void AutocompleteFieldTrial::Activate() { trial->UseOneTimeRandomization(); // Mark this group in suggest requests to Google. - experiments_helper::AssociateGoogleVariationID( + chrome_variations::AssociateGoogleVariationID( kSuggestFieldTrialName, "0", chrome_variations::kSuggestIDMin); DCHECK_EQ(kSuggestFieldTrialNumberOfGroups, chrome_variations::kSuggestIDMax - chrome_variations::kSuggestIDMin + 1); @@ -95,7 +95,7 @@ void AutocompleteFieldTrial::Activate() { for (int i = 1; i < kSuggestFieldTrialNumberOfGroups; i++) { const std::string group_name = base::IntToString(i); trial->AppendGroup(group_name, 1); - experiments_helper::AssociateGoogleVariationID( + chrome_variations::AssociateGoogleVariationID( kSuggestFieldTrialName, group_name, static_cast<chrome_variations::VariationID>( chrome_variations::kSuggestIDMin + i)); diff --git a/chrome/browser/chrome_browser_field_trials.cc b/chrome/browser/chrome_browser_field_trials.cc index 9aae20a..0c2de7a 100644 --- a/chrome/browser/chrome_browser_field_trials.cc +++ b/chrome/browser/chrome_browser_field_trials.cc @@ -22,7 +22,7 @@ #include "chrome/browser/prerender/prerender_field_trial.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "net/http/http_network_layer.h" #include "net/http/http_stream_factory.h" #include "net/socket/client_socket_pool_base.h" @@ -64,7 +64,7 @@ void SetupSingleUniformityFieldTrial( trial_name, divisor, kDefaultGroupName, 2015, 1, 1, NULL)); if (one_time_randomized) trial->UseOneTimeRandomization(); - experiments_helper::AssociateGoogleVariationID(trial_name, kDefaultGroupName, + chrome_variations::AssociateGoogleVariationID(trial_name, kDefaultGroupName, trial_base_id); // Loop starts with group 1 because the field trial automatically creates a // default group, which would be group 0. @@ -72,7 +72,7 @@ void SetupSingleUniformityFieldTrial( const std::string group_name = StringPrintf("group_%02d", group_number); DVLOG(1) << " Group name = " << group_name; trial->AppendGroup(group_name, kProbabilityPerGroup); - experiments_helper::AssociateGoogleVariationID(trial_name, group_name, + chrome_variations::AssociateGoogleVariationID(trial_name, group_name, static_cast<chrome_variations::VariationID>(trial_base_id + group_number)); } diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 422b2e5..1988781 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -91,7 +91,7 @@ #include "chrome/common/json_pref_store.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/logging_chrome.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/common/net/net_resource_provider.h" #include "chrome/common/pref_names.h" #include "chrome/common/profiling.h" diff --git a/chrome/browser/metrics/field_trial_synchronizer.cc b/chrome/browser/metrics/field_trial_synchronizer.cc index b483359..1d8cea5 100644 --- a/chrome/browser/metrics/field_trial_synchronizer.cc +++ b/chrome/browser/metrics/field_trial_synchronizer.cc @@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/threading/thread.h" #include "chrome/common/chrome_constants.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/common/render_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" @@ -30,7 +30,7 @@ FieldTrialSynchronizer::FieldTrialSynchronizer() { g_field_trial_synchronizer = this; base::FieldTrialList::AddObserver(this); - experiments_helper::SetChildProcessLoggingExperimentList(); + chrome_variations::SetChildProcessLoggingVariationList(); } void FieldTrialSynchronizer::NotifyAllRenderers( @@ -57,7 +57,7 @@ void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( this, field_trial_name, group_name)); - experiments_helper::SetChildProcessLoggingExperimentList(); + chrome_variations::SetChildProcessLoggingVariationList(); } FieldTrialSynchronizer::~FieldTrialSynchronizer() { diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index ef9879b..7eba4ce 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -31,10 +31,10 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/logging_chrome.h" -#include "chrome/common/metrics/experiments_helper.h" #include "chrome/common/metrics/proto/omnibox_event.pb.h" #include "chrome/common/metrics/proto/profiler_event.pb.h" #include "chrome/common/metrics/proto/system_profile.pb.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/common/pref_names.h" #include "chrome/installer/util/google_update_settings.h" #include "content/public/browser/content_browser_client.h" @@ -59,7 +59,7 @@ using metrics::OmniboxEventProto; using metrics::ProfilerEventProto; using metrics::SystemProfileProto; using tracked_objects::ProcessDataSnapshot; -typedef experiments_helper::SelectedGroupId SelectedGroupId; +typedef chrome_variations::SelectedGroupId SelectedGroupId; typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; namespace { @@ -349,7 +349,7 @@ int MetricsLog::GetScreenCount() const { void MetricsLog::GetFieldTrialIds( std::vector<SelectedGroupId>* field_trial_ids) const { - experiments_helper::GetFieldTrialSelectedGroupIds(field_trial_ids); + chrome_variations::GetFieldTrialSelectedGroupIds(field_trial_ids); } void MetricsLog::WriteStabilityElement( diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h index 89e2e7b..4c5a72c 100644 --- a/chrome/browser/metrics/metrics_log.h +++ b/chrome/browser/metrics/metrics_log.h @@ -28,7 +28,7 @@ namespace tracked_objects { struct ProcessDataSnapshot; } -namespace experiments_helper { +namespace chrome_variations { struct SelectedGroupId; } @@ -132,7 +132,7 @@ class MetricsLog : public MetricsLogBase { // Fills |field_trial_ids| with the list of initialized field trials name and // group ids. virtual void GetFieldTrialIds( - std::vector<experiments_helper::SelectedGroupId>* field_trial_ids) const; + std::vector<chrome_variations::SelectedGroupId>* field_trial_ids) const; private: FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData); diff --git a/chrome/browser/metrics/metrics_log_unittest.cc b/chrome/browser/metrics/metrics_log_unittest.cc index b2115f7..0424b13 100644 --- a/chrome/browser/metrics/metrics_log_unittest.cc +++ b/chrome/browser/metrics/metrics_log_unittest.cc @@ -13,7 +13,7 @@ #include "chrome/browser/metrics/metrics_log.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/pref_service.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/common/metrics/proto/profiler_event.pb.h" #include "chrome/common/metrics/proto/system_profile.pb.h" #include "chrome/common/pref_names.h" @@ -36,7 +36,7 @@ const int kSessionId = 127; const int kScreenWidth = 1024; const int kScreenHeight = 768; const int kScreenCount = 3; -const experiments_helper::SelectedGroupId kFieldTrialIds[] = { +const chrome_variations::SelectedGroupId kFieldTrialIds[] = { {37, 43}, {13, 47}, {23, 17} @@ -75,7 +75,7 @@ class TestMetricsLog : public MetricsLog { } virtual void GetFieldTrialIds( - std::vector<experiments_helper::SelectedGroupId>* field_trial_ids) const + std::vector<chrome_variations::SelectedGroupId>* field_trial_ids) const OVERRIDE { ASSERT_TRUE(field_trial_ids->empty()); diff --git a/chrome/browser/metrics/variations_service.cc b/chrome/browser/metrics/variations_service.cc index cd60a26..1d03451 100644 --- a/chrome/browser/metrics/variations_service.cc +++ b/chrome/browser/metrics/variations_service.cc @@ -17,7 +17,7 @@ #include "chrome/browser/metrics/proto/trials_seed.pb.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/url_fetcher.h" @@ -459,9 +459,9 @@ void VariationsService::CreateTrialFromStudy(const Study& study, if (experiment.has_experiment_id()) { const VariationID variation_id = static_cast<VariationID>(experiment.experiment_id()); - experiments_helper::AssociateGoogleVariationIDForce(study.name(), - experiment.name(), - variation_id); + AssociateGoogleVariationIDForce(study.name(), + experiment.name(), + variation_id); } } diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc index 516f373..b90879b 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc @@ -29,7 +29,7 @@ #include "chrome/browser/ui/sync/one_click_signin_helper.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/user_script.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/common/metrics/proto/chrome_experiments.pb.h" #include "chrome/common/render_messages.h" #include "content/public/browser/browser_thread.h" @@ -377,7 +377,7 @@ void ChromeResourceDispatcherHostDelegate::OnFieldTrialGroupFinalized( const std::string& group_name) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); chrome_variations::VariationID new_id = - experiments_helper::GetGoogleVariationID(trial_name, group_name); + chrome_variations::GetGoogleVariationID(trial_name, group_name); if (new_id == chrome_variations::kEmptyID) return; variation_ids_set_.insert(new_id); @@ -398,7 +398,7 @@ void ChromeResourceDispatcherHostDelegate::InitVariationIDsCacheIfNeeded() { for (base::FieldTrial::SelectedGroups::const_iterator it = initial_groups.begin(); it != initial_groups.end(); ++it) { chrome_variations::VariationID id = - experiments_helper::GetGoogleVariationID(it->trial, it->group); + chrome_variations::GetGoogleVariationID(it->trial, it->group); if (id != chrome_variations::kEmptyID) variation_ids_set_.insert(id); } diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index f9b6b80..2075d1f 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -224,14 +224,14 @@ 'common/mac/objc_method_swizzle.mm', 'common/mac/objc_zombie.h', 'common/mac/objc_zombie.mm', - 'common/metrics/experiments_helper.cc', - 'common/metrics/experiments_helper.h', 'common/metrics/metrics_log_base.cc', 'common/metrics/metrics_log_base.h', 'common/metrics/metrics_log_manager.cc', 'common/metrics/metrics_log_manager.h', 'common/metrics/metrics_service_base.cc', 'common/metrics/metrics_service_base.h', + 'common/metrics/variations_util.cc', + 'common/metrics/variations_util.h', 'common/multi_process_lock.h', 'common/multi_process_lock_linux.cc', 'common/multi_process_lock_mac.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 7896c90..c730d12 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1975,9 +1975,9 @@ 'common/mac/mock_launchd.h', 'common/mac/objc_method_swizzle_unittest.mm', 'common/mac/objc_zombie_unittest.mm', - 'common/metrics/experiments_helper_unittest.cc', 'common/metrics/metrics_log_base_unittest.cc', 'common/metrics/metrics_log_manager_unittest.cc', + 'common/metrics/variations_util_unittest.cc', 'common/multi_process_lock_unittest.cc', 'common/net/url_util_unittest.cc', 'common/net/gaia/gaia_auth_fetcher_unittest.cc', diff --git a/chrome/common/child_process_logging.h b/chrome/common/child_process_logging.h index a439461..532d6a4 100644 --- a/chrome/common/child_process_logging.h +++ b/chrome/common/child_process_logging.h @@ -25,15 +25,15 @@ struct GPUInfo; // dependency. static const int kMaxReportedActiveExtensions = 10; -// The maximum number of experiment chunks we will report. +// The maximum number of variation chunks we will report. // Also used in chrome/app, but we define it here to avoid a common->app // dependency. -static const int kMaxReportedExperimentChunks = 15; +static const int kMaxReportedVariationChunks = 15; -// The maximum size of an experiment chunk. This size was picked to be +// The maximum size of a variation chunk. This size was picked to be // consistent between platforms and the value was chosen from the Windows // limit of google_breakpad::CustomInfoEntry::kValueMaxLength. -static const size_t kMaxExperimentChunkSize = 64; +static const size_t kMaxVariationChunkSize = 64; // The maximum number of prn-info-* records. static const size_t kMaxReportedPrinterRecords = 4; diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm index e514c87..b54d7c7 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -13,7 +13,7 @@ #include "base/stringprintf.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/installer/util/google_update_settings.h" #include "content/public/common/gpu_info.h" #include "googleurl/src/gurl.h" @@ -227,10 +227,10 @@ void SetExperimentList(const std::vector<string16>& experiments) { NSString* const kExperimentChunkFormat = @"experiment-chunk-%zu"; // 1-based. std::vector<string16> chunks; - experiments_helper::GenerateExperimentChunks(experiments, &chunks); + chrome_variations::GenerateVariationChunks(experiments, &chunks); - // Store up to |kMaxReportedExperimentChunks| chunks. - for (size_t i = 0; i < kMaxReportedExperimentChunks; ++i) { + // Store up to |kMaxReportedVariationChunks| chunks. + for (size_t i = 0; i < kMaxReportedVariationChunks; ++i) { NSString* key = [NSString stringWithFormat:kExperimentChunkFormat, i + 1]; if (i < chunks.size()) { NSString* value = base::SysUTF16ToNSString(chunks[i]); @@ -241,8 +241,8 @@ void SetExperimentList(const std::vector<string16>& experiments) { } // Make note of the total number of experiments, which may be greater than - // what was able to fit in |kMaxReportedExperimentChunks|. This is useful - // when correlating stability with the number of experiments running + // what was able to fit in |kMaxReportedVariationChunks|. This is useful when + // correlating stability with the number of experiments running // simultaneously. SetCrashKeyValue(kNumExperimentsKey, [NSString stringWithFormat:@"%zu", experiments.size()]); diff --git a/chrome/common/metrics/experiments_helper.cc b/chrome/common/metrics/variations_util.cc index 79cd707..86d786f 100644 --- a/chrome/common/metrics/experiments_helper.cc +++ b/chrome/common/metrics/variations_util.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include <map> #include <vector> @@ -31,7 +31,7 @@ class GroupMapAccessor { // Note that this normally only sets the ID for a group the first time, unless // |force| is set to true, in which case it will always override it. - void AssociateID(const experiments_helper::SelectedGroupId& group_identifier, + void AssociateID(const chrome_variations::SelectedGroupId& group_identifier, chrome_variations::VariationID id, const bool force) { base::AutoLock scoped_lock(lock_); @@ -41,7 +41,7 @@ class GroupMapAccessor { } chrome_variations::VariationID GetID( - const experiments_helper::SelectedGroupId& group_identifier) { + const chrome_variations::SelectedGroupId& group_identifier) { base::AutoLock scoped_lock(lock_); GroupToIDMap::const_iterator it = group_to_id_map_.find(group_identifier); if (it == group_to_id_map_.end()) @@ -50,9 +50,9 @@ class GroupMapAccessor { } private: - typedef std::map<experiments_helper::SelectedGroupId, + typedef std::map<chrome_variations::SelectedGroupId, chrome_variations::VariationID, - experiments_helper::SelectedGroupIdCompare> GroupToIDMap; + chrome_variations::SelectedGroupIdCompare> GroupToIDMap; base::Lock lock_; GroupToIDMap group_to_id_map_; @@ -75,10 +75,10 @@ uint32 HashName(const std::string& name) { return base::ByteSwapToLE32(bits); } -experiments_helper::SelectedGroupId MakeSelectedGroupId( +chrome_variations::SelectedGroupId MakeSelectedGroupId( const std::string& trial_name, const std::string& group_name) { - experiments_helper::SelectedGroupId id; + chrome_variations::SelectedGroupId id; id.name = HashName(trial_name); id.group = HashName(group_name); return id; @@ -87,7 +87,7 @@ experiments_helper::SelectedGroupId MakeSelectedGroupId( // Populates |name_group_ids| based on |selected_groups|. void GetFieldTrialSelectedGroupIdsForSelectedGroups( const base::FieldTrial::SelectedGroups& selected_groups, - std::vector<experiments_helper::SelectedGroupId>* name_group_ids) { + std::vector<chrome_variations::SelectedGroupId>* name_group_ids) { DCHECK(name_group_ids->empty()); for (base::FieldTrial::SelectedGroups::const_iterator it = selected_groups.begin(); it != selected_groups.end(); ++it) { @@ -97,7 +97,7 @@ void GetFieldTrialSelectedGroupIdsForSelectedGroups( } // namespace -namespace experiments_helper { +namespace chrome_variations { void GetFieldTrialSelectedGroupIds( std::vector<SelectedGroupId>* name_group_ids) { @@ -132,13 +132,13 @@ chrome_variations::VariationID GetGoogleVariationID( MakeSelectedGroupId(trial_name, group_name)); } -void GenerateExperimentChunks(const std::vector<string16>& experiments, - std::vector<string16>* chunks) { +void GenerateVariationChunks(const std::vector<string16>& experiments, + std::vector<string16>* chunks) { string16 current_chunk; for (size_t i = 0; i < experiments.size(); ++i) { const size_t needed_length = (current_chunk.empty() ? 1 : 0) + experiments[i].length(); - if (current_chunk.length() + needed_length > kMaxExperimentChunkSize) { + if (current_chunk.length() + needed_length > kMaxVariationChunkSize) { chunks->push_back(current_chunk); current_chunk = experiments[i]; } else { @@ -151,7 +151,7 @@ void GenerateExperimentChunks(const std::vector<string16>& experiments, chunks->push_back(current_chunk); } -void SetChildProcessLoggingExperimentList() { +void SetChildProcessLoggingVariationList() { std::vector<SelectedGroupId> name_group_ids; GetFieldTrialSelectedGroupIds(&name_group_ids); std::vector<string16> experiment_strings(name_group_ids.size()); @@ -162,7 +162,7 @@ void SetChildProcessLoggingExperimentList() { child_process_logging::SetExperimentList(experiment_strings); } -} // namespace experiments_helper +} // namespace chrome_variations // Functions below are exposed for testing explicitly behind this namespace. // They simply wrap existing functions in this file. @@ -170,7 +170,7 @@ namespace testing { void TestGetFieldTrialSelectedGroupIdsForSelectedGroups( const base::FieldTrial::SelectedGroups& selected_groups, - std::vector<experiments_helper::SelectedGroupId>* name_group_ids) { + std::vector<chrome_variations::SelectedGroupId>* name_group_ids) { ::GetFieldTrialSelectedGroupIdsForSelectedGroups(selected_groups, name_group_ids); } diff --git a/chrome/common/metrics/experiments_helper.h b/chrome/common/metrics/variations_util.h index b2134c7..5c72397 100644 --- a/chrome/common/metrics/experiments_helper.h +++ b/chrome/common/metrics/variations_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_METRICS_EXPERIMENTS_HELPER_H_ -#define CHROME_COMMON_METRICS_EXPERIMENTS_HELPER_H_ +#ifndef CHROME_COMMON_METRICS_VARIATIONS_UTIL_H_ +#define CHROME_COMMON_METRICS_VARIATIONS_UTIL_H_ #include <string> #include <vector> @@ -16,7 +16,7 @@ // base::FieldTrial. // // This includes a simple API used to handle getting and setting -// data related to Google-specific experiments in the browser. This is meant to +// data related to Google-specific variations in the browser. This is meant to // be an extension to the base::FieldTrial for Google-specific functionality. // // These calls are meant to be made directly after appending all your groups to @@ -45,7 +45,7 @@ // The AssociateGoogleVariationID and GetGoogleVariationID API methods are // thread safe. -namespace experiments_helper { +namespace chrome_variations { // The Unique ID of a trial and its selected group, where the name and group // identifiers are hashes of the trial and group name strings. @@ -100,16 +100,16 @@ chrome_variations::VariationID GetGoogleVariationID( const std::string& trial_name, const std::string& group_name); -// Generates experiment chunks from |experiment_strings| that are suitable for +// Generates variation chunks from |variation_strings| that are suitable for // crash reporting. -void GenerateExperimentChunks(const std::vector<string16>& experiment_strings, - std::vector<string16>* chunks); +void GenerateVariationChunks(const std::vector<string16>& variation_strings, + std::vector<string16>* chunks); -// Get the current set of chosen FieldTrial groups (aka experiments) and send +// Get the current set of chosen FieldTrial groups (aka variations) and send // them to the child process logging module so it can save it for crash dumps. -void SetChildProcessLoggingExperimentList(); +void SetChildProcessLoggingVariationList(); -} // namespace experiments_helper +} // namespace chrome_variations // Expose some functions for testing. These functions just wrap functionality // that is implemented above. @@ -117,10 +117,10 @@ namespace testing { void TestGetFieldTrialSelectedGroupIdsForSelectedGroups( const base::FieldTrial::SelectedGroups& selected_groups, - std::vector<experiments_helper::SelectedGroupId>* name_group_ids); + std::vector<chrome_variations::SelectedGroupId>* name_group_ids); uint32 TestHashName(const std::string& name); } // namespace testing -#endif // CHROME_COMMON_METRICS_EXPERIMENTS_HELPER_H_ +#endif // CHROME_COMMON_METRICS_VARIATIONS_UTIL_H_ diff --git a/chrome/common/metrics/experiments_helper_unittest.cc b/chrome/common/metrics/variations_util_unittest.cc index 7fe2625..dbe2732 100644 --- a/chrome/common/metrics/experiments_helper_unittest.cc +++ b/chrome/common/metrics/variations_util_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Tests for the Experiment Helpers. +// Tests for the Variations Helpers. #include <set> @@ -11,11 +11,11 @@ #include "base/metrics/field_trial.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -namespace experiments_helper { +namespace chrome_variations { namespace { @@ -28,9 +28,9 @@ chrome_variations::VariationID GetIDForTrial(base::FieldTrial* trial) { } // namespace -class ExperimentsHelperTest : public ::testing::Test { +class VariationsHelperTest : public ::testing::Test { public: - ExperimentsHelperTest() { + VariationsHelperTest() { // Since the API can only be called on the UI thread, we have to fake that // we're on it. ui_thread_.reset(new content::TestBrowserThread( @@ -53,7 +53,7 @@ class ExperimentsHelperTest : public ::testing::Test { scoped_ptr<content::TestBrowserThread> ui_thread_; }; -TEST_F(ExperimentsHelperTest, HashName) { +TEST_F(VariationsHelperTest, HashName) { // Make sure hashing is stable on all platforms. struct { const char* name; @@ -74,7 +74,7 @@ TEST_F(ExperimentsHelperTest, HashName) { } } -TEST_F(ExperimentsHelperTest, GetFieldTrialSelectedGroups) { +TEST_F(VariationsHelperTest, GetFieldTrialSelectedGroups) { typedef std::set<SelectedGroupId, SelectedGroupIdCompare> SelectedGroupIdSet; std::string trial_one("trial one"); std::string group_one("group one"); @@ -116,7 +116,7 @@ TEST_F(ExperimentsHelperTest, GetFieldTrialSelectedGroups) { // Test that if the trial is immediately disabled, GetGoogleVariationID just // returns the empty ID. -TEST_F(ExperimentsHelperTest, DisableImmediately) { +TEST_F(VariationsHelperTest, DisableImmediately) { int default_group_number = -1; scoped_refptr<base::FieldTrial> trial( base::FieldTrialList::FactoryGetFieldTrial("trial", 100, "default", @@ -131,7 +131,7 @@ TEST_F(ExperimentsHelperTest, DisableImmediately) { // Test that successfully associating the FieldTrial with some ID, and then // disabling the FieldTrial actually makes GetGoogleVariationID correctly // return the empty ID. -TEST_F(ExperimentsHelperTest, DisableAfterInitialization) { +TEST_F(VariationsHelperTest, DisableAfterInitialization) { const std::string default_name = "default"; const std::string non_default_name = "non_default"; @@ -151,7 +151,7 @@ TEST_F(ExperimentsHelperTest, DisableAfterInitialization) { } // Test various successful association cases. -TEST_F(ExperimentsHelperTest, AssociateGoogleVariationID) { +TEST_F(VariationsHelperTest, AssociateGoogleVariationID) { const std::string default_name1 = "default1"; scoped_refptr<base::FieldTrial> trial_true( base::FieldTrialList::FactoryGetFieldTrial("d1", 10, default_name1, @@ -187,7 +187,7 @@ TEST_F(ExperimentsHelperTest, AssociateGoogleVariationID) { // Test that not associating a FieldTrial with any IDs ensure that the empty ID // will be returned. -TEST_F(ExperimentsHelperTest, NoAssociation) { +TEST_F(VariationsHelperTest, NoAssociation) { const std::string default_name = "default"; scoped_refptr<base::FieldTrial> no_id_trial( base::FieldTrialList::FactoryGetFieldTrial("d3", 10, default_name, @@ -203,7 +203,7 @@ TEST_F(ExperimentsHelperTest, NoAssociation) { } // Ensure that the AssociateGoogleVariationIDForce works as expected. -TEST_F(ExperimentsHelperTest, ForceAssociation) { +TEST_F(VariationsHelperTest, ForceAssociation) { EXPECT_EQ(chrome_variations::kEmptyID, GetGoogleVariationID("trial", "group")); AssociateGoogleVariationID("trial", "group", @@ -219,7 +219,7 @@ TEST_F(ExperimentsHelperTest, ForceAssociation) { GetGoogleVariationID("trial", "group")); } -TEST_F(ExperimentsHelperTest, GenerateExperimentChunks) { +TEST_F(VariationsHelperTest, GenerateExperimentChunks) { const char* kExperimentStrings[] = { "1d3048f1-9de009d0", "cd73da34-cf196cb", @@ -266,11 +266,11 @@ TEST_F(ExperimentsHelperTest, GenerateExperimentChunks) { experiments.push_back(UTF8ToUTF16(kExperimentStrings[j])); std::vector<string16> chunks; - GenerateExperimentChunks(experiments, &chunks); + GenerateVariationChunks(experiments, &chunks); ASSERT_EQ(cases[i].expected_chunks_length, chunks.size()); for (size_t j = 0; j < chunks.size(); ++j) EXPECT_EQ(UTF8ToUTF16(cases[i].expected_chunks[j]), chunks[j]); } } -} // namespace experiments_helper +} // namespace chrome_variations diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc index 9b2bb92..a99d5e3 100644 --- a/chrome/renderer/chrome_render_process_observer.cc +++ b/chrome/renderer/chrome_render_process_observer.cc @@ -21,7 +21,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension_localization_peer.h" -#include "chrome/common/metrics/experiments_helper.h" +#include "chrome/common/metrics/variations_util.h" #include "chrome/common/net/net_resource_provider.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/chrome_content_renderer_client.h" @@ -206,7 +206,7 @@ ChromeRenderProcessObserver::ChromeRenderProcessObserver( base::LoadNativeLibrary(FilePath(L"crypt32.dll"), &error); #endif // Setup initial set of crash dump data for Field Trials in this renderer. - experiments_helper::SetChildProcessLoggingExperimentList(); + chrome_variations::SetChildProcessLoggingVariationList(); } ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { @@ -312,7 +312,7 @@ void ChromeRenderProcessObserver::OnSetFieldTrialGroup( const std::string& field_trial_name, const std::string& group_name) { base::FieldTrialList::CreateFieldTrial(field_trial_name, group_name); - experiments_helper::SetChildProcessLoggingExperimentList(); + chrome_variations::SetChildProcessLoggingVariationList(); } void ChromeRenderProcessObserver::OnGetV8HeapStats() { |