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
3 // found in the LICENSE file.
6 #include "base/prefs/pref_service.h"
7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
12 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h"
13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_commands.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/common/pref_names.h"
17 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/navigation_entry.h"
21 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/web_contents.h"
24 #include "content/public/test/browser_test_utils.h"
25 #include "net/test/spawned_test_server/spawned_test_server.h"
26 #include "third_party/WebKit/public/web/WebInputEvent.h"
28 // GTK requires a X11-level mouse event to open a context menu correctly.
29 #if defined(TOOLKIT_GTK)
30 #define MAYBE_ContextMenuOrigin DISABLED_ContextMenuOrigin
31 #define MAYBE_HttpsContextMenuOrigin DISABLED_HttpsContextMenuOrigin
32 #define MAYBE_ContextMenuRedirect DISABLED_ContextMenuRedirect
33 #define MAYBE_HttpsContextMenuRedirect DISABLED_HttpsContextMenuRedirect
35 #define MAYBE_ContextMenuOrigin ContextMenuOrigin
36 #define MAYBE_HttpsContextMenuOrigin HttpsContextMenuOrigin
37 #define MAYBE_ContextMenuRedirect ContextMenuRedirect
38 #define MAYBE_HttpsContextMenuRedirect HttpsContextMenuRedirect
43 const base::FilePath::CharType kDocRoot
[] =
44 FILE_PATH_LITERAL("chrome/test/data/referrer_policy");
48 class ReferrerPolicyTest
: public InProcessBrowserTest
{
50 ReferrerPolicyTest() {}
51 virtual ~ReferrerPolicyTest() {}
53 virtual void SetUp() OVERRIDE
{
54 test_server_
.reset(new net::SpawnedTestServer(
55 net::SpawnedTestServer::TYPE_HTTP
,
56 net::SpawnedTestServer::kLocalhost
,
57 base::FilePath(kDocRoot
)));
58 ASSERT_TRUE(test_server_
->Start());
59 ssl_test_server_
.reset(new net::SpawnedTestServer(
60 net::SpawnedTestServer::TYPE_HTTPS
,
61 net::SpawnedTestServer::kLocalhost
,
62 base::FilePath(kDocRoot
)));
63 ASSERT_TRUE(ssl_test_server_
->Start());
65 InProcessBrowserTest::SetUp();
69 enum ExpectedReferrer
{
70 EXPECT_EMPTY_REFERRER
,
72 EXPECT_ORIGIN_AS_REFERRER
75 // Returns the expected title for the tab with the given (full) referrer and
76 // the expected modification of it.
77 base::string16
GetExpectedTitle(const GURL
& url
,
78 ExpectedReferrer expected_referrer
) {
80 switch (expected_referrer
) {
81 case EXPECT_EMPTY_REFERRER
:
82 referrer
= "Referrer is empty";
84 case EXPECT_FULL_REFERRER
:
85 referrer
= "Referrer is " + url
.spec();
87 case EXPECT_ORIGIN_AS_REFERRER
:
88 referrer
= "Referrer is " + url
.GetWithEmptyPath().spec();
91 return base::ASCIIToUTF16(referrer
);
94 // Adds all possible titles to the TitleWatcher, so we don't time out
95 // waiting for the title if the test fails.
96 void AddAllPossibleTitles(const GURL
& url
,
97 content::TitleWatcher
* title_watcher
) {
98 title_watcher
->AlsoWaitForTitle(
99 GetExpectedTitle(url
, EXPECT_EMPTY_REFERRER
));
100 title_watcher
->AlsoWaitForTitle(
101 GetExpectedTitle(url
, EXPECT_FULL_REFERRER
));
102 title_watcher
->AlsoWaitForTitle(
103 GetExpectedTitle(url
, EXPECT_ORIGIN_AS_REFERRER
));
106 // Returns a string representation of a given |referrer_policy|.
107 std::string
ReferrerPolicyToString(blink::WebReferrerPolicy referrer_policy
) {
108 switch (referrer_policy
) {
109 case blink::WebReferrerPolicyDefault
:
111 case blink::WebReferrerPolicyOrigin
:
113 case blink::WebReferrerPolicyAlways
:
115 case blink::WebReferrerPolicyNever
:
123 enum StartOnProtocol
{ START_ON_HTTP
, START_ON_HTTPS
, };
125 enum LinkType
{ REGULAR_LINK
, LINk_WITH_TARGET_BLANK
, };
127 enum RedirectType
{ NO_REDIRECT
, SERVER_REDIRECT
, SERVER_REDIRECT_ON_HTTP
, };
129 std::string
RedirectTypeToString(RedirectType redirect
) {
133 case SERVER_REDIRECT
:
135 case SERVER_REDIRECT_ON_HTTP
:
142 // Navigates from a page with a given |referrer_policy| and checks that the
143 // reported referrer matches the expectation.
145 // referrer_policy: The referrer policy to test.
146 // start_protocol: The protocol the test should start on.
147 // link_type: The link type that is used to trigger the navigation.
148 // redirect: Whether the link target should redirect and how.
149 // disposition: The disposition for the navigation.
150 // button: If not WebMouseEvent::ButtonNone, click on the
151 // link with the specified mouse button.
152 // expected_referrer: The kind of referrer to expect.
155 // The URL of the first page navigated to.
156 GURL
RunReferrerTest(const blink::WebReferrerPolicy referrer_policy
,
157 StartOnProtocol start_protocol
,
159 RedirectType redirect
,
160 WindowOpenDisposition disposition
,
161 blink::WebMouseEvent::Button button
,
162 ExpectedReferrer expected_referrer
) {
164 net::SpawnedTestServer
* start_server
= start_protocol
== START_ON_HTTPS
165 ? ssl_test_server_
.get()
166 : test_server_
.get();
167 start_url
= start_server
->GetURL(
168 std::string("files/referrer-policy-start.html?") + "policy=" +
169 ReferrerPolicyToString(referrer_policy
) + "&port=" +
170 base::IntToString(test_server_
->host_port_pair().port()) +
172 base::IntToString(ssl_test_server_
->host_port_pair().port()) +
173 "&redirect=" + RedirectTypeToString(redirect
) + "&link=" +
174 (button
== blink::WebMouseEvent::ButtonNone
? "false" : "true") +
175 "&target=" + (link_type
== LINk_WITH_TARGET_BLANK
? "_blank" : ""));
177 ui_test_utils::WindowedTabAddedNotificationObserver
tab_added_observer(
178 content::NotificationService::AllSources());
180 base::string16 expected_title
=
181 GetExpectedTitle(start_url
, expected_referrer
);
182 content::WebContents
* tab
=
183 browser()->tab_strip_model()->GetActiveWebContents();
184 content::TitleWatcher
title_watcher(tab
, expected_title
);
186 // Watch for all possible outcomes to avoid timeouts if something breaks.
187 AddAllPossibleTitles(start_url
, &title_watcher
);
189 ui_test_utils::NavigateToURL(browser(), start_url
);
191 if (button
!= blink::WebMouseEvent::ButtonNone
) {
192 blink::WebMouseEvent mouse_event
;
193 mouse_event
.type
= blink::WebInputEvent::MouseDown
;
194 mouse_event
.button
= button
;
197 mouse_event
.clickCount
= 1;
198 tab
->GetRenderViewHost()->ForwardMouseEvent(mouse_event
);
199 mouse_event
.type
= blink::WebInputEvent::MouseUp
;
200 tab
->GetRenderViewHost()->ForwardMouseEvent(mouse_event
);
203 if (disposition
== CURRENT_TAB
) {
204 EXPECT_EQ(expected_title
, title_watcher
.WaitAndGetTitle());
206 tab_added_observer
.Wait();
207 tab
= tab_added_observer
.GetTab();
209 content::TitleWatcher
title_watcher2(tab
, expected_title
);
211 // Watch for all possible outcomes to avoid timeouts if something breaks.
212 AddAllPossibleTitles(start_url
, &title_watcher2
);
214 EXPECT_EQ(expected_title
, title_watcher2
.WaitAndGetTitle());
217 EXPECT_EQ(referrer_policy
,
218 tab
->GetController().GetActiveEntry()->GetReferrer().policy
);
223 scoped_ptr
<net::SpawnedTestServer
> test_server_
;
224 scoped_ptr
<net::SpawnedTestServer
> ssl_test_server_
;
227 // The basic behavior of referrer policies is covered by layout tests in
228 // http/tests/security/referrer-policy-*. These tests cover (hopefully) all
229 // code paths chrome uses to navigate. To keep the number of combinations down,
230 // we only test the "origin" policy here.
232 // Some tests are marked as FAILS, see http://crbug.com/124750
234 // Content initiated navigation, from HTTP to HTTP.
235 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, Origin
) {
236 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
241 blink::WebMouseEvent::ButtonNone
,
242 EXPECT_ORIGIN_AS_REFERRER
);
245 // Content initiated navigation, from HTTPS to HTTP.
246 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsDefault
) {
247 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
252 blink::WebMouseEvent::ButtonNone
,
253 EXPECT_ORIGIN_AS_REFERRER
);
256 // User initiated navigation, from HTTP to HTTP.
257 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, LeftClickOrigin
) {
258 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
263 blink::WebMouseEvent::ButtonLeft
,
264 EXPECT_ORIGIN_AS_REFERRER
);
267 // User initiated navigation, from HTTPS to HTTP.
268 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsLeftClickOrigin
) {
269 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
274 blink::WebMouseEvent::ButtonLeft
,
275 EXPECT_ORIGIN_AS_REFERRER
);
278 // User initiated navigation, middle click, from HTTP to HTTP.
279 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, MiddleClickOrigin
) {
280 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
285 blink::WebMouseEvent::ButtonMiddle
,
286 EXPECT_ORIGIN_AS_REFERRER
);
289 // User initiated navigation, middle click, from HTTPS to HTTP.
290 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsMiddleClickOrigin
) {
291 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
296 blink::WebMouseEvent::ButtonMiddle
,
297 EXPECT_ORIGIN_AS_REFERRER
);
300 // User initiated navigation, target blank, from HTTP to HTTP.
301 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, TargetBlankOrigin
) {
302 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
304 LINk_WITH_TARGET_BLANK
,
307 blink::WebMouseEvent::ButtonLeft
,
308 EXPECT_ORIGIN_AS_REFERRER
);
311 // User initiated navigation, target blank, from HTTPS to HTTP.
312 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsTargetBlankOrigin
) {
313 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
315 LINk_WITH_TARGET_BLANK
,
318 blink::WebMouseEvent::ButtonLeft
,
319 EXPECT_ORIGIN_AS_REFERRER
);
322 // User initiated navigation, middle click, target blank, from HTTP to HTTP.
323 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, MiddleClickTargetBlankOrigin
) {
324 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
326 LINk_WITH_TARGET_BLANK
,
329 blink::WebMouseEvent::ButtonMiddle
,
330 EXPECT_ORIGIN_AS_REFERRER
);
333 // User initiated navigation, middle click, target blank, from HTTPS to HTTP.
334 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsMiddleClickTargetBlankOrigin
) {
335 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
337 LINk_WITH_TARGET_BLANK
,
340 blink::WebMouseEvent::ButtonMiddle
,
341 EXPECT_ORIGIN_AS_REFERRER
);
344 // Context menu, from HTTP to HTTP.
345 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, MAYBE_ContextMenuOrigin
) {
346 ContextMenuNotificationObserver
context_menu_observer(
347 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB
);
348 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
353 blink::WebMouseEvent::ButtonRight
,
354 EXPECT_ORIGIN_AS_REFERRER
);
357 // Context menu, from HTTPS to HTTP.
358 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, MAYBE_HttpsContextMenuOrigin
) {
359 ContextMenuNotificationObserver
context_menu_observer(
360 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB
);
361 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
366 blink::WebMouseEvent::ButtonRight
,
367 EXPECT_ORIGIN_AS_REFERRER
);
370 // Content initiated navigation, from HTTP to HTTP via server redirect.
371 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, Redirect
) {
372 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
377 blink::WebMouseEvent::ButtonNone
,
378 EXPECT_ORIGIN_AS_REFERRER
);
381 // Content initiated navigation, from HTTPS to HTTP via server redirect.
382 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsRedirect
) {
383 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
388 blink::WebMouseEvent::ButtonNone
,
389 EXPECT_ORIGIN_AS_REFERRER
);
392 // User initiated navigation, from HTTP to HTTP via server redirect.
393 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, LeftClickRedirect
) {
394 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
399 blink::WebMouseEvent::ButtonLeft
,
400 EXPECT_ORIGIN_AS_REFERRER
);
403 // User initiated navigation, from HTTPS to HTTP via server redirect.
404 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsLeftClickRedirect
) {
405 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
410 blink::WebMouseEvent::ButtonLeft
,
411 EXPECT_ORIGIN_AS_REFERRER
);
414 // User initiated navigation, middle click, from HTTP to HTTP via server
416 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, MiddleClickRedirect
) {
417 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
422 blink::WebMouseEvent::ButtonMiddle
,
423 EXPECT_ORIGIN_AS_REFERRER
);
426 // User initiated navigation, middle click, from HTTPS to HTTP via server
428 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsMiddleClickRedirect
) {
429 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
434 blink::WebMouseEvent::ButtonMiddle
,
435 EXPECT_ORIGIN_AS_REFERRER
);
438 // User initiated navigation, target blank, from HTTP to HTTP via server
440 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, TargetBlankRedirect
) {
441 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
443 LINk_WITH_TARGET_BLANK
,
446 blink::WebMouseEvent::ButtonLeft
,
447 EXPECT_ORIGIN_AS_REFERRER
);
450 // User initiated navigation, target blank, from HTTPS to HTTP via server
452 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, HttpsTargetBlankRedirect
) {
453 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
455 LINk_WITH_TARGET_BLANK
,
458 blink::WebMouseEvent::ButtonLeft
,
459 EXPECT_ORIGIN_AS_REFERRER
);
462 // User initiated navigation, middle click, target blank, from HTTP to HTTP via
464 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, MiddleClickTargetBlankRedirect
) {
465 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
467 LINk_WITH_TARGET_BLANK
,
470 blink::WebMouseEvent::ButtonMiddle
,
471 EXPECT_ORIGIN_AS_REFERRER
);
474 // User initiated navigation, middle click, target blank, from HTTPS to HTTP
475 // via server redirect.
476 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
,
477 HttpsMiddleClickTargetBlankRedirect
) {
478 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
480 LINk_WITH_TARGET_BLANK
,
483 blink::WebMouseEvent::ButtonMiddle
,
484 EXPECT_ORIGIN_AS_REFERRER
);
487 // Context menu, from HTTP to HTTP via server redirect.
488 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, MAYBE_ContextMenuRedirect
) {
489 ContextMenuNotificationObserver
context_menu_observer(
490 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB
);
491 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
496 blink::WebMouseEvent::ButtonRight
,
497 EXPECT_ORIGIN_AS_REFERRER
);
500 // Context menu, from HTTPS to HTTP via server redirect.
501 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, MAYBE_HttpsContextMenuRedirect
) {
502 ContextMenuNotificationObserver
context_menu_observer(
503 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB
);
504 RunReferrerTest(blink::WebReferrerPolicyOrigin
,
509 blink::WebMouseEvent::ButtonRight
,
510 EXPECT_ORIGIN_AS_REFERRER
);
513 // Tests history navigation actions: Navigate from A to B with a referrer
514 // policy, then navigate to C, back to B, and reload.
515 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, History
) {
516 // Navigate from A to B.
517 GURL start_url
= RunReferrerTest(blink::WebReferrerPolicyOrigin
,
522 blink::WebMouseEvent::ButtonLeft
,
523 EXPECT_ORIGIN_AS_REFERRER
);
526 ui_test_utils::NavigateToURL(browser(), test_server_
->GetURL(std::string()));
528 base::string16 expected_title
=
529 GetExpectedTitle(start_url
, EXPECT_ORIGIN_AS_REFERRER
);
530 content::WebContents
* tab
=
531 browser()->tab_strip_model()->GetActiveWebContents();
532 scoped_ptr
<content::TitleWatcher
> title_watcher(
533 new content::TitleWatcher(tab
, expected_title
));
535 // Watch for all possible outcomes to avoid timeouts if something breaks.
536 AddAllPossibleTitles(start_url
, title_watcher
.get());
539 chrome::GoBack(browser(), CURRENT_TAB
);
540 EXPECT_EQ(expected_title
, title_watcher
->WaitAndGetTitle());
542 title_watcher
.reset(new content::TitleWatcher(tab
, expected_title
));
543 AddAllPossibleTitles(start_url
, title_watcher
.get());
546 chrome::Reload(browser(), CURRENT_TAB
);
547 EXPECT_EQ(expected_title
, title_watcher
->WaitAndGetTitle());
549 title_watcher
.reset(new content::TitleWatcher(tab
, expected_title
));
550 AddAllPossibleTitles(start_url
, title_watcher
.get());
552 // Shift-reload to B.
553 chrome::ReloadIgnoringCache(browser(), CURRENT_TAB
);
554 EXPECT_EQ(expected_title
, title_watcher
->WaitAndGetTitle());
557 // Tests that reloading a site for "request tablet version" correctly clears
559 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, RequestTabletSite
) {
560 GURL start_url
= RunReferrerTest(blink::WebReferrerPolicyOrigin
,
563 SERVER_REDIRECT_ON_HTTP
,
565 blink::WebMouseEvent::ButtonLeft
,
566 EXPECT_ORIGIN_AS_REFERRER
);
568 base::string16 expected_title
=
569 GetExpectedTitle(start_url
, EXPECT_EMPTY_REFERRER
);
570 content::WebContents
* tab
=
571 browser()->tab_strip_model()->GetActiveWebContents();
572 content::TitleWatcher
title_watcher(tab
, expected_title
);
574 // Watch for all possible outcomes to avoid timeouts if something breaks.
575 AddAllPossibleTitles(start_url
, &title_watcher
);
577 // Request tablet version.
578 chrome::ToggleRequestTabletSite(browser());
579 EXPECT_EQ(expected_title
, title_watcher
.WaitAndGetTitle());
582 // Test that an iframes gets the parent frames referrer and referrer policy if
583 // the load was triggered by the parent, or from the iframe itself, if the
584 // navigations was started by the iframe.
585 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest
, IFrame
) {
586 browser()->profile()->GetPrefs()->SetBoolean(
587 prefs::kWebKitAllowRunningInsecureContent
, true);
588 content::WebContents
* tab
=
589 browser()->tab_strip_model()->GetActiveWebContents();
590 base::string16
expected_title(base::ASCIIToUTF16("loaded"));
591 scoped_ptr
<content::TitleWatcher
> title_watcher(
592 new content::TitleWatcher(tab
, expected_title
));
594 // Load a page that loads an iframe.
595 ui_test_utils::NavigateToURL(
597 ssl_test_server_
->GetURL(
598 std::string("files/referrer-policy-iframe.html?") +
599 base::IntToString(test_server_
->host_port_pair().port())));
600 EXPECT_EQ(expected_title
, title_watcher
->WaitAndGetTitle());
602 // Verify that the referrer policy was honored and the main page's origin was
604 content::RenderFrameHost
* frame
= content::FrameMatchingPredicate(
605 tab
, base::Bind(&content::FrameIsChildOfMainFrame
));
607 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
609 "window.domAutomationController.send(document.title)",
611 EXPECT_EQ("Referrer is " + ssl_test_server_
->GetURL(std::string()).spec(),
614 // Reload the iframe.
615 expected_title
= base::ASCIIToUTF16("reset");
616 title_watcher
.reset(new content::TitleWatcher(tab
, expected_title
));
617 EXPECT_TRUE(content::ExecuteScript(tab
, "document.title = 'reset'"));
618 EXPECT_EQ(expected_title
, title_watcher
->WaitAndGetTitle());
620 expected_title
= base::ASCIIToUTF16("loaded");
621 title_watcher
.reset(new content::TitleWatcher(tab
, expected_title
));
622 EXPECT_TRUE(content::ExecuteScript(frame
, "location.reload()"));
623 EXPECT_EQ(expected_title
, title_watcher
->WaitAndGetTitle());
625 // Verify that the full url of the iframe was used as referrer.
626 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
628 "window.domAutomationController.send(document.title)",
630 EXPECT_EQ("Referrer is " +
631 test_server_
->GetURL("files/referrer-policy-log.html").spec(),