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 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; |