OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Save a copy of the accessibility tree (as a text dump); we'll | 84 // Save a copy of the accessibility tree (as a text dump); we'll |
85 // log this for the user later if the test fails. | 85 // log this for the user later if the test fails. |
86 initial_tree_ = DumpUnfilteredAccessibilityTreeAsString(); | 86 initial_tree_ = DumpUnfilteredAccessibilityTreeAsString(); |
87 | 87 |
88 // Create a waiter that waits for any one accessibility event. | 88 // Create a waiter that waits for any one accessibility event. |
89 // This will ensure that after calling the go() function, we | 89 // This will ensure that after calling the go() function, we |
90 // block until we've received an accessibility event generated as | 90 // block until we've received an accessibility event generated as |
91 // a result of this function. | 91 // a result of this function. |
92 std::unique_ptr<AccessibilityNotificationWaiter> waiter; | 92 std::unique_ptr<AccessibilityNotificationWaiter> waiter; |
93 waiter.reset(new AccessibilityNotificationWaiter( | 93 waiter.reset(new AccessibilityNotificationWaiter( |
94 shell()->web_contents(), ACCESSIBILITY_MODE_COMPLETE, ui::AX_EVENT_NONE)); | 94 shell()->web_contents(), kAccessibilityModeComplete, ui::AX_EVENT_NONE)); |
95 | 95 |
96 web_contents->GetMainFrame()->ExecuteJavaScriptForTests( | 96 web_contents->GetMainFrame()->ExecuteJavaScriptForTests( |
97 base::ASCIIToUTF16("go()")); | 97 base::ASCIIToUTF16("go()")); |
98 | 98 |
99 // Wait for at least one accessibility event generated in response to | 99 // Wait for at least one accessibility event generated in response to |
100 // that function. | 100 // that function. |
101 waiter->WaitForNotification(); | 101 waiter->WaitForNotification(); |
102 | 102 |
103 // More than one accessibility event could have been generated. | 103 // More than one accessibility event could have been generated. |
104 // To make sure we've received all accessibility events, add a | 104 // To make sure we've received all accessibility events, add a |
105 // sentinel by calling AccessibilityHitTest and waiting for a HOVER | 105 // sentinel by calling AccessibilityHitTest and waiting for a HOVER |
106 // event in response. | 106 // event in response. |
107 waiter.reset(new AccessibilityNotificationWaiter(shell()->web_contents(), | 107 waiter.reset(new AccessibilityNotificationWaiter( |
108 ACCESSIBILITY_MODE_COMPLETE, | 108 shell()->web_contents(), kAccessibilityModeComplete, ui::AX_EVENT_HOVER)); |
109 ui::AX_EVENT_HOVER)); | |
110 BrowserAccessibilityManager* manager = | 109 BrowserAccessibilityManager* manager = |
111 web_contents->GetRootBrowserAccessibilityManager(); | 110 web_contents->GetRootBrowserAccessibilityManager(); |
112 manager->HitTest(gfx::Point(0, 0)); | 111 manager->HitTest(gfx::Point(0, 0)); |
113 waiter->WaitForNotification(); | 112 waiter->WaitForNotification(); |
114 | 113 |
115 // Save a copy of the final accessibility tree (as a text dump); we'll | 114 // Save a copy of the final accessibility tree (as a text dump); we'll |
116 // log this for the user later if the test fails. | 115 // log this for the user later if the test fails. |
117 final_tree_ = DumpUnfilteredAccessibilityTreeAsString(); | 116 final_tree_ = DumpUnfilteredAccessibilityTreeAsString(); |
118 | 117 |
119 // Dump the event logs, running them through any filters specified | 118 // Dump the event logs, running them through any filters specified |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 327 } |
329 | 328 |
330 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, | 329 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, |
331 AccessibilityEventsTextChanged) { | 330 AccessibilityEventsTextChanged) { |
332 RunEventTest(FILE_PATH_LITERAL("text-changed.html")); | 331 RunEventTest(FILE_PATH_LITERAL("text-changed.html")); |
333 } | 332 } |
334 | 333 |
335 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 334 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
336 | 335 |
337 } // namespace content | 336 } // namespace content |
OLD | NEW |