OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 10 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // link with the specified mouse button. | 114 // link with the specified mouse button. |
115 // expected_referrer: The kind of referrer to expect. | 115 // expected_referrer: The kind of referrer to expect. |
116 // | 116 // |
117 // Returns: | 117 // Returns: |
118 // The URL of the first page navigated to. | 118 // The URL of the first page navigated to. |
119 GURL RunReferrerTest(const std::string referrer_policy, | 119 GURL RunReferrerTest(const std::string referrer_policy, |
120 bool start_on_https, | 120 bool start_on_https, |
121 bool target_blank, | 121 bool target_blank, |
122 bool redirect, | 122 bool redirect, |
123 bool opens_new_tab, | 123 bool opens_new_tab, |
124 WebKit::WebMouseEvent::Button button, | 124 blink::WebMouseEvent::Button button, |
125 ExpectedReferrer expected_referrer) { | 125 ExpectedReferrer expected_referrer) { |
126 GURL start_url; | 126 GURL start_url; |
127 net::SpawnedTestServer* start_server = | 127 net::SpawnedTestServer* start_server = |
128 start_on_https ? ssl_test_server_.get() : test_server_.get(); | 128 start_on_https ? ssl_test_server_.get() : test_server_.get(); |
129 start_url = start_server->GetURL( | 129 start_url = start_server->GetURL( |
130 std::string("files/referrer-policy-start.html?") + | 130 std::string("files/referrer-policy-start.html?") + |
131 "policy=" + referrer_policy + | 131 "policy=" + referrer_policy + |
132 "&port=" + base::IntToString(test_server_->host_port_pair().port()) + | 132 "&port=" + base::IntToString(test_server_->host_port_pair().port()) + |
133 "&ssl_port=" + | 133 "&ssl_port=" + |
134 base::IntToString(ssl_test_server_->host_port_pair().port()) + | 134 base::IntToString(ssl_test_server_->host_port_pair().port()) + |
135 "&redirect=" + (redirect ? "true" : "false") + | 135 "&redirect=" + (redirect ? "true" : "false") + |
136 "&link=" + | 136 "&link=" + |
137 (button == WebKit::WebMouseEvent::ButtonNone ? "false" : "true") + | 137 (button == blink::WebMouseEvent::ButtonNone ? "false" : "true") + |
138 "&target=" + (target_blank ? "_blank" : "")); | 138 "&target=" + (target_blank ? "_blank" : "")); |
139 | 139 |
140 ui_test_utils::WindowedTabAddedNotificationObserver tab_added_observer( | 140 ui_test_utils::WindowedTabAddedNotificationObserver tab_added_observer( |
141 content::NotificationService::AllSources()); | 141 content::NotificationService::AllSources()); |
142 | 142 |
143 string16 expected_title = GetExpectedTitle(start_url, expected_referrer); | 143 string16 expected_title = GetExpectedTitle(start_url, expected_referrer); |
144 content::WebContents* tab = | 144 content::WebContents* tab = |
145 browser()->tab_strip_model()->GetActiveWebContents(); | 145 browser()->tab_strip_model()->GetActiveWebContents(); |
146 content::TitleWatcher title_watcher(tab, expected_title); | 146 content::TitleWatcher title_watcher(tab, expected_title); |
147 | 147 |
148 // Watch for all possible outcomes to avoid timeouts if something breaks. | 148 // Watch for all possible outcomes to avoid timeouts if something breaks. |
149 AddAllPossibleTitles(start_url, &title_watcher); | 149 AddAllPossibleTitles(start_url, &title_watcher); |
150 | 150 |
151 ui_test_utils::NavigateToURL(browser(), start_url); | 151 ui_test_utils::NavigateToURL(browser(), start_url); |
152 | 152 |
153 if (button != WebKit::WebMouseEvent::ButtonNone) { | 153 if (button != blink::WebMouseEvent::ButtonNone) { |
154 WebKit::WebMouseEvent mouse_event; | 154 blink::WebMouseEvent mouse_event; |
155 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 155 mouse_event.type = blink::WebInputEvent::MouseDown; |
156 mouse_event.button = button; | 156 mouse_event.button = button; |
157 mouse_event.x = 15; | 157 mouse_event.x = 15; |
158 mouse_event.y = 15; | 158 mouse_event.y = 15; |
159 mouse_event.clickCount = 1; | 159 mouse_event.clickCount = 1; |
160 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 160 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
161 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 161 mouse_event.type = blink::WebInputEvent::MouseUp; |
162 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 162 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
163 } | 163 } |
164 | 164 |
165 if (opens_new_tab) { | 165 if (opens_new_tab) { |
166 tab_added_observer.Wait(); | 166 tab_added_observer.Wait(); |
167 tab = tab_added_observer.GetTab(); | 167 tab = tab_added_observer.GetTab(); |
168 EXPECT_TRUE(tab); | 168 EXPECT_TRUE(tab); |
169 content::WaitForLoadStop(tab); | 169 content::WaitForLoadStop(tab); |
170 EXPECT_EQ(expected_title, tab->GetTitle()); | 170 EXPECT_EQ(expected_title, tab->GetTitle()); |
171 } else { | 171 } else { |
(...skipping 10 matching lines...) Expand all Loading... |
182 // The basic behavior of referrer policies is covered by layout tests in | 182 // The basic behavior of referrer policies is covered by layout tests in |
183 // http/tests/security/referrer-policy-*. These tests cover (hopefully) all | 183 // http/tests/security/referrer-policy-*. These tests cover (hopefully) all |
184 // code paths chrome uses to navigate. To keep the number of combinations down, | 184 // code paths chrome uses to navigate. To keep the number of combinations down, |
185 // we only test the "origin" policy here. | 185 // we only test the "origin" policy here. |
186 // | 186 // |
187 // Some tests are marked as FAILS, see http://crbug.com/124750 | 187 // Some tests are marked as FAILS, see http://crbug.com/124750 |
188 | 188 |
189 // Content initiated navigation, from HTTP to HTTP. | 189 // Content initiated navigation, from HTTP to HTTP. |
190 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, Origin) { | 190 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, Origin) { |
191 RunReferrerTest("origin", false, false, false, false, | 191 RunReferrerTest("origin", false, false, false, false, |
192 WebKit::WebMouseEvent::ButtonNone, | 192 blink::WebMouseEvent::ButtonNone, |
193 EXPECT_ORIGIN_AS_REFERRER); | 193 EXPECT_ORIGIN_AS_REFERRER); |
194 } | 194 } |
195 | 195 |
196 // Content initiated navigation, from HTTPS to HTTP. | 196 // Content initiated navigation, from HTTPS to HTTP. |
197 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsDefault) { | 197 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsDefault) { |
198 RunReferrerTest("origin", true, false, false, false, | 198 RunReferrerTest("origin", true, false, false, false, |
199 WebKit::WebMouseEvent::ButtonNone, | 199 blink::WebMouseEvent::ButtonNone, |
200 EXPECT_ORIGIN_AS_REFERRER); | 200 EXPECT_ORIGIN_AS_REFERRER); |
201 } | 201 } |
202 | 202 |
203 // User initiated navigation, from HTTP to HTTP. | 203 // User initiated navigation, from HTTP to HTTP. |
204 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, LeftClickOrigin) { | 204 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, LeftClickOrigin) { |
205 RunReferrerTest("origin", false, false, false, false, | 205 RunReferrerTest("origin", false, false, false, false, |
206 WebKit::WebMouseEvent::ButtonLeft, | 206 blink::WebMouseEvent::ButtonLeft, |
207 EXPECT_ORIGIN_AS_REFERRER); | 207 EXPECT_ORIGIN_AS_REFERRER); |
208 } | 208 } |
209 | 209 |
210 // User initiated navigation, from HTTPS to HTTP. | 210 // User initiated navigation, from HTTPS to HTTP. |
211 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsLeftClickOrigin) { | 211 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsLeftClickOrigin) { |
212 RunReferrerTest("origin", true, false, false, false, | 212 RunReferrerTest("origin", true, false, false, false, |
213 WebKit::WebMouseEvent::ButtonLeft, | 213 blink::WebMouseEvent::ButtonLeft, |
214 EXPECT_ORIGIN_AS_REFERRER); | 214 EXPECT_ORIGIN_AS_REFERRER); |
215 } | 215 } |
216 | 216 |
217 // User initiated navigation, middle click, from HTTP to HTTP. | 217 // User initiated navigation, middle click, from HTTP to HTTP. |
218 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MiddleClickOrigin) { | 218 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MiddleClickOrigin) { |
219 RunReferrerTest("origin", false, false, false, true, | 219 RunReferrerTest("origin", false, false, false, true, |
220 WebKit::WebMouseEvent::ButtonMiddle, | 220 blink::WebMouseEvent::ButtonMiddle, |
221 EXPECT_ORIGIN_AS_REFERRER); | 221 EXPECT_ORIGIN_AS_REFERRER); |
222 } | 222 } |
223 | 223 |
224 // User initiated navigation, middle click, from HTTPS to HTTP. | 224 // User initiated navigation, middle click, from HTTPS to HTTP. |
225 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickOrigin) { | 225 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickOrigin) { |
226 RunReferrerTest("origin", true, false, false, true, | 226 RunReferrerTest("origin", true, false, false, true, |
227 WebKit::WebMouseEvent::ButtonMiddle, | 227 blink::WebMouseEvent::ButtonMiddle, |
228 EXPECT_ORIGIN_AS_REFERRER); | 228 EXPECT_ORIGIN_AS_REFERRER); |
229 } | 229 } |
230 | 230 |
231 // User initiated navigation, target blank, from HTTP to HTTP. | 231 // User initiated navigation, target blank, from HTTP to HTTP. |
232 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, TargetBlankOrigin) { | 232 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, TargetBlankOrigin) { |
233 RunReferrerTest("origin", false, true, false, true, | 233 RunReferrerTest("origin", false, true, false, true, |
234 WebKit::WebMouseEvent::ButtonLeft, | 234 blink::WebMouseEvent::ButtonLeft, |
235 EXPECT_ORIGIN_AS_REFERRER); | 235 EXPECT_ORIGIN_AS_REFERRER); |
236 } | 236 } |
237 | 237 |
238 // User initiated navigation, target blank, from HTTPS to HTTP. | 238 // User initiated navigation, target blank, from HTTPS to HTTP. |
239 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsTargetBlankOrigin) { | 239 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsTargetBlankOrigin) { |
240 RunReferrerTest("origin", true, true, false, true, | 240 RunReferrerTest("origin", true, true, false, true, |
241 WebKit::WebMouseEvent::ButtonLeft, | 241 blink::WebMouseEvent::ButtonLeft, |
242 EXPECT_ORIGIN_AS_REFERRER); | 242 EXPECT_ORIGIN_AS_REFERRER); |
243 } | 243 } |
244 | 244 |
245 // User initiated navigation, middle click, target blank, from HTTP to HTTP. | 245 // User initiated navigation, middle click, target blank, from HTTP to HTTP. |
246 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MiddleClickTargetBlankOrigin) { | 246 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MiddleClickTargetBlankOrigin) { |
247 RunReferrerTest("origin", false, true, false, true, | 247 RunReferrerTest("origin", false, true, false, true, |
248 WebKit::WebMouseEvent::ButtonMiddle, | 248 blink::WebMouseEvent::ButtonMiddle, |
249 EXPECT_ORIGIN_AS_REFERRER); | 249 EXPECT_ORIGIN_AS_REFERRER); |
250 } | 250 } |
251 | 251 |
252 // User initiated navigation, middle click, target blank, from HTTPS to HTTP. | 252 // User initiated navigation, middle click, target blank, from HTTPS to HTTP. |
253 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickTargetBlankOrigin) { | 253 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickTargetBlankOrigin) { |
254 RunReferrerTest("origin", true, true, false, true, | 254 RunReferrerTest("origin", true, true, false, true, |
255 WebKit::WebMouseEvent::ButtonMiddle, | 255 blink::WebMouseEvent::ButtonMiddle, |
256 EXPECT_ORIGIN_AS_REFERRER); | 256 EXPECT_ORIGIN_AS_REFERRER); |
257 } | 257 } |
258 | 258 |
259 // Context menu, from HTTP to HTTP. | 259 // Context menu, from HTTP to HTTP. |
260 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuOrigin) { | 260 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuOrigin) { |
261 ContextMenuNotificationObserver context_menu_observer( | 261 ContextMenuNotificationObserver context_menu_observer( |
262 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); | 262 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
263 RunReferrerTest("origin", false, false, false, true, | 263 RunReferrerTest("origin", false, false, false, true, |
264 WebKit::WebMouseEvent::ButtonRight, | 264 blink::WebMouseEvent::ButtonRight, |
265 EXPECT_ORIGIN_AS_REFERRER); | 265 EXPECT_ORIGIN_AS_REFERRER); |
266 } | 266 } |
267 | 267 |
268 // Context menu, from HTTPS to HTTP. | 268 // Context menu, from HTTPS to HTTP. |
269 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuOrigin) { | 269 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuOrigin) { |
270 ContextMenuNotificationObserver context_menu_observer( | 270 ContextMenuNotificationObserver context_menu_observer( |
271 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); | 271 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
272 RunReferrerTest("origin", true, false, false, true, | 272 RunReferrerTest("origin", true, false, false, true, |
273 WebKit::WebMouseEvent::ButtonRight, | 273 blink::WebMouseEvent::ButtonRight, |
274 EXPECT_ORIGIN_AS_REFERRER); | 274 EXPECT_ORIGIN_AS_REFERRER); |
275 } | 275 } |
276 | 276 |
277 // Content initiated navigation, from HTTP to HTTP via server redirect. | 277 // Content initiated navigation, from HTTP to HTTP via server redirect. |
278 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, Redirect) { | 278 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, Redirect) { |
279 RunReferrerTest("origin", false, false, true, false, | 279 RunReferrerTest("origin", false, false, true, false, |
280 WebKit::WebMouseEvent::ButtonNone, | 280 blink::WebMouseEvent::ButtonNone, |
281 EXPECT_ORIGIN_AS_REFERRER); | 281 EXPECT_ORIGIN_AS_REFERRER); |
282 } | 282 } |
283 | 283 |
284 // Content initiated navigation, from HTTPS to HTTP via server redirect. | 284 // Content initiated navigation, from HTTPS to HTTP via server redirect. |
285 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsRedirect) { | 285 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsRedirect) { |
286 RunReferrerTest("origin", true, false, true, false, | 286 RunReferrerTest("origin", true, false, true, false, |
287 WebKit::WebMouseEvent::ButtonNone, | 287 blink::WebMouseEvent::ButtonNone, |
288 EXPECT_ORIGIN_AS_REFERRER); | 288 EXPECT_ORIGIN_AS_REFERRER); |
289 } | 289 } |
290 | 290 |
291 // User initiated navigation, from HTTP to HTTP via server redirect. | 291 // User initiated navigation, from HTTP to HTTP via server redirect. |
292 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, LeftClickRedirect) { | 292 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, LeftClickRedirect) { |
293 RunReferrerTest("origin", false, false, true, false, | 293 RunReferrerTest("origin", false, false, true, false, |
294 WebKit::WebMouseEvent::ButtonLeft, | 294 blink::WebMouseEvent::ButtonLeft, |
295 EXPECT_ORIGIN_AS_REFERRER); | 295 EXPECT_ORIGIN_AS_REFERRER); |
296 } | 296 } |
297 | 297 |
298 // User initiated navigation, from HTTPS to HTTP via server redirect. | 298 // User initiated navigation, from HTTPS to HTTP via server redirect. |
299 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsLeftClickRedirect) { | 299 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsLeftClickRedirect) { |
300 RunReferrerTest("origin", true, false, true, false, | 300 RunReferrerTest("origin", true, false, true, false, |
301 WebKit::WebMouseEvent::ButtonLeft, | 301 blink::WebMouseEvent::ButtonLeft, |
302 EXPECT_ORIGIN_AS_REFERRER); | 302 EXPECT_ORIGIN_AS_REFERRER); |
303 } | 303 } |
304 | 304 |
305 // User initiated navigation, middle click, from HTTP to HTTP via server | 305 // User initiated navigation, middle click, from HTTP to HTTP via server |
306 // redirect. | 306 // redirect. |
307 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MiddleClickRedirect) { | 307 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MiddleClickRedirect) { |
308 RunReferrerTest("origin", false, false, true, true, | 308 RunReferrerTest("origin", false, false, true, true, |
309 WebKit::WebMouseEvent::ButtonMiddle, | 309 blink::WebMouseEvent::ButtonMiddle, |
310 EXPECT_ORIGIN_AS_REFERRER); | 310 EXPECT_ORIGIN_AS_REFERRER); |
311 } | 311 } |
312 | 312 |
313 // User initiated navigation, middle click, from HTTPS to HTTP via server | 313 // User initiated navigation, middle click, from HTTPS to HTTP via server |
314 // redirect. | 314 // redirect. |
315 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickRedirect) { | 315 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickRedirect) { |
316 RunReferrerTest("origin", true, false, true, true, | 316 RunReferrerTest("origin", true, false, true, true, |
317 WebKit::WebMouseEvent::ButtonMiddle, | 317 blink::WebMouseEvent::ButtonMiddle, |
318 EXPECT_ORIGIN_AS_REFERRER); | 318 EXPECT_ORIGIN_AS_REFERRER); |
319 } | 319 } |
320 | 320 |
321 // User initiated navigation, target blank, from HTTP to HTTP via server | 321 // User initiated navigation, target blank, from HTTP to HTTP via server |
322 // redirect. | 322 // redirect. |
323 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, TargetBlankRedirect) { | 323 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, TargetBlankRedirect) { |
324 RunReferrerTest("origin", false, true, true, true, | 324 RunReferrerTest("origin", false, true, true, true, |
325 WebKit::WebMouseEvent::ButtonLeft, | 325 blink::WebMouseEvent::ButtonLeft, |
326 EXPECT_ORIGIN_AS_REFERRER); | 326 EXPECT_ORIGIN_AS_REFERRER); |
327 } | 327 } |
328 | 328 |
329 // User initiated navigation, target blank, from HTTPS to HTTP via server | 329 // User initiated navigation, target blank, from HTTPS to HTTP via server |
330 // redirect. | 330 // redirect. |
331 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsTargetBlankRedirect) { | 331 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsTargetBlankRedirect) { |
332 RunReferrerTest("origin", true, true, true, true, | 332 RunReferrerTest("origin", true, true, true, true, |
333 WebKit::WebMouseEvent::ButtonLeft, | 333 blink::WebMouseEvent::ButtonLeft, |
334 EXPECT_ORIGIN_AS_REFERRER); | 334 EXPECT_ORIGIN_AS_REFERRER); |
335 } | 335 } |
336 | 336 |
337 // User initiated navigation, middle click, target blank, from HTTP to HTTP via | 337 // User initiated navigation, middle click, target blank, from HTTP to HTTP via |
338 // server redirect. | 338 // server redirect. |
339 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MiddleClickTargetBlankRedirect) { | 339 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MiddleClickTargetBlankRedirect) { |
340 RunReferrerTest("origin", false, true, true, true, | 340 RunReferrerTest("origin", false, true, true, true, |
341 WebKit::WebMouseEvent::ButtonMiddle, | 341 blink::WebMouseEvent::ButtonMiddle, |
342 EXPECT_ORIGIN_AS_REFERRER); | 342 EXPECT_ORIGIN_AS_REFERRER); |
343 } | 343 } |
344 | 344 |
345 // User initiated navigation, middle click, target blank, from HTTPS to HTTP | 345 // User initiated navigation, middle click, target blank, from HTTPS to HTTP |
346 // via server redirect. | 346 // via server redirect. |
347 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, | 347 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, |
348 HttpsMiddleClickTargetBlankRedirect) { | 348 HttpsMiddleClickTargetBlankRedirect) { |
349 RunReferrerTest("origin", true, true, true, true, | 349 RunReferrerTest("origin", true, true, true, true, |
350 WebKit::WebMouseEvent::ButtonMiddle, | 350 blink::WebMouseEvent::ButtonMiddle, |
351 EXPECT_ORIGIN_AS_REFERRER); | 351 EXPECT_ORIGIN_AS_REFERRER); |
352 } | 352 } |
353 | 353 |
354 // Context menu, from HTTP to HTTP via server redirect. | 354 // Context menu, from HTTP to HTTP via server redirect. |
355 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuRedirect) { | 355 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuRedirect) { |
356 ContextMenuNotificationObserver context_menu_observer( | 356 ContextMenuNotificationObserver context_menu_observer( |
357 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); | 357 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
358 RunReferrerTest("origin", false, false, true, true, | 358 RunReferrerTest("origin", false, false, true, true, |
359 WebKit::WebMouseEvent::ButtonRight, | 359 blink::WebMouseEvent::ButtonRight, |
360 EXPECT_ORIGIN_AS_REFERRER); | 360 EXPECT_ORIGIN_AS_REFERRER); |
361 } | 361 } |
362 | 362 |
363 // Context menu, from HTTPS to HTTP via server redirect. | 363 // Context menu, from HTTPS to HTTP via server redirect. |
364 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuRedirect) { | 364 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuRedirect) { |
365 ContextMenuNotificationObserver context_menu_observer( | 365 ContextMenuNotificationObserver context_menu_observer( |
366 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); | 366 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
367 RunReferrerTest("origin", true, false, true, true, | 367 RunReferrerTest("origin", true, false, true, true, |
368 WebKit::WebMouseEvent::ButtonRight, | 368 blink::WebMouseEvent::ButtonRight, |
369 EXPECT_ORIGIN_AS_REFERRER); | 369 EXPECT_ORIGIN_AS_REFERRER); |
370 } | 370 } |
371 | 371 |
372 // Tests history navigation actions: Navigate from A to B with a referrer | 372 // Tests history navigation actions: Navigate from A to B with a referrer |
373 // policy, then navigate to C, back to B, and reload. | 373 // policy, then navigate to C, back to B, and reload. |
374 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { | 374 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { |
375 // Navigate from A to B. | 375 // Navigate from A to B. |
376 GURL start_url = RunReferrerTest("origin", true, false, true, false, | 376 GURL start_url = RunReferrerTest("origin", true, false, true, false, |
377 WebKit::WebMouseEvent::ButtonLeft, | 377 blink::WebMouseEvent::ButtonLeft, |
378 EXPECT_ORIGIN_AS_REFERRER); | 378 EXPECT_ORIGIN_AS_REFERRER); |
379 | 379 |
380 // Navigate to C. | 380 // Navigate to C. |
381 ui_test_utils::NavigateToURL(browser(), test_server_->GetURL(std::string())); | 381 ui_test_utils::NavigateToURL(browser(), test_server_->GetURL(std::string())); |
382 | 382 |
383 string16 expected_title = | 383 string16 expected_title = |
384 GetExpectedTitle(start_url, EXPECT_ORIGIN_AS_REFERRER); | 384 GetExpectedTitle(start_url, EXPECT_ORIGIN_AS_REFERRER); |
385 content::WebContents* tab = | 385 content::WebContents* tab = |
386 browser()->tab_strip_model()->GetActiveWebContents(); | 386 browser()->tab_strip_model()->GetActiveWebContents(); |
387 scoped_ptr<content::TitleWatcher> title_watcher( | 387 scoped_ptr<content::TitleWatcher> title_watcher( |
(...skipping 13 matching lines...) Expand all Loading... |
401 chrome::Reload(browser(), CURRENT_TAB); | 401 chrome::Reload(browser(), CURRENT_TAB); |
402 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); | 402 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); |
403 | 403 |
404 title_watcher.reset(new content::TitleWatcher(tab, expected_title)); | 404 title_watcher.reset(new content::TitleWatcher(tab, expected_title)); |
405 AddAllPossibleTitles(start_url, title_watcher.get()); | 405 AddAllPossibleTitles(start_url, title_watcher.get()); |
406 | 406 |
407 // Shift-reload to B. | 407 // Shift-reload to B. |
408 chrome::ReloadIgnoringCache(browser(), CURRENT_TAB); | 408 chrome::ReloadIgnoringCache(browser(), CURRENT_TAB); |
409 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); | 409 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); |
410 } | 410 } |
OLD | NEW |