OLD | NEW |
---|---|
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 Loading... | |
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_dir; | |
470 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_dir)); | |
Lei Zhang
2016/08/08 23:16:24
You can do PathService::Get(chrome::DIR_TEST_DATA,
Sergey Shekyan
2016/08/08 23:55:42
I assumed so too, but unfortunately, path set by P
Lei Zhang
2016/08/08 23:57:16
Really? Because we use just that in several places
| |
471 test_dir = test_dir.AppendASCII("chrome"); | |
472 test_dir = test_dir.AppendASCII("test"); | |
473 test_dir = test_dir.AppendASCII("data"); | |
474 test_dir = test_dir.AppendASCII("pdf"); | |
475 test_dir = test_dir.AppendASCII("test.pdf"); | |
Lei Zhang
2016/08/08 23:16:24
Please sanity check and make sure the final FilePa
Sergey Shekyan
2016/08/08 23:55:42
Acknowledged.
| |
476 GURL test_pdf_url("file://" + test_dir.MaybeAsASCII()); | |
477 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); | |
478 ASSERT_TRUE(guest_contents); | |
479 } | |
480 | |
467 // This test ensures that link permissions are enforced properly in PDFs. | 481 // This test ensures that link permissions are enforced properly in PDFs. |
468 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkPermissions) { | 482 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkPermissions) { |
469 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test.pdf")); | 483 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test.pdf")); |
470 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); | 484 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
471 ASSERT_TRUE(guest_contents); | 485 ASSERT_TRUE(guest_contents); |
472 | 486 |
473 // chrome://favicon links should be allowed for PDFs, while chrome://settings | 487 // chrome://favicon links should be allowed for PDFs, while chrome://settings |
474 // links should not. | 488 // links should not. |
475 GURL valid_link_url("chrome://favicon/https://www.google.ca/"); | 489 GURL valid_link_url("chrome://favicon/https://www.google.ca/"); |
476 GURL invalid_link_url("chrome://settings"); | 490 GURL invalid_link_url("chrome://settings"); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
839 int tab_count = browser()->tab_strip_model()->count(); | 853 int tab_count = browser()->tab_strip_model()->count(); |
840 ASSERT_EQ(2, tab_count); | 854 ASSERT_EQ(2, tab_count); |
841 | 855 |
842 content::WebContents* active_web_contents = | 856 content::WebContents* active_web_contents = |
843 browser()->tab_strip_model()->GetActiveWebContents(); | 857 browser()->tab_strip_model()->GetActiveWebContents(); |
844 ASSERT_NE(web_contents, active_web_contents); | 858 ASSERT_NE(web_contents, active_web_contents); |
845 | 859 |
846 const GURL& url = active_web_contents->GetURL(); | 860 const GURL& url = active_web_contents->GetURL(); |
847 ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); | 861 ASSERT_EQ(std::string("http://www.example.com/"), url.spec()); |
848 } | 862 } |
OLD | NEW |