| 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 chrome_variations { | 10 namespace chrome_variations { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 class VariationsAssociatedDataTest : public ::testing::Test { | 49 class VariationsAssociatedDataTest : public ::testing::Test { |
| 50 public: | 50 public: |
| 51 VariationsAssociatedDataTest() : field_trial_list_(NULL) { | 51 VariationsAssociatedDataTest() : field_trial_list_(NULL) { |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual ~VariationsAssociatedDataTest() { | 54 virtual ~VariationsAssociatedDataTest() { |
| 55 // Ensure that the maps are cleared between tests, since they are stored as | 55 // Ensure that the maps are cleared between tests, since they are stored as |
| 56 // process singletons. | 56 // process singletons. |
| 57 testing::ClearAllVariationIDs(); | 57 testing::ClearAllVariationIDs(); |
| 58 testing::ClearAllVariationParams(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 base::FieldTrialList field_trial_list_; | 62 base::FieldTrialList field_trial_list_; |
| 62 | 63 |
| 63 DISALLOW_COPY_AND_ASSIGN(VariationsAssociatedDataTest); | 64 DISALLOW_COPY_AND_ASSIGN(VariationsAssociatedDataTest); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 // Test that if the trial is immediately disabled, GetGoogleVariationID just | 67 // Test that if the trial is immediately disabled, GetGoogleVariationID just |
| 67 // returns the empty ID. | 68 // returns the empty ID. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 scoped_refptr<base::FieldTrial> trial( | 302 scoped_refptr<base::FieldTrial> trial( |
| 302 CreateFieldTrial(kTrialName, 100, "A", NULL)); | 303 CreateFieldTrial(kTrialName, 100, "A", NULL)); |
| 303 ASSERT_FALSE(IsFieldTrialActive(kTrialName)); | 304 ASSERT_FALSE(IsFieldTrialActive(kTrialName)); |
| 304 | 305 |
| 305 std::map<std::string, std::string> params; | 306 std::map<std::string, std::string> params; |
| 306 EXPECT_EQ(std::string(), GetVariationParamValue(kTrialName, "x")); | 307 EXPECT_EQ(std::string(), GetVariationParamValue(kTrialName, "x")); |
| 307 ASSERT_TRUE(IsFieldTrialActive(kTrialName)); | 308 ASSERT_TRUE(IsFieldTrialActive(kTrialName)); |
| 308 } | 309 } |
| 309 | 310 |
| 310 } // namespace chrome_variations | 311 } // namespace chrome_variations |
| OLD | NEW |