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

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

Issue 2694413006: Scope and clean up uses of AccessibilityMode. (Closed)
Patch Set: address comments Created 3 years, 9 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
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(shell()->web_contents(),
94 shell()->web_contents(), ACCESSIBILITY_MODE_COMPLETE, ui::AX_EVENT_NONE)); 94 AccessibilityMode::kComplete,
95 ui::AX_EVENT_NONE));
95 96
96 web_contents->GetMainFrame()->ExecuteJavaScriptForTests( 97 web_contents->GetMainFrame()->ExecuteJavaScriptForTests(
97 base::ASCIIToUTF16("go()")); 98 base::ASCIIToUTF16("go()"));
98 99
99 // Wait for at least one accessibility event generated in response to 100 // Wait for at least one accessibility event generated in response to
100 // that function. 101 // that function.
101 waiter->WaitForNotification(); 102 waiter->WaitForNotification();
102 103
103 // More than one accessibility event could have been generated. 104 // More than one accessibility event could have been generated.
104 // To make sure we've received all accessibility events, add a 105 // To make sure we've received all accessibility events, add a
105 // sentinel by calling AccessibilityHitTest and waiting for a HOVER 106 // sentinel by calling AccessibilityHitTest and waiting for a HOVER
106 // event in response. 107 // event in response.
107 waiter.reset(new AccessibilityNotificationWaiter(shell()->web_contents(), 108 waiter.reset(new AccessibilityNotificationWaiter(shell()->web_contents(),
108 ACCESSIBILITY_MODE_COMPLETE, 109 AccessibilityMode::kComplete,
109 ui::AX_EVENT_HOVER)); 110 ui::AX_EVENT_HOVER));
110 BrowserAccessibilityManager* manager = 111 BrowserAccessibilityManager* manager =
111 web_contents->GetRootBrowserAccessibilityManager(); 112 web_contents->GetRootBrowserAccessibilityManager();
112 manager->HitTest(gfx::Point(0, 0)); 113 manager->HitTest(gfx::Point(0, 0));
113 waiter->WaitForNotification(); 114 waiter->WaitForNotification();
114 115
115 // Save a copy of the final accessibility tree (as a text dump); we'll 116 // 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. 117 // log this for the user later if the test fails.
117 final_tree_ = DumpUnfilteredAccessibilityTreeAsString(); 118 final_tree_ = DumpUnfilteredAccessibilityTreeAsString();
118 119
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 329 }
329 330
330 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, 331 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest,
331 AccessibilityEventsTextChanged) { 332 AccessibilityEventsTextChanged) {
332 RunEventTest(FILE_PATH_LITERAL("text-changed.html")); 333 RunEventTest(FILE_PATH_LITERAL("text-changed.html"));
333 } 334 }
334 335
335 #endif // defined(OS_WIN) || defined(OS_MACOSX) 336 #endif // defined(OS_WIN) || defined(OS_MACOSX)
336 337
337 } // namespace content 338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698