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

Unified Diff: chrome/browser/pdf/pdf_extension_test.cc

Issue 2407713002: Limit PDF helper extension to print preview only (Closed)
Patch Set: Nits + fix compilation failure on macOS Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
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 d2642f638922cc4e51d996396728f29be62ae6eb..c49f790ea7f45d6bd8e26b69283b6feab1ca0cd8 100644
--- a/chrome/browser/pdf/pdf_extension_test.cc
+++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -464,6 +464,23 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsureSameOriginRepliesAllowed) {
true);
}
+// Ensure that the PDF component extension cannot be loaded directly.
+IN_PROC_BROWSER_TEST_F(PDFExtensionTest, BlockDirectAccess) {
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+
+ std::unique_ptr<content::ConsoleObserverDelegate> console_delegate(
+ new content::ConsoleObserverDelegate(
+ web_contents, "*Refused to load the standalone extension.*"));
+ web_contents->SetDelegate(console_delegate.get());
+ GURL forbiddenUrl(
+ "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html?"
+ "https://example.com/notrequested.pdf");
+ ui_test_utils::NavigateToURL(browser(), forbiddenUrl);
+
+ console_delegate->Wait();
raymes 2016/10/12 02:08:52 It could be good to verify that the plugin element
robwu 2016/10/12 11:33:28 The actual plugin is created asynchronously. I add
raymes 2016/10/13 00:43:22 Ah right. Ok - yeah testing the absence of success
+}
+
// This test ensures that PDF can be loaded from local file
IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsurePDFFromLocalFileLoads) {
base::FilePath test_data_dir;
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/browser_api.js » ('j') | chrome/browser/resources/pdf/browser_api.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698