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

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: Add test. 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 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.
910 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test.pdf"));
911 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url);
912 ASSERT_TRUE(guest_contents);
913 content::WebContents* web_contents =
914 browser()->tab_strip_model()->GetActiveWebContents();
915
916 ui_test_utils::NavigateToURLWithDisposition(
917 browser(), GURL("about:blank"),
918 WindowOpenDisposition::NEW_FOREGROUND_TAB,
919 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB |
920 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
921 content::WebContents* active_web_contents =
922 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.
923
924 ASSERT_TRUE(content::ExecuteScript(
925 guest_contents,
926 "var navMessage = new MessageEvent("
927 " 'message',"
928 " {"
929 " data: {"
930 " type: 'navigate',"
931 " url: 'www.example.com',"
932 " disposition: Navigator.WindowOpenDisposition.CURRENT_TAB"
933 " }"
934 " });"
935 "var plugin = document.getElementsByTagName('embed')[0];"
936 "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.
937
938 EXPECT_TRUE(web_contents->GetController().GetPendingEntry());
939 EXPECT_FALSE(active_web_contents->GetController().GetPendingEntry());
940 }
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