| 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(), AccessibilityModeComplete, ui::AX_EVENT_NONE)); | 94 shell()->web_contents(), ACCESSIBILITY_MODE_COMPLETE, 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( | 107 waiter.reset(new AccessibilityNotificationWaiter(shell()->web_contents(), |
| 108 shell()->web_contents(), AccessibilityModeComplete, ui::AX_EVENT_HOVER)); | 108 ACCESSIBILITY_MODE_COMPLETE, |
| 109 ui::AX_EVENT_HOVER)); |
| 109 BrowserAccessibilityManager* manager = | 110 BrowserAccessibilityManager* manager = |
| 110 web_contents->GetRootBrowserAccessibilityManager(); | 111 web_contents->GetRootBrowserAccessibilityManager(); |
| 111 manager->HitTest(gfx::Point(0, 0)); | 112 manager->HitTest(gfx::Point(0, 0)); |
| 112 waiter->WaitForNotification(); | 113 waiter->WaitForNotification(); |
| 113 | 114 |
| 114 // Save a copy of the final accessibility tree (as a text dump); we'll | 115 // Save a copy of the final accessibility tree (as a text dump); we'll |
| 115 // log this for the user later if the test fails. | 116 // log this for the user later if the test fails. |
| 116 final_tree_ = DumpUnfilteredAccessibilityTreeAsString(); | 117 final_tree_ = DumpUnfilteredAccessibilityTreeAsString(); |
| 117 | 118 |
| 118 // Dump the event logs, running them through any filters specified | 119 // Dump the event logs, running them through any filters specified |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 } | 328 } |
| 328 | 329 |
| 329 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, | 330 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, |
| 330 AccessibilityEventsTextChanged) { | 331 AccessibilityEventsTextChanged) { |
| 331 RunEventTest(FILE_PATH_LITERAL("text-changed.html")); | 332 RunEventTest(FILE_PATH_LITERAL("text-changed.html")); |
| 332 } | 333 } |
| 333 | 334 |
| 334 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 335 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 335 | 336 |
| 336 } // namespace content | 337 } // namespace content |
| OLD | NEW |