| 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/win/scoped_comptr.h" | 9 #include "base/win/scoped_comptr.h" |
| 10 #include "chrome/browser/automation/ui_controls.h" | 10 #include "chrome/browser/automation/ui_controls.h" |
| 11 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 11 #include "chrome/browser/renderer_host/render_widget_host_view_win.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/test/in_process_browser_test.h" | 15 #include "chrome/test/in_process_browser_test.h" |
| 15 #include "chrome/test/ui_test_utils.h" | 16 #include "chrome/test/ui_test_utils.h" |
| 16 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
| 18 #include "content/common/notification_type.h" | 19 #include "content/common/notification_type.h" |
| 19 #include "ia2_api_all.h" // Generated NOLINT | 20 #include "ia2_api_all.h" // Generated NOLINT |
| 20 #include "ISimpleDOMNode.h" // Generated NOLINT | 21 #include "ISimpleDOMNode.h" // Generated NOLINT |
| 21 | 22 |
| 22 using std::auto_ptr; | 23 using std::auto_ptr; |
| 23 using std::vector; | 24 using std::vector; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // Check that document accessible has a parent accessible. | 364 // Check that document accessible has a parent accessible. |
| 364 base::win::ScopedComPtr<IAccessible> document_accessible( | 365 base::win::ScopedComPtr<IAccessible> document_accessible( |
| 365 GetRendererAccessible()); | 366 GetRendererAccessible()); |
| 366 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 367 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); |
| 367 base::win::ScopedComPtr<IDispatch> parent_dispatch; | 368 base::win::ScopedComPtr<IDispatch> parent_dispatch; |
| 368 HRESULT hr = document_accessible->get_accParent(parent_dispatch.Receive()); | 369 HRESULT hr = document_accessible->get_accParent(parent_dispatch.Receive()); |
| 369 EXPECT_EQ(S_OK, hr); | 370 EXPECT_EQ(S_OK, hr); |
| 370 EXPECT_NE(parent_dispatch, reinterpret_cast<IDispatch*>(NULL)); | 371 EXPECT_NE(parent_dispatch, reinterpret_cast<IDispatch*>(NULL)); |
| 371 | 372 |
| 372 // Navigate to another page. | 373 // Navigate to another page. |
| 373 GURL about_url("about:"); | 374 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIVersionURL)); |
| 374 ui_test_utils::NavigateToURL(browser(), about_url); | |
| 375 | 375 |
| 376 // Verify that the IAccessible reference still points to a valid object and | 376 // Verify that the IAccessible reference still points to a valid object and |
| 377 // that calls to its methods fail since the tree is no longer valid after | 377 // that calls to its methods fail since the tree is no longer valid after |
| 378 // the page navagation. | 378 // the page navagation. |
| 379 CComBSTR name; | 379 CComBSTR name; |
| 380 hr = document_accessible->get_accName(CreateI4Variant(CHILDID_SELF), &name); | 380 hr = document_accessible->get_accName(CreateI4Variant(CHILDID_SELF), &name); |
| 381 ASSERT_EQ(E_FAIL, hr); | 381 ASSERT_EQ(E_FAIL, hr); |
| 382 } | 382 } |
| 383 | 383 |
| 384 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 384 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 ASSERT_EQ(S_OK, hr); | 711 ASSERT_EQ(S_OK, hr); |
| 712 hr = checkbox_isimpledomnode->get_nodeInfo( | 712 hr = checkbox_isimpledomnode->get_nodeInfo( |
| 713 &node_name, &name_space_id, &node_value, &num_children, &unique_id, | 713 &node_name, &name_space_id, &node_value, &num_children, &unique_id, |
| 714 &node_type); | 714 &node_type); |
| 715 ASSERT_EQ(S_OK, hr); | 715 ASSERT_EQ(S_OK, hr); |
| 716 EXPECT_STREQ(L"input", wstring(node_name, SysStringLen(node_name)).c_str()); | 716 EXPECT_STREQ(L"input", wstring(node_name, SysStringLen(node_name)).c_str()); |
| 717 EXPECT_EQ(NODETYPE_ELEMENT, node_type); | 717 EXPECT_EQ(NODETYPE_ELEMENT, node_type); |
| 718 EXPECT_EQ(0, num_children); | 718 EXPECT_EQ(0, num_children); |
| 719 } | 719 } |
| 720 } // namespace. | 720 } // namespace. |
| OLD | NEW |