| 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/net/variations_http_header_provider.h" | 5 #include "components/variations/net/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 return trial; | 50 return trial; |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 class VariationsHttpHeaderProviderTest : public ::testing::Test { | 55 class VariationsHttpHeaderProviderTest : public ::testing::Test { |
| 56 public: | 56 public: |
| 57 VariationsHttpHeaderProviderTest() {} | 57 VariationsHttpHeaderProviderTest() {} |
| 58 | 58 |
| 59 virtual ~VariationsHttpHeaderProviderTest() {} | 59 ~VariationsHttpHeaderProviderTest() override {} |
| 60 | 60 |
| 61 virtual void TearDown() override { | 61 void TearDown() override { testing::ClearAllVariationIDs(); } |
| 62 testing::ClearAllVariationIDs(); | |
| 63 } | |
| 64 }; | 62 }; |
| 65 | 63 |
| 66 TEST_F(VariationsHttpHeaderProviderTest, ShouldAppendHeaders) { | 64 TEST_F(VariationsHttpHeaderProviderTest, ShouldAppendHeaders) { |
| 67 struct { | 65 struct { |
| 68 const char* url; | 66 const char* url; |
| 69 bool should_append_headers; | 67 bool should_append_headers; |
| 70 } cases[] = { | 68 } cases[] = { |
| 71 {"http://google.com", true}, | 69 {"http://google.com", true}, |
| 72 {"http://www.google.com", true}, | 70 {"http://www.google.com", true}, |
| 73 {"http://m.google.com", true}, | 71 {"http://m.google.com", true}, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 headers.GetHeader("X-Client-Data", &variations); | 229 headers.GetHeader("X-Client-Data", &variations); |
| 232 | 230 |
| 233 std::set<VariationID> variation_ids; | 231 std::set<VariationID> variation_ids; |
| 234 std::set<VariationID> trigger_ids; | 232 std::set<VariationID> trigger_ids; |
| 235 ASSERT_TRUE(ExtractVariationIds(variations, &variation_ids, &trigger_ids)); | 233 ASSERT_TRUE(ExtractVariationIds(variations, &variation_ids, &trigger_ids)); |
| 236 EXPECT_TRUE(variation_ids.find(123) != variation_ids.end()); | 234 EXPECT_TRUE(variation_ids.find(123) != variation_ids.end()); |
| 237 EXPECT_TRUE(trigger_ids.find(456) != trigger_ids.end()); | 235 EXPECT_TRUE(trigger_ids.find(456) != trigger_ids.end()); |
| 238 } | 236 } |
| 239 | 237 |
| 240 } // namespace variations | 238 } // namespace variations |
| OLD | NEW |