Chromium Code Reviews| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); | 652 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
| 653 ASSERT_TRUE(guest_contents); | 653 ASSERT_TRUE(guest_contents); |
| 654 | 654 |
| 655 WaitForAccessibilityTreeToContainNodeWithName(guest_contents, | 655 WaitForAccessibilityTreeToContainNodeWithName(guest_contents, |
| 656 "1 First Section\r\n"); | 656 "1 First Section\r\n"); |
| 657 ui::AXTreeUpdate ax_tree = GetAccessibilityTreeSnapshot(guest_contents); | 657 ui::AXTreeUpdate ax_tree = GetAccessibilityTreeSnapshot(guest_contents); |
| 658 std::string ax_tree_dump = DumpPdfAccessibilityTree(ax_tree); | 658 std::string ax_tree_dump = DumpPdfAccessibilityTree(ax_tree); |
| 659 ASSERT_MULTILINE_STREQ(kExpectedPDFAXTree, ax_tree_dump); | 659 ASSERT_MULTILINE_STREQ(kExpectedPDFAXTree, ax_tree_dump); |
| 660 } | 660 } |
| 661 | 661 |
| 662 #if defined(GOOGLE_CHROME_BUILD) | |
| 663 // Test a particular PDF encountered in the wild that encountered a crash | |
|
raymes
2017/01/30 18:58:04
nit: encountered a crash->triggered a crash
| |
| 664 // when accessibility is enabled. (http://crbug.com/648981) | |
| 665 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, PdfAccessibilityCharCountCrash) { | |
| 666 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); | |
| 667 GURL test_pdf_url(embedded_test_server()->GetURL( | |
| 668 "/pdf_private/accessibility_crash_1.pdf")); | |
| 669 | |
| 670 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); | |
| 671 ASSERT_TRUE(guest_contents); | |
| 672 | |
| 673 WaitForAccessibilityTreeToContainNodeWithName(guest_contents, "Page 1"); | |
| 674 } | |
| 675 #endif | |
| 676 | |
| 662 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, PdfAccessibilityEnableLater) { | 677 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, PdfAccessibilityEnableLater) { |
| 663 // In this test, load the PDF file first, with accessibility off. | 678 // In this test, load the PDF file first, with accessibility off. |
| 664 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test-bookmarks.pdf")); | 679 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test-bookmarks.pdf")); |
| 665 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); | 680 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
| 666 ASSERT_TRUE(guest_contents); | 681 ASSERT_TRUE(guest_contents); |
| 667 | 682 |
| 668 // Now enable accessibility globally, and assert that the PDF accessibility | 683 // Now enable accessibility globally, and assert that the PDF accessibility |
| 669 // tree loads. | 684 // tree loads. |
| 670 EnableAccessibilityForWebContents(guest_contents); | 685 EnableAccessibilityForWebContents(guest_contents); |
| 671 WaitForAccessibilityTreeToContainNodeWithName(guest_contents, | 686 WaitForAccessibilityTreeToContainNodeWithName(guest_contents, |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 990 ASSERT_EQ(web_contents, active_web_contents); | 1005 ASSERT_EQ(web_contents, active_web_contents); |
| 991 | 1006 |
| 992 content::WebContents* new_web_contents = | 1007 content::WebContents* new_web_contents = |
| 993 browser()->tab_strip_model()->GetWebContentsAt(1); | 1008 browser()->tab_strip_model()->GetWebContentsAt(1); |
| 994 ASSERT_TRUE(new_web_contents); | 1009 ASSERT_TRUE(new_web_contents); |
| 995 ASSERT_NE(web_contents, new_web_contents); | 1010 ASSERT_NE(web_contents, new_web_contents); |
| 996 | 1011 |
| 997 const GURL& url = new_web_contents->GetURL(); | 1012 const GURL& url = new_web_contents->GetURL(); |
| 998 ASSERT_EQ(GURL("http://www.example.com"), url); | 1013 ASSERT_EQ(GURL("http://www.example.com"), url); |
| 999 } | 1014 } |
| OLD | NEW |