| 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 guest_manager->ForEachGuest(contents, | 720 guest_manager->ForEachGuest(contents, |
| 721 base::Bind(&RetrieveGuestContents, | 721 base::Bind(&RetrieveGuestContents, |
| 722 &guest_contents)); | 722 &guest_contents)); |
| 723 ASSERT_TRUE(guest_contents); | 723 ASSERT_TRUE(guest_contents); |
| 724 | 724 |
| 725 ui::AXTreeUpdate ax_tree = GetAccessibilityTreeSnapshot(guest_contents); | 725 ui::AXTreeUpdate ax_tree = GetAccessibilityTreeSnapshot(guest_contents); |
| 726 std::string ax_tree_dump = DumpPdfAccessibilityTree(ax_tree); | 726 std::string ax_tree_dump = DumpPdfAccessibilityTree(ax_tree); |
| 727 ASSERT_MULTILINE_STREQ(kExpectedPDFAXTree, ax_tree_dump); | 727 ASSERT_MULTILINE_STREQ(kExpectedPDFAXTree, ax_tree_dump); |
| 728 } | 728 } |
| 729 | 729 |
| 730 #if defined(GOOGLE_CHROME_BUILD) |
| 731 // Test a particular PDF encountered in the wild that triggered a crash |
| 732 // when accessibility is enabled. (http://crbug.com/668724) |
| 733 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, PdfAccessibilityTextRunCrash) { |
| 734 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); |
| 735 GURL test_pdf_url(embedded_test_server()->GetURL( |
| 736 "/pdf_private/accessibility_crash_2.pdf")); |
| 737 |
| 738 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
| 739 ASSERT_TRUE(guest_contents); |
| 740 |
| 741 WaitForAccessibilityTreeToContainNodeWithName(guest_contents, "Page 1"); |
| 742 } |
| 743 #endif |
| 744 |
| 730 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkCtrlLeftClick) { | 745 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, LinkCtrlLeftClick) { |
| 731 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 746 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
| 732 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test-link.pdf")); | 747 GURL test_pdf_url(embedded_test_server()->GetURL("/pdf/test-link.pdf")); |
| 733 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); | 748 content::WebContents* guest_contents = LoadPdfGetGuestContents(test_pdf_url); |
| 734 ASSERT_TRUE(guest_contents); | 749 ASSERT_TRUE(guest_contents); |
| 735 | 750 |
| 736 // The link position of the test-link.pdf in page coordinates is (110, 110). | 751 // The link position of the test-link.pdf in page coordinates is (110, 110). |
| 737 // Convert the link position from page coordinates to screen coordinates. | 752 // Convert the link position from page coordinates to screen coordinates. |
| 738 gfx::Point link_position(110, 110); | 753 gfx::Point link_position(110, 110); |
| 739 ConvertPageCoordToScreenCoord(guest_contents, &link_position); | 754 ConvertPageCoordToScreenCoord(guest_contents, &link_position); |
| (...skipping 250 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 |