| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 const GURL& url = active_web_contents->GetURL(); | 898 const GURL& url = active_web_contents->GetURL(); |
| 899 ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); | 899 ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); |
| 900 } | 900 } |
| 901 | 901 |
| 902 // Test that if the plugin tries to load a URL that redirects then it will fail | 902 // Test that if the plugin tries to load a URL that redirects then it will fail |
| 903 // to load. This is to avoid the source origin of the document changing during | 903 // to load. This is to avoid the source origin of the document changing during |
| 904 // the redirect, which can have security implications. https://crbug.com/653749. | 904 // the redirect, which can have security implications. https://crbug.com/653749. |
| 905 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, RedirectsFailInPlugin) { | 905 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, RedirectsFailInPlugin) { |
| 906 RunTestsInFile("redirects_fail_test.js", "test.pdf"); | 906 RunTestsInFile("redirects_fail_test.js", "test.pdf"); |
| 907 } | 907 } |
| 908 |
| 909 // Test that even if a different tab is selected when a navigation occurs, |
| 910 // the correct tab still gets navigated (see crbug.com/672563). |
| 911 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, NavigationOnCorrectTab) { |
| 912 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test.pdf")); |
| 913 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
| 914 ASSERT_TRUE(guest_contents); |
| 915 content::WebContents* web_contents = |
| 916 browser()->tab_strip_model()->GetActiveWebContents(); |
| 917 |
| 918 ui_test_utils::NavigateToURLWithDisposition( |
| 919 browser(), GURL("about:blank"), |
| 920 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 921 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | |
| 922 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 923 content::WebContents* active_web_contents = |
| 924 browser()->tab_strip_model()->GetActiveWebContents(); |
| 925 ASSERT_NE(web_contents, active_web_contents); |
| 926 |
| 927 ASSERT_TRUE(content::ExecuteScript( |
| 928 guest_contents, |
| 929 "viewer.navigator_.navigate(" |
| 930 " 'www.example.com', Navigator.WindowOpenDisposition.CURRENT_TAB);")); |
| 931 |
| 932 EXPECT_TRUE(web_contents->GetController().GetPendingEntry()); |
| 933 EXPECT_FALSE(active_web_contents->GetController().GetPendingEntry()); |
| 934 } |
| OLD | NEW |