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 "chrome/browser/metrics/variations/variations_http_header_provider.h" | 5 #include "chrome/browser/metrics/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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 { "http://www.youtube.ca", true }, | 85 { "http://www.youtube.ca", true }, |
86 { "http://www.youtube.co.uk:8080/", true }, | 86 { "http://www.youtube.co.uk:8080/", true }, |
87 { "https://www.youtube.com", true }, | 87 { "https://www.youtube.com", true }, |
88 { "http://youtube", false }, | 88 { "http://youtube", false }, |
89 | 89 |
90 { "http://www.yahoo.com", false }, | 90 { "http://www.yahoo.com", false }, |
91 | 91 |
92 { "http://ad.doubleclick.net", true }, | 92 { "http://ad.doubleclick.net", true }, |
93 { "https://a.b.c.doubleclick.net", true }, | 93 { "https://a.b.c.doubleclick.net", true }, |
94 { "https://a.b.c.doubleclick.net:8081", true }, | 94 { "https://a.b.c.doubleclick.net:8081", true }, |
95 { "http://www.doubleclick.com", false }, | 95 { "http://www.doubleclick.com", true }, |
| 96 { "http://www.doubleclick.org", false }, |
96 { "http://www.doubleclick.net.com", false }, | 97 { "http://www.doubleclick.net.com", false }, |
97 { "https://www.doubleclick.net.com", false }, | 98 { "https://www.doubleclick.net.com", false }, |
98 | 99 |
99 { "http://ad.googlesyndication.com", true }, | 100 { "http://ad.googlesyndication.com", true }, |
100 { "https://a.b.c.googlesyndication.com", true }, | 101 { "https://a.b.c.googlesyndication.com", true }, |
101 { "https://a.b.c.googlesyndication.com:8080", true }, | 102 { "https://a.b.c.googlesyndication.com:8080", true }, |
102 { "http://www.doubleclick.edu", false }, | 103 { "http://www.doubleclick.edu", false }, |
103 { "http://www.googlesyndication.com.edu", false }, | 104 { "http://www.googlesyndication.com.edu", false }, |
104 { "https://www.googlesyndication.com.com", false }, | 105 { "https://www.googlesyndication.com.com", false }, |
105 | 106 |
106 { "http://www.googleadservices.com", true }, | 107 { "http://www.googleadservices.com", true }, |
107 { "http://www.googleadservices.com:8080", true }, | 108 { "http://www.googleadservices.com:8080", true }, |
108 { "https://www.googleadservices.com", true }, | 109 { "https://www.googleadservices.com", true }, |
109 { "https://www.internal.googleadservices.com", false }, | 110 { "https://www.internal.googleadservices.com", true }, |
110 { "https://www2.googleadservices.com", false }, | 111 { "https://www2.googleadservices.com", true }, |
111 { "https://www.googleadservices.org", false }, | 112 { "https://www.googleadservices.org", false }, |
112 { "https://www.googleadservices.com.co.uk", false }, | 113 { "https://www.googleadservices.com.co.uk", false }, |
| 114 |
| 115 { "http://WWW.ANDROID.COM", true }, |
| 116 { "http://www.android.com", true }, |
| 117 { "http://www.doubleclick.com", true }, |
| 118 { "http://www.doubleclick.net", true }, |
| 119 { "http://www.ggpht.com", true }, |
| 120 { "http://www.googleadservices.com", true }, |
| 121 { "http://www.googleapis.com", true }, |
| 122 { "http://www.googlesyndication.com", true }, |
| 123 { "http://www.googleusercontent.com", true }, |
| 124 { "http://www.googlevideo.com", true }, |
| 125 { "http://ssl.gstatic.com", true }, |
| 126 { "http://www.gstatic.com", true }, |
| 127 { "http://www.ytimg.com", true }, |
| 128 { "http://wwwytimg.com", false }, |
| 129 { "http://ytimg.com", false }, |
| 130 |
| 131 { "http://www.android.org", false }, |
| 132 { "http://www.doubleclick.org", false }, |
| 133 { "http://www.doubleclick.net", true }, |
| 134 { "http://www.ggpht.org", false }, |
| 135 { "http://www.googleadservices.org", false }, |
| 136 { "http://www.googleapis.org", false }, |
| 137 { "http://www.googlesyndication.org", false }, |
| 138 { "http://www.googleusercontent.org", false }, |
| 139 { "http://www.googlevideo.org", false }, |
| 140 { "http://ssl.gstatic.org", false }, |
| 141 { "http://www.gstatic.org", false }, |
| 142 { "http://www.ytimg.org", false }, |
| 143 |
| 144 { "http://a.b.android.com", true }, |
| 145 { "http://a.b.doubleclick.com", true }, |
| 146 { "http://a.b.doubleclick.net", true }, |
| 147 { "http://a.b.ggpht.com", true }, |
| 148 { "http://a.b.googleadservices.com", true }, |
| 149 { "http://a.b.googleapis.com", true }, |
| 150 { "http://a.b.googlesyndication.com", true }, |
| 151 { "http://a.b.googleusercontent.com", true }, |
| 152 { "http://a.b.googlevideo.com", true }, |
| 153 { "http://ssl.gstatic.com", true }, |
| 154 { "http://a.b.gstatic.com", true }, |
| 155 { "http://a.b.ytimg.com", true }, |
| 156 |
113 }; | 157 }; |
114 | 158 |
115 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { | 159 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { |
116 const GURL url(cases[i].url); | 160 const GURL url(cases[i].url); |
117 EXPECT_EQ(cases[i].should_append_headers, | 161 EXPECT_EQ(cases[i].should_append_headers, |
118 VariationsHttpHeaderProvider::ShouldAppendHeaders(url)) << url; | 162 VariationsHttpHeaderProvider::ShouldAppendHeaders(url)) << url; |
119 } | 163 } |
120 } | 164 } |
121 | 165 |
122 TEST_F(VariationsHttpHeaderProviderTest, SetDefaultVariationIds_Valid) { | 166 TEST_F(VariationsHttpHeaderProviderTest, SetDefaultVariationIds_Valid) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 headers.GetHeader("X-Client-Data", &variations); | 233 headers.GetHeader("X-Client-Data", &variations); |
190 | 234 |
191 std::set<VariationID> variation_ids; | 235 std::set<VariationID> variation_ids; |
192 std::set<VariationID> trigger_ids; | 236 std::set<VariationID> trigger_ids; |
193 ASSERT_TRUE(ExtractVariationIds(variations, &variation_ids, &trigger_ids)); | 237 ASSERT_TRUE(ExtractVariationIds(variations, &variation_ids, &trigger_ids)); |
194 EXPECT_TRUE(variation_ids.find(123) != variation_ids.end()); | 238 EXPECT_TRUE(variation_ids.find(123) != variation_ids.end()); |
195 EXPECT_TRUE(trigger_ids.find(456) != trigger_ids.end()); | 239 EXPECT_TRUE(trigger_ids.find(456) != trigger_ids.end()); |
196 } | 240 } |
197 | 241 |
198 } // namespace chrome_variations | 242 } // namespace chrome_variations |
OLD | NEW |