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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 {"http://a.b.googleadservices.com", true}, | 146 {"http://a.b.googleadservices.com", true}, |
147 {"http://a.b.googleapis.com", true}, | 147 {"http://a.b.googleapis.com", true}, |
148 {"http://a.b.googlesyndication.com", true}, | 148 {"http://a.b.googlesyndication.com", true}, |
149 {"http://a.b.googleusercontent.com", true}, | 149 {"http://a.b.googleusercontent.com", true}, |
150 {"http://a.b.googlevideo.com", true}, | 150 {"http://a.b.googlevideo.com", true}, |
151 {"http://ssl.gstatic.com", true}, | 151 {"http://ssl.gstatic.com", true}, |
152 {"http://a.b.gstatic.com", true}, | 152 {"http://a.b.gstatic.com", true}, |
153 {"http://a.b.ytimg.com", true}, | 153 {"http://a.b.ytimg.com", true}, |
154 }; | 154 }; |
155 | 155 |
156 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { | 156 for (size_t i = 0; i < arraysize(cases); ++i) { |
157 const GURL url(cases[i].url); | 157 const GURL url(cases[i].url); |
158 EXPECT_EQ(cases[i].should_append_headers, | 158 EXPECT_EQ(cases[i].should_append_headers, |
159 VariationsHttpHeaderProvider::ShouldAppendHeaders(url)) | 159 VariationsHttpHeaderProvider::ShouldAppendHeaders(url)) |
160 << url; | 160 << url; |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 TEST_F(VariationsHttpHeaderProviderTest, SetDefaultVariationIds_Valid) { | 164 TEST_F(VariationsHttpHeaderProviderTest, SetDefaultVariationIds_Valid) { |
165 base::MessageLoop loop; | 165 base::MessageLoop loop; |
166 VariationsHttpHeaderProvider provider; | 166 VariationsHttpHeaderProvider provider; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 headers.GetHeader("X-Client-Data", &variations); | 231 headers.GetHeader("X-Client-Data", &variations); |
232 | 232 |
233 std::set<VariationID> variation_ids; | 233 std::set<VariationID> variation_ids; |
234 std::set<VariationID> trigger_ids; | 234 std::set<VariationID> trigger_ids; |
235 ASSERT_TRUE(ExtractVariationIds(variations, &variation_ids, &trigger_ids)); | 235 ASSERT_TRUE(ExtractVariationIds(variations, &variation_ids, &trigger_ids)); |
236 EXPECT_TRUE(variation_ids.find(123) != variation_ids.end()); | 236 EXPECT_TRUE(variation_ids.find(123) != variation_ids.end()); |
237 EXPECT_TRUE(trigger_ids.find(456) != trigger_ids.end()); | 237 EXPECT_TRUE(trigger_ids.find(456) != trigger_ids.end()); |
238 } | 238 } |
239 | 239 |
240 } // namespace variations | 240 } // namespace variations |
OLD | NEW |