Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: trunk/src/components/variations/variations_associated_data_unittest.cc

Issue 416333008: Revert 285657 "Move variations component code to variations name..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/variations/variations_associated_data.h" 5 #include "components/variations/variations_associated_data.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace variations { 10 namespace chrome_variations {
11 11
12 namespace { 12 namespace {
13 13
14 const VariationID TEST_VALUE_A = 3300200; 14 const VariationID TEST_VALUE_A = 3300200;
15 const VariationID TEST_VALUE_B = 3300201; 15 const VariationID TEST_VALUE_B = 3300201;
16 16
17 // Convenience helper to retrieve the variations::VariationID for a FieldTrial. 17 // Convenience helper to retrieve the chrome_variations::VariationID for a
18 // Note that this will do the group assignment in |trial| if not already done. 18 // FieldTrial. Note that this will do the group assignment in |trial| if not
19 // already done.
19 VariationID GetIDForTrial(IDCollectionKey key, base::FieldTrial* trial) { 20 VariationID GetIDForTrial(IDCollectionKey key, base::FieldTrial* trial) {
20 return GetGoogleVariationID(key, trial->trial_name(), trial->group_name()); 21 return GetGoogleVariationID(key, trial->trial_name(), trial->group_name());
21 } 22 }
22 23
23 // Tests whether a field trial is active (i.e. group() has been called on it). 24 // Tests whether a field trial is active (i.e. group() has been called on it).
24 bool IsFieldTrialActive(const std::string& trial_name) { 25 bool IsFieldTrialActive(const std::string& trial_name) {
25 base::FieldTrial::ActiveGroups active_groups; 26 base::FieldTrial::ActiveGroups active_groups;
26 base::FieldTrialList::GetActiveFieldTrialGroups(&active_groups); 27 base::FieldTrialList::GetActiveFieldTrialGroups(&active_groups);
27 for (size_t i = 0; i < active_groups.size(); ++i) { 28 for (size_t i = 0; i < active_groups.size(); ++i) {
28 if (active_groups[i].trial_name == trial_name) 29 if (active_groups[i].trial_name == trial_name)
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 ASSERT_FALSE(IsFieldTrialActive(kTrialName)); 322 ASSERT_FALSE(IsFieldTrialActive(kTrialName));
322 scoped_refptr<base::FieldTrial> trial( 323 scoped_refptr<base::FieldTrial> trial(
323 CreateFieldTrial(kTrialName, 100, "A", NULL)); 324 CreateFieldTrial(kTrialName, 100, "A", NULL));
324 ASSERT_FALSE(IsFieldTrialActive(kTrialName)); 325 ASSERT_FALSE(IsFieldTrialActive(kTrialName));
325 326
326 std::map<std::string, std::string> params; 327 std::map<std::string, std::string> params;
327 EXPECT_EQ(std::string(), GetVariationParamValue(kTrialName, "x")); 328 EXPECT_EQ(std::string(), GetVariationParamValue(kTrialName, "x"));
328 ASSERT_TRUE(IsFieldTrialActive(kTrialName)); 329 ASSERT_TRUE(IsFieldTrialActive(kTrialName));
329 } 330 }
330 331
331 } // namespace variations 332 } // namespace chrome_variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698