Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chrome/browser/pdf/pdf_extension_test.cc

Issue 2568903002: PDF viewer: Specify tabId when navigating with chrome.tabs.update. (Closed)
Patch Set: Fix nits. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/navigator.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/navigator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698