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

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

Issue 2209113002: Change wildcard source expression matching to conform latest spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust CSP of feedback extension Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/feedback/manifest.json » ('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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 "</body></html>"; 457 "</body></html>";
458 TestGetSelectedTextReply(GURL(data_url), false); 458 TestGetSelectedTextReply(GURL(data_url), false);
459 } 459 }
460 460
461 // Ensure same-origin replies do work for getSelectedText. 461 // Ensure same-origin replies do work for getSelectedText.
462 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsureSameOriginRepliesAllowed) { 462 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsureSameOriginRepliesAllowed) {
463 TestGetSelectedTextReply(embedded_test_server()->GetURL("/pdf/test.pdf"), 463 TestGetSelectedTextReply(embedded_test_server()->GetURL("/pdf/test.pdf"),
464 true); 464 true);
465 } 465 }
466 466
467 // This test ensures that PDF can be loaded from local file
468 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsurePDFFromLocalFileLoads) {
469 base::FilePath test_data_dir;
470 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir));
471 test_data_dir = test_data_dir.Append(FILE_PATH_LITERAL("pdf"));
472 base::FilePath test_data_file = test_data_dir.AppendASCII("test.pdf");
473 ASSERT_TRUE(PathExists(test_data_file));
474 GURL test_pdf_url("file://" + test_data_file.MaybeAsASCII());
475 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url);
476 ASSERT_TRUE(guest_contents);
477 }
478
467 // This test ensures that link permissions are enforced properly in PDFs. 479 // This test ensures that link permissions are enforced properly in PDFs.
468 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkPermissions) { 480 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkPermissions) {
469 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test.pdf")); 481 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test.pdf"));
470 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); 482 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url);
471 ASSERT_TRUE(guest_contents); 483 ASSERT_TRUE(guest_contents);
472 484
473 // chrome://favicon links should be allowed for PDFs, while chrome://settings 485 // chrome://favicon links should be allowed for PDFs, while chrome://settings
474 // links should not. 486 // links should not.
475 GURL valid_link_url("chrome://favicon/https://www.google.ca/"); 487 GURL valid_link_url("chrome://favicon/https://www.google.ca/");
476 GURL invalid_link_url("chrome://settings"); 488 GURL invalid_link_url("chrome://settings");
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 int tab_count = browser()->tab_strip_model()->count(); 851 int tab_count = browser()->tab_strip_model()->count();
840 ASSERT_EQ(2, tab_count); 852 ASSERT_EQ(2, tab_count);
841 853
842 content::WebContents* active_web_contents = 854 content::WebContents* active_web_contents =
843 browser()->tab_strip_model()->GetActiveWebContents(); 855 browser()->tab_strip_model()->GetActiveWebContents();
844 ASSERT_NE(web_contents, active_web_contents); 856 ASSERT_NE(web_contents, active_web_contents);
845 857
846 const GURL& url = active_web_contents->GetURL(); 858 const GURL& url = active_web_contents->GetURL();
847 ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); 859 ASSERT_EQ(std::string("http://www.example.com/"), url.spec());
848 } 860 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/feedback/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698