| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "content/browser/accessibility/browser_accessibility.h" | 6 #include "content/browser/accessibility/browser_accessibility.h" |
| 7 #include "content/browser/accessibility/browser_accessibility_manager.h" | 7 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
| 10 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 NavigateToURL(shell(), url); | 98 NavigateToURL(shell(), url); |
| 99 waiter.WaitForNotification(); | 99 waiter.WaitForNotification(); |
| 100 | 100 |
| 101 BrowserAccessibility* hit_node = HitTestAndWaitForResult(gfx::Point(-1, -1)); | 101 BrowserAccessibility* hit_node = HitTestAndWaitForResult(gfx::Point(-1, -1)); |
| 102 ASSERT_TRUE(hit_node != NULL); | 102 ASSERT_TRUE(hit_node != NULL); |
| 103 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, hit_node->GetRole()); | 103 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, hit_node->GetRole()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 IN_PROC_BROWSER_TEST_F(AccessibilityHitTestingBrowserTest, | 106 IN_PROC_BROWSER_TEST_F(AccessibilityHitTestingBrowserTest, |
| 107 HitTestingInIframes) { | 107 HitTestingInIframes) { |
| 108 host_resolver()->AddRule("*", "127.0.0.1"); | |
| 109 ASSERT_TRUE(embedded_test_server()->Start()); | 108 ASSERT_TRUE(embedded_test_server()->Start()); |
| 110 | 109 |
| 111 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); | 110 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
| 112 | 111 |
| 113 AccessibilityNotificationWaiter waiter(shell()->web_contents(), | 112 AccessibilityNotificationWaiter waiter(shell()->web_contents(), |
| 114 kAccessibilityModeComplete, | 113 kAccessibilityModeComplete, |
| 115 ui::AX_EVENT_LOAD_COMPLETE); | 114 ui::AX_EVENT_LOAD_COMPLETE); |
| 116 GURL url(embedded_test_server()->GetURL( | 115 GURL url(embedded_test_server()->GetURL( |
| 117 "/accessibility/html/iframe-coordinates.html")); | 116 "/accessibility/html/iframe-coordinates.html")); |
| 118 NavigateToURL(shell(), url); | 117 NavigateToURL(shell(), url); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // (50, 505) -> div in second iframe | 158 // (50, 505) -> div in second iframe |
| 160 // but with a different event | 159 // but with a different event |
| 161 hit_node = | 160 hit_node = |
| 162 HitTestAndWaitForResultWithEvent(gfx::Point(50, 505), ui::AX_EVENT_ALERT); | 161 HitTestAndWaitForResultWithEvent(gfx::Point(50, 505), ui::AX_EVENT_ALERT); |
| 163 ASSERT_NE(hit_node, nullptr); | 162 ASSERT_NE(hit_node, nullptr); |
| 164 ASSERT_EQ(ui::AX_ROLE_DIV, hit_node->GetRole()); | 163 ASSERT_EQ(ui::AX_ROLE_DIV, hit_node->GetRole()); |
| 165 } | 164 } |
| 166 | 165 |
| 167 IN_PROC_BROWSER_TEST_F(AccessibilityHitTestingBrowserTest, | 166 IN_PROC_BROWSER_TEST_F(AccessibilityHitTestingBrowserTest, |
| 168 CachingAsyncHitTestingInIframes) { | 167 CachingAsyncHitTestingInIframes) { |
| 169 host_resolver()->AddRule("*", "127.0.0.1"); | |
| 170 ASSERT_TRUE(embedded_test_server()->Start()); | 168 ASSERT_TRUE(embedded_test_server()->Start()); |
| 171 | 169 |
| 172 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); | 170 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
| 173 | 171 |
| 174 AccessibilityNotificationWaiter waiter(shell()->web_contents(), | 172 AccessibilityNotificationWaiter waiter(shell()->web_contents(), |
| 175 kAccessibilityModeComplete, | 173 kAccessibilityModeComplete, |
| 176 ui::AX_EVENT_LOAD_COMPLETE); | 174 ui::AX_EVENT_LOAD_COMPLETE); |
| 177 GURL url(embedded_test_server()->GetURL( | 175 GURL url(embedded_test_server()->GetURL( |
| 178 "/accessibility/hit_testing/hit_testing.html")); | 176 "/accessibility/hit_testing/hit_testing.html")); |
| 179 NavigateToURL(shell(), url); | 177 NavigateToURL(shell(), url); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 222 |
| 225 // (50, 505) -> div in second iframe | 223 // (50, 505) -> div in second iframe |
| 226 hit_node = CallCachingAsyncHitTest(gfx::Point(50, 505)); | 224 hit_node = CallCachingAsyncHitTest(gfx::Point(50, 505)); |
| 227 ASSERT_TRUE(hit_node != NULL); | 225 ASSERT_TRUE(hit_node != NULL); |
| 228 ASSERT_NE(ui::AX_ROLE_DIV, hit_node->GetRole()); | 226 ASSERT_NE(ui::AX_ROLE_DIV, hit_node->GetRole()); |
| 229 hit_node = CallCachingAsyncHitTest(gfx::Point(50, 505)); | 227 hit_node = CallCachingAsyncHitTest(gfx::Point(50, 505)); |
| 230 ASSERT_EQ(ui::AX_ROLE_DIV, hit_node->GetRole()); | 228 ASSERT_EQ(ui::AX_ROLE_DIV, hit_node->GetRole()); |
| 231 } | 229 } |
| 232 | 230 |
| 233 } // namespace content | 231 } // namespace content |
| OLD | NEW |