| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/win/scoped_comptr.h" | 10 #include "base/win/scoped_comptr.h" |
| 11 #include "chrome/browser/automation/ui_controls.h" | 11 #include "chrome/browser/automation/ui_controls.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
| 17 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
| 18 #include "content/browser/renderer_host/render_widget_host_view_win.h" | 18 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 19 #include "content/browser/tab_contents/tab_contents.h" | |
| 20 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 21 #include "content/public/browser/notification_types.h" | 20 #include "content/public/browser/notification_types.h" |
| 21 #include "content/public/browser/web_contents.h" |
| 22 #include "third_party/iaccessible2/ia2_api_all.h" | 22 #include "third_party/iaccessible2/ia2_api_all.h" |
| 23 #include "third_party/isimpledom/ISimpleDOMNode.h" | 23 #include "third_party/isimpledom/ISimpleDOMNode.h" |
| 24 | 24 |
| 25 using content::OpenURLParams; | 25 using content::OpenURLParams; |
| 26 using content::Referrer; | 26 using content::Referrer; |
| 27 using std::auto_ptr; | 27 using std::auto_ptr; |
| 28 using std::vector; | 28 using std::vector; |
| 29 using std::wstring; | 29 using std::wstring; |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return; | 189 return; |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Retrieve the MSAA client accessibility object for the Render Widget Host View | 194 // Retrieve the MSAA client accessibility object for the Render Widget Host View |
| 195 // of the selected tab. | 195 // of the selected tab. |
| 196 IAccessible* | 196 IAccessible* |
| 197 AccessibilityWinBrowserTest::GetRendererAccessible() { | 197 AccessibilityWinBrowserTest::GetRendererAccessible() { |
| 198 HWND hwnd_render_widget_host_view = | 198 HWND hwnd_render_widget_host_view = |
| 199 browser()->GetSelectedTabContents()->GetRenderWidgetHostView()-> | 199 browser()->GetSelectedWebContents()->GetRenderWidgetHostView()-> |
| 200 GetNativeView(); | 200 GetNativeView(); |
| 201 | 201 |
| 202 // Invoke windows screen reader detection by sending the WM_GETOBJECT message | 202 // Invoke windows screen reader detection by sending the WM_GETOBJECT message |
| 203 // with kIdCustom as the LPARAM. | 203 // with kIdCustom as the LPARAM. |
| 204 const int32 kIdCustom = 1; | 204 const int32 kIdCustom = 1; |
| 205 SendMessage( | 205 SendMessage( |
| 206 hwnd_render_widget_host_view, WM_GETOBJECT, OBJID_CLIENT, kIdCustom); | 206 hwnd_render_widget_host_view, WM_GETOBJECT, OBJID_CLIENT, kIdCustom); |
| 207 | 207 |
| 208 IAccessible* accessible; | 208 IAccessible* accessible; |
| 209 HRESULT hr = AccessibleObjectFromWindow( | 209 HRESULT hr = AccessibleObjectFromWindow( |
| 210 hwnd_render_widget_host_view, OBJID_CLIENT, | 210 hwnd_render_widget_host_view, OBJID_CLIENT, |
| 211 IID_IAccessible, reinterpret_cast<void**>(&accessible)); | 211 IID_IAccessible, reinterpret_cast<void**>(&accessible)); |
| 212 EXPECT_EQ(S_OK, hr); | 212 EXPECT_EQ(S_OK, hr); |
| 213 EXPECT_NE(accessible, reinterpret_cast<IAccessible*>(NULL)); | 213 EXPECT_NE(accessible, reinterpret_cast<IAccessible*>(NULL)); |
| 214 | 214 |
| 215 return accessible; | 215 return accessible; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void AccessibilityWinBrowserTest::ExecuteScript(wstring script) { | 218 void AccessibilityWinBrowserTest::ExecuteScript(wstring script) { |
| 219 browser()->GetSelectedTabContents()->GetRenderViewHost()-> | 219 browser()->GetSelectedWebContents()->GetRenderViewHost()-> |
| 220 ExecuteJavascriptInWebFrame(L"", script); | 220 ExecuteJavascriptInWebFrame(L"", script); |
| 221 } | 221 } |
| 222 | 222 |
| 223 AccessibleChecker::AccessibleChecker( | 223 AccessibleChecker::AccessibleChecker( |
| 224 wstring expected_name, int32 expected_role, wstring expected_value) : | 224 wstring expected_name, int32 expected_role, wstring expected_value) : |
| 225 name_(expected_name), | 225 name_(expected_name), |
| 226 role_(expected_role), | 226 role_(expected_role), |
| 227 value_(expected_value), | 227 value_(expected_value), |
| 228 state_(-1) { | 228 state_(-1) { |
| 229 } | 229 } |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 ASSERT_EQ(S_OK, hr); | 740 ASSERT_EQ(S_OK, hr); |
| 741 hr = checkbox_isimpledomnode->get_nodeInfo( | 741 hr = checkbox_isimpledomnode->get_nodeInfo( |
| 742 &node_name, &name_space_id, &node_value, &num_children, &unique_id, | 742 &node_name, &name_space_id, &node_value, &num_children, &unique_id, |
| 743 &node_type); | 743 &node_type); |
| 744 ASSERT_EQ(S_OK, hr); | 744 ASSERT_EQ(S_OK, hr); |
| 745 EXPECT_STREQ(L"input", wstring(node_name, SysStringLen(node_name)).c_str()); | 745 EXPECT_STREQ(L"input", wstring(node_name, SysStringLen(node_name)).c_str()); |
| 746 EXPECT_EQ(NODETYPE_ELEMENT, node_type); | 746 EXPECT_EQ(NODETYPE_ELEMENT, node_type); |
| 747 EXPECT_EQ(0, num_children); | 747 EXPECT_EQ(0, num_children); |
| 748 } | 748 } |
| 749 } // namespace. | 749 } // namespace. |
| OLD | NEW |