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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void RunEventTest(const base::FilePath::CharType* file_path); | 68 void RunEventTest(const base::FilePath::CharType* file_path); |
69 | 69 |
70 private: | 70 private: |
71 base::string16 initial_tree_; | 71 base::string16 initial_tree_; |
72 base::string16 final_tree_; | 72 base::string16 final_tree_; |
73 }; | 73 }; |
74 | 74 |
75 std::vector<std::string> DumpAccessibilityEventsTest::Dump() { | 75 std::vector<std::string> DumpAccessibilityEventsTest::Dump() { |
76 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 76 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
77 shell()->web_contents()); | 77 shell()->web_contents()); |
78 scoped_ptr<AccessibilityEventRecorder> event_recorder( | 78 std::unique_ptr<AccessibilityEventRecorder> event_recorder( |
79 AccessibilityEventRecorder::Create( | 79 AccessibilityEventRecorder::Create( |
80 web_contents->GetRootBrowserAccessibilityManager())); | 80 web_contents->GetRootBrowserAccessibilityManager())); |
81 | 81 |
82 // Save a copy of the accessibility tree (as a text dump); we'll | 82 // Save a copy of the accessibility tree (as a text dump); we'll |
83 // log this for the user later if the test fails. | 83 // log this for the user later if the test fails. |
84 initial_tree_ = DumpUnfilteredAccessibilityTreeAsString(); | 84 initial_tree_ = DumpUnfilteredAccessibilityTreeAsString(); |
85 | 85 |
86 // Create a waiter that waits for any one accessibility event. | 86 // Create a waiter that waits for any one accessibility event. |
87 // This will ensure that after calling the go() function, we | 87 // This will ensure that after calling the go() function, we |
88 // block until we've received an accessibility event generated as | 88 // block until we've received an accessibility event generated as |
89 // a result of this function. | 89 // a result of this function. |
90 scoped_ptr<AccessibilityNotificationWaiter> waiter; | 90 std::unique_ptr<AccessibilityNotificationWaiter> waiter; |
91 waiter.reset(new AccessibilityNotificationWaiter( | 91 waiter.reset(new AccessibilityNotificationWaiter( |
92 shell(), AccessibilityModeComplete, ui::AX_EVENT_NONE)); | 92 shell(), AccessibilityModeComplete, ui::AX_EVENT_NONE)); |
93 | 93 |
94 | 94 |
95 web_contents->GetMainFrame()->ExecuteJavaScriptForTests( | 95 web_contents->GetMainFrame()->ExecuteJavaScriptForTests( |
96 base::ASCIIToUTF16("go()")); | 96 base::ASCIIToUTF16("go()")); |
97 | 97 |
98 // Wait for at least one accessibility event generated in response to | 98 // Wait for at least one accessibility event generated in response to |
99 // that function. | 99 // that function. |
100 waiter->WaitForNotification(); | 100 waiter->WaitForNotification(); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 | 271 |
272 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, | 272 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, |
273 AccessibilityEventsTextChanged) { | 273 AccessibilityEventsTextChanged) { |
274 RunEventTest(FILE_PATH_LITERAL("text-changed.html")); | 274 RunEventTest(FILE_PATH_LITERAL("text-changed.html")); |
275 } | 275 } |
276 | 276 |
277 #endif // defined(OS_WIN) | 277 #endif // defined(OS_WIN) |
278 | 278 |
279 } // namespace content | 279 } // namespace content |
OLD | NEW |