Chromium Code Reviews| Index: chrome/browser/pdf/pdf_extension_test.cc |
| diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc |
| index 8220c234d88aaa73165586d9e4c8542b93f44e91..543bf911baab125b03ce175671c9ce2a53e44d40 100644 |
| --- a/chrome/browser/pdf/pdf_extension_test.cc |
| +++ b/chrome/browser/pdf/pdf_extension_test.cc |
| @@ -905,3 +905,36 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkShiftLeftClick) { |
| IN_PROC_BROWSER_TEST_F(PDFExtensionTest, RedirectsFailInPlugin) { |
| RunTestsInFile("redirects_fail_test.js", "test.pdf"); |
| } |
| + |
| +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, NavigationOnCorrectTab) { |
|
raymes
2016/12/14 01:43:28
nit: You may want to link to the bug above here an
Kevin McNee
2016/12/14 16:03:33
Done.
|
| + GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test.pdf")); |
| + content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
| + ASSERT_TRUE(guest_contents); |
| + content::WebContents* web_contents = |
| + browser()->tab_strip_model()->GetActiveWebContents(); |
| + |
| + ui_test_utils::NavigateToURLWithDisposition( |
| + browser(), GURL("about:blank"), |
| + WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| + ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | |
| + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| + content::WebContents* active_web_contents = |
| + browser()->tab_strip_model()->GetActiveWebContents(); |
|
raymes
2016/12/14 01:43:28
nit: may want to assert that active_web_contents i
Kevin McNee
2016/12/14 16:03:33
Done.
|
| + |
| + ASSERT_TRUE(content::ExecuteScript( |
| + guest_contents, |
| + "var navMessage = new MessageEvent(" |
| + " 'message'," |
| + " {" |
| + " data: {" |
| + " type: 'navigate'," |
| + " url: 'www.example.com'," |
| + " disposition: Navigator.WindowOpenDisposition.CURRENT_TAB" |
| + " }" |
| + " });" |
| + "var plugin = document.getElementsByTagName('embed')[0];" |
| + "plugin.dispatchEvent(navMessage);")); |
|
raymes
2016/12/14 01:43:28
nit: I was thinking we could just fire the navigat
Kevin McNee
2016/12/14 16:03:33
Done.
|
| + |
| + EXPECT_TRUE(web_contents->GetController().GetPendingEntry()); |
| + EXPECT_FALSE(active_web_contents->GetController().GetPendingEntry()); |
| +} |