OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_http_header_provider.h" | 5 #include "components/variations/variations_http_header_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 std::string variations = provider.GetClientDataHeader(); | 117 std::string variations = provider.GetClientDataHeader(); |
118 | 118 |
119 std::set<VariationID> variation_ids; | 119 std::set<VariationID> variation_ids; |
120 std::set<VariationID> trigger_ids; | 120 std::set<VariationID> trigger_ids; |
121 ASSERT_TRUE(ExtractVariationIds(variations, &variation_ids, &trigger_ids)); | 121 ASSERT_TRUE(ExtractVariationIds(variations, &variation_ids, &trigger_ids)); |
122 EXPECT_TRUE(variation_ids.find(123) != variation_ids.end()); | 122 EXPECT_TRUE(variation_ids.find(123) != variation_ids.end()); |
123 EXPECT_TRUE(trigger_ids.find(456) != trigger_ids.end()); | 123 EXPECT_TRUE(trigger_ids.find(456) != trigger_ids.end()); |
124 } | 124 } |
125 | 125 |
| 126 TEST_F(VariationsHttpHeaderProviderTest, GetVariationsString) { |
| 127 base::MessageLoop loop; |
| 128 base::FieldTrialList field_trial_list(nullptr); |
| 129 |
| 130 CreateTrialAndAssociateId("t1", "g1", GOOGLE_WEB_PROPERTIES, 123); |
| 131 CreateTrialAndAssociateId("t2", "g2", GOOGLE_WEB_PROPERTIES, 124); |
| 132 |
| 133 VariationsHttpHeaderProvider provider; |
| 134 provider.SetDefaultVariationIds("100,200"); |
| 135 EXPECT_EQ(" 100 123 124 200 ", provider.GetVariationsString()); |
| 136 } |
| 137 |
126 } // namespace variations | 138 } // namespace variations |
OLD | NEW |