OLD | NEW |
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 variations { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 base::FieldTrial::SESSION_RANDOMIZED, default_group_number); | 43 base::FieldTrial::SESSION_RANDOMIZED, default_group_number); |
44 } | 44 } |
45 | 45 |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 class VariationsAssociatedDataTest : public ::testing::Test { | 48 class VariationsAssociatedDataTest : public ::testing::Test { |
49 public: | 49 public: |
50 VariationsAssociatedDataTest() : field_trial_list_(NULL) { | 50 VariationsAssociatedDataTest() : field_trial_list_(NULL) { |
51 } | 51 } |
52 | 52 |
53 virtual ~VariationsAssociatedDataTest() { | 53 ~VariationsAssociatedDataTest() override { |
54 // Ensure that the maps are cleared between tests, since they are stored as | 54 // Ensure that the maps are cleared between tests, since they are stored as |
55 // process singletons. | 55 // process singletons. |
56 testing::ClearAllVariationIDs(); | 56 testing::ClearAllVariationIDs(); |
57 testing::ClearAllVariationParams(); | 57 testing::ClearAllVariationParams(); |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 base::FieldTrialList field_trial_list_; | 61 base::FieldTrialList field_trial_list_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(VariationsAssociatedDataTest); | 63 DISALLOW_COPY_AND_ASSIGN(VariationsAssociatedDataTest); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 scoped_refptr<base::FieldTrial> trial( | 322 scoped_refptr<base::FieldTrial> trial( |
323 CreateFieldTrial(kTrialName, 100, "A", NULL)); | 323 CreateFieldTrial(kTrialName, 100, "A", NULL)); |
324 ASSERT_FALSE(IsFieldTrialActive(kTrialName)); | 324 ASSERT_FALSE(IsFieldTrialActive(kTrialName)); |
325 | 325 |
326 std::map<std::string, std::string> params; | 326 std::map<std::string, std::string> params; |
327 EXPECT_EQ(std::string(), GetVariationParamValue(kTrialName, "x")); | 327 EXPECT_EQ(std::string(), GetVariationParamValue(kTrialName, "x")); |
328 ASSERT_TRUE(IsFieldTrialActive(kTrialName)); | 328 ASSERT_TRUE(IsFieldTrialActive(kTrialName)); |
329 } | 329 } |
330 | 330 |
331 } // namespace variations | 331 } // namespace variations |
OLD | NEW |