Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: content/browser/accessibility/dump_accessibility_events_browsertest.cc

Issue 2426193003: Re-land: Create AXAction and AXActionData as a way to simplify accessibility actions (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(), AccessibilityModeComplete, ui::AX_EVENT_NONE));
95 95
96
97 web_contents->GetMainFrame()->ExecuteJavaScriptForTests( 96 web_contents->GetMainFrame()->ExecuteJavaScriptForTests(
98 base::ASCIIToUTF16("go()")); 97 base::ASCIIToUTF16("go()"));
99 98
100 // Wait for at least one accessibility event generated in response to 99 // Wait for at least one accessibility event generated in response to
101 // that function. 100 // that function.
102 waiter->WaitForNotification(); 101 waiter->WaitForNotification();
103 102
104 // More than one accessibility event could have been generated. 103 // More than one accessibility event could have been generated.
105 // To make sure we've received all accessibility events, add a 104 // To make sure we've received all accessibility events, add a
106 // sentinel by calling AccessibilityHitTest and waiting for a HOVER 105 // sentinel by calling AccessibilityHitTest and waiting for a HOVER
107 // event in response. 106 // event in response.
108 waiter.reset(new AccessibilityNotificationWaiter( 107 waiter.reset(new AccessibilityNotificationWaiter(
109 shell()->web_contents(), AccessibilityModeComplete, ui::AX_EVENT_HOVER)); 108 shell()->web_contents(), AccessibilityModeComplete, ui::AX_EVENT_HOVER));
110 BrowserAccessibilityManager* manager = 109 BrowserAccessibilityManager* manager =
111 web_contents->GetRootBrowserAccessibilityManager(); 110 web_contents->GetRootBrowserAccessibilityManager();
112 manager->delegate()->AccessibilityHitTest(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
120 // in the HTML file. 119 // in the HTML file.
121 std::vector<std::string> event_logs = event_recorder->event_logs(); 120 std::vector<std::string> event_logs = event_recorder->event_logs();
122 std::vector<std::string> result; 121 std::vector<std::string> result;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698