OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <atlbase.h> | 5 #include <atlbase.h> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "base/win/scoped_comptr.h" | 11 #include "base/win/scoped_comptr.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_tabstrip.h" |
13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
18 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
19 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
20 #include "content/public/browser/render_widget_host_view.h" | 21 #include "content/public/browser/render_widget_host_view.h" |
21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
22 #include "content/public/test/accessibility_test_utils_win.h" | 23 #include "content/public/test/accessibility_test_utils_win.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return; | 204 return; |
204 } | 205 } |
205 } | 206 } |
206 } | 207 } |
207 | 208 |
208 // Retrieve the MSAA client accessibility object for the Render Widget Host View | 209 // Retrieve the MSAA client accessibility object for the Render Widget Host View |
209 // of the selected tab. | 210 // of the selected tab. |
210 IAccessible* | 211 IAccessible* |
211 AccessibilityWinBrowserTest::GetRendererAccessible() { | 212 AccessibilityWinBrowserTest::GetRendererAccessible() { |
212 content::RenderViewHostTester::EnableAccessibilityUpdatedNotifications( | 213 content::RenderViewHostTester::EnableAccessibilityUpdatedNotifications( |
213 browser()->GetActiveWebContents()->GetRenderViewHost()); | 214 chrome::GetActiveWebContents(browser())->GetRenderViewHost()); |
214 | 215 |
215 HWND hwnd_render_widget_host_view = | 216 HWND hwnd_render_widget_host_view = |
216 browser()->GetActiveWebContents()->GetRenderWidgetHostView()-> | 217 chrome::GetActiveWebContents(browser())->GetRenderWidgetHostView()-> |
217 GetNativeView(); | 218 GetNativeView(); |
218 | 219 |
219 // Invoke windows screen reader detection by sending the WM_GETOBJECT message | 220 // Invoke windows screen reader detection by sending the WM_GETOBJECT message |
220 // with kIdCustom as the LPARAM. | 221 // with kIdCustom as the LPARAM. |
221 const int32 kIdCustom = 1; | 222 const int32 kIdCustom = 1; |
222 SendMessage( | 223 SendMessage( |
223 hwnd_render_widget_host_view, WM_GETOBJECT, OBJID_CLIENT, kIdCustom); | 224 hwnd_render_widget_host_view, WM_GETOBJECT, OBJID_CLIENT, kIdCustom); |
224 | 225 |
225 IAccessible* accessible; | 226 IAccessible* accessible; |
226 HRESULT hr = AccessibleObjectFromWindow( | 227 HRESULT hr = AccessibleObjectFromWindow( |
227 hwnd_render_widget_host_view, OBJID_CLIENT, | 228 hwnd_render_widget_host_view, OBJID_CLIENT, |
228 IID_IAccessible, reinterpret_cast<void**>(&accessible)); | 229 IID_IAccessible, reinterpret_cast<void**>(&accessible)); |
229 EXPECT_EQ(S_OK, hr); | 230 EXPECT_EQ(S_OK, hr); |
230 EXPECT_NE(accessible, reinterpret_cast<IAccessible*>(NULL)); | 231 EXPECT_NE(accessible, reinterpret_cast<IAccessible*>(NULL)); |
231 | 232 |
232 return accessible; | 233 return accessible; |
233 } | 234 } |
234 | 235 |
235 void AccessibilityWinBrowserTest::ExecuteScript(wstring script) { | 236 void AccessibilityWinBrowserTest::ExecuteScript(wstring script) { |
236 browser()->GetActiveWebContents()->GetRenderViewHost()-> | 237 chrome::GetActiveWebContents(browser())->GetRenderViewHost()-> |
237 ExecuteJavascriptInWebFrame(L"", script); | 238 ExecuteJavascriptInWebFrame(L"", script); |
238 } | 239 } |
239 | 240 |
240 // This constructor can be used if IA2 role will be the same as MSAA role | 241 // This constructor can be used if IA2 role will be the same as MSAA role |
241 AccessibleChecker::AccessibleChecker( | 242 AccessibleChecker::AccessibleChecker( |
242 wstring expected_name, int32 expected_role, wstring expected_value) : | 243 wstring expected_name, int32 expected_role, wstring expected_value) : |
243 name_(expected_name), | 244 name_(expected_name), |
244 role_(expected_role), | 245 role_(expected_role), |
245 ia2_role_(expected_role), | 246 ia2_role_(expected_role), |
246 value_(expected_value), | 247 value_(expected_value), |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 | 903 |
903 // Check the browser's copy of the renderer accessibility tree. | 904 // Check the browser's copy of the renderer accessibility tree. |
904 AccessibleChecker grouping1_checker(L"", ROLE_SYSTEM_GROUPING, L""); | 905 AccessibleChecker grouping1_checker(L"", ROLE_SYSTEM_GROUPING, L""); |
905 AccessibleChecker grouping2_checker(L"", ROLE_SYSTEM_GROUPING, L""); | 906 AccessibleChecker grouping2_checker(L"", ROLE_SYSTEM_GROUPING, L""); |
906 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 907 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
907 document_checker.AppendExpectedChild(&grouping1_checker); | 908 document_checker.AppendExpectedChild(&grouping1_checker); |
908 document_checker.AppendExpectedChild(&grouping2_checker); | 909 document_checker.AppendExpectedChild(&grouping2_checker); |
909 document_checker.CheckAccessible(GetRendererAccessible()); | 910 document_checker.CheckAccessible(GetRendererAccessible()); |
910 } | 911 } |
911 } // namespace. | 912 } // namespace. |
OLD | NEW |