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/scoped_comptr_win.h" | 8 #include "base/win/scoped_comptr.h" |
9 #include "chrome/browser/automation/ui_controls.h" | 9 #include "chrome/browser/automation/ui_controls.h" |
10 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 10 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
13 #include "chrome/test/in_process_browser_test.h" | 13 #include "chrome/test/in_process_browser_test.h" |
14 #include "chrome/test/ui_test_utils.h" | 14 #include "chrome/test/ui_test_utils.h" |
15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
16 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
17 #include "content/common/notification_type.h" | 17 #include "content/common/notification_type.h" |
18 #include "ia2_api_all.h" // Generated NOLINT | 18 #include "ia2_api_all.h" // Generated NOLINT |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 break; | 118 break; |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 return NULL; | 122 return NULL; |
123 } | 123 } |
124 | 124 |
125 HRESULT QueryIAccessible2(IAccessible* accessible, IAccessible2** accessible2) { | 125 HRESULT QueryIAccessible2(IAccessible* accessible, IAccessible2** accessible2) { |
126 // TODO(ctguil): For some reason querying the IAccessible2 interface from | 126 // TODO(ctguil): For some reason querying the IAccessible2 interface from |
127 // IAccessible fails. | 127 // IAccessible fails. |
128 ScopedComPtr<IServiceProvider> service_provider; | 128 base::win::ScopedComPtr<IServiceProvider> service_provider; |
129 HRESULT hr = accessible->QueryInterface(service_provider.Receive()); | 129 HRESULT hr = accessible->QueryInterface(service_provider.Receive()); |
130 if (FAILED(hr)) | 130 if (FAILED(hr)) |
131 return hr; | 131 return hr; |
132 | 132 |
133 hr = service_provider->QueryService(IID_IAccessible2, accessible2); | 133 hr = service_provider->QueryService(IID_IAccessible2, accessible2); |
134 return hr; | 134 return hr; |
135 } | 135 } |
136 | 136 |
137 // Sets result to true if the child is located in the parent's tree. An | 137 // Sets result to true if the child is located in the parent's tree. An |
138 // exhustive search is perform here because we determine equality using | 138 // exhustive search is perform here because we determine equality using |
139 // IAccessible2::get_unique_id which is only supported by the child node. | 139 // IAccessible2::get_unique_id which is only supported by the child node. |
140 void AccessibleContainsAccessible( | 140 void AccessibleContainsAccessible( |
141 IAccessible* parent, IAccessible2* child, bool* result) { | 141 IAccessible* parent, IAccessible2* child, bool* result) { |
142 vector<ScopedComPtr<IAccessible>> accessible_list; | 142 vector<base::win::ScopedComPtr<IAccessible>> accessible_list; |
143 accessible_list.push_back(ScopedComPtr<IAccessible>(parent)); | 143 accessible_list.push_back(base::win::ScopedComPtr<IAccessible>(parent)); |
144 | 144 |
145 LONG unique_id; | 145 LONG unique_id; |
146 HRESULT hr = child->get_uniqueID(&unique_id); | 146 HRESULT hr = child->get_uniqueID(&unique_id); |
147 ASSERT_EQ(S_OK, hr); | 147 ASSERT_EQ(S_OK, hr); |
148 *result = false; | 148 *result = false; |
149 | 149 |
150 while (accessible_list.size()) { | 150 while (accessible_list.size()) { |
151 ScopedComPtr<IAccessible> accessible = accessible_list.back(); | 151 base::win::ScopedComPtr<IAccessible> accessible = accessible_list.back(); |
152 accessible_list.pop_back(); | 152 accessible_list.pop_back(); |
153 | 153 |
154 ScopedComPtr<IAccessible2> accessible2; | 154 base::win::ScopedComPtr<IAccessible2> accessible2; |
155 hr = QueryIAccessible2(accessible, accessible2.Receive()); | 155 hr = QueryIAccessible2(accessible, accessible2.Receive()); |
156 if (SUCCEEDED(hr)) { | 156 if (SUCCEEDED(hr)) { |
157 LONG child_id; | 157 LONG child_id; |
158 accessible2->get_uniqueID(&child_id); | 158 accessible2->get_uniqueID(&child_id); |
159 if (child_id == unique_id) { | 159 if (child_id == unique_id) { |
160 *result = true; | 160 *result = true; |
161 break; | 161 break; |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 LONG child_count; | 165 LONG child_count; |
166 hr = accessible->get_accChildCount(&child_count); | 166 hr = accessible->get_accChildCount(&child_count); |
167 ASSERT_EQ(S_OK, hr); | 167 ASSERT_EQ(S_OK, hr); |
168 if (child_count == 0) | 168 if (child_count == 0) |
169 continue; | 169 continue; |
170 | 170 |
171 auto_ptr<VARIANT> child_array(new VARIANT[child_count]); | 171 auto_ptr<VARIANT> child_array(new VARIANT[child_count]); |
172 LONG obtained_count = 0; | 172 LONG obtained_count = 0; |
173 hr = AccessibleChildren( | 173 hr = AccessibleChildren( |
174 accessible, 0, child_count, child_array.get(), &obtained_count); | 174 accessible, 0, child_count, child_array.get(), &obtained_count); |
175 ASSERT_EQ(S_OK, hr); | 175 ASSERT_EQ(S_OK, hr); |
176 ASSERT_EQ(child_count, obtained_count); | 176 ASSERT_EQ(child_count, obtained_count); |
177 | 177 |
178 for (int index = 0; index < obtained_count; index++) { | 178 for (int index = 0; index < obtained_count; index++) { |
179 ScopedComPtr<IAccessible> child_accessible( | 179 base::win::ScopedComPtr<IAccessible> child_accessible( |
180 GetAccessibleFromResultVariant(accessible, &child_array.get()[index])); | 180 GetAccessibleFromResultVariant(accessible, &child_array.get()[index])); |
181 if (child_accessible.get()) | 181 if (child_accessible.get()) { |
182 accessible_list.push_back(ScopedComPtr<IAccessible>(child_accessible)); | 182 accessible_list.push_back( |
| 183 base::win::ScopedComPtr<IAccessible>(child_accessible)); |
| 184 } |
183 } | 185 } |
184 } | 186 } |
185 } | 187 } |
186 | 188 |
187 // Retrieve the MSAA client accessibility object for the Render Widget Host View | 189 // Retrieve the MSAA client accessibility object for the Render Widget Host View |
188 // of the selected tab. | 190 // of the selected tab. |
189 IAccessible* | 191 IAccessible* |
190 AccessibilityWinBrowserTest::GetRendererAccessible() { | 192 AccessibilityWinBrowserTest::GetRendererAccessible() { |
191 HWND hwnd_render_widget_host_view = | 193 HWND hwnd_render_widget_host_view = |
192 browser()->GetSelectedTabContents()->GetRenderWidgetHostView()-> | 194 browser()->GetSelectedTabContents()->GetRenderWidgetHostView()-> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 LONG obtained_count = 0; | 309 LONG obtained_count = 0; |
308 hr = AccessibleChildren(parent, 0, child_count, | 310 hr = AccessibleChildren(parent, 0, child_count, |
309 child_array.get(), &obtained_count); | 311 child_array.get(), &obtained_count); |
310 ASSERT_EQ(S_OK, hr); | 312 ASSERT_EQ(S_OK, hr); |
311 ASSERT_EQ(child_count, obtained_count); | 313 ASSERT_EQ(child_count, obtained_count); |
312 | 314 |
313 VARIANT* child = child_array.get(); | 315 VARIANT* child = child_array.get(); |
314 for (AccessibleCheckerVector::iterator child_checker = children_.begin(); | 316 for (AccessibleCheckerVector::iterator child_checker = children_.begin(); |
315 child_checker != children_.end(); | 317 child_checker != children_.end(); |
316 ++child_checker, ++child) { | 318 ++child_checker, ++child) { |
317 ScopedComPtr<IAccessible> child_accessible; | 319 base::win::ScopedComPtr<IAccessible> child_accessible; |
318 child_accessible.Attach(GetAccessibleFromResultVariant(parent, child)); | 320 child_accessible.Attach(GetAccessibleFromResultVariant(parent, child)); |
319 ASSERT_TRUE(child_accessible.get()); | 321 ASSERT_TRUE(child_accessible.get()); |
320 (*child_checker)->CheckAccessible(child_accessible); | 322 (*child_checker)->CheckAccessible(child_accessible); |
321 } | 323 } |
322 } | 324 } |
323 | 325 |
324 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 326 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
325 TestRendererAccessibilityTree) { | 327 TestRendererAccessibilityTree) { |
326 // The initial accessible returned should have state STATE_SYSTEM_BUSY while | 328 // The initial accessible returned should have state STATE_SYSTEM_BUSY while |
327 // the accessibility tree is being requested from the renderer. | 329 // the accessibility tree is being requested from the renderer. |
(...skipping 23 matching lines...) Expand all Loading... |
351 AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); | 353 AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); |
352 AccessibleChecker body_checker(L"", L"body", L""); | 354 AccessibleChecker body_checker(L"", L"body", L""); |
353 AccessibleChecker document2_checker( | 355 AccessibleChecker document2_checker( |
354 L"Accessibility Win Test", ROLE_SYSTEM_DOCUMENT, L""); | 356 L"Accessibility Win Test", ROLE_SYSTEM_DOCUMENT, L""); |
355 body_checker.AppendExpectedChild(&button_checker); | 357 body_checker.AppendExpectedChild(&button_checker); |
356 body_checker.AppendExpectedChild(&checkbox_checker); | 358 body_checker.AppendExpectedChild(&checkbox_checker); |
357 document2_checker.AppendExpectedChild(&body_checker); | 359 document2_checker.AppendExpectedChild(&body_checker); |
358 document2_checker.CheckAccessible(GetRendererAccessible()); | 360 document2_checker.CheckAccessible(GetRendererAccessible()); |
359 | 361 |
360 // Check that document accessible has a parent accessible. | 362 // Check that document accessible has a parent accessible. |
361 ScopedComPtr<IAccessible> document_accessible(GetRendererAccessible()); | 363 base::win::ScopedComPtr<IAccessible> document_accessible( |
| 364 GetRendererAccessible()); |
362 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 365 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); |
363 ScopedComPtr<IDispatch> parent_dispatch; | 366 base::win::ScopedComPtr<IDispatch> parent_dispatch; |
364 HRESULT hr = document_accessible->get_accParent(parent_dispatch.Receive()); | 367 HRESULT hr = document_accessible->get_accParent(parent_dispatch.Receive()); |
365 EXPECT_EQ(S_OK, hr); | 368 EXPECT_EQ(S_OK, hr); |
366 EXPECT_NE(parent_dispatch, reinterpret_cast<IDispatch*>(NULL)); | 369 EXPECT_NE(parent_dispatch, reinterpret_cast<IDispatch*>(NULL)); |
367 | 370 |
368 // Navigate to another page. | 371 // Navigate to another page. |
369 GURL about_url("about:"); | 372 GURL about_url("about:"); |
370 ui_test_utils::NavigateToURL(browser(), about_url); | 373 ui_test_utils::NavigateToURL(browser(), about_url); |
371 | 374 |
372 // Verify that the IAccessible reference still points to a valid object and | 375 // Verify that the IAccessible reference still points to a valid object and |
373 // that calls to its methods fail since the tree is no longer valid after | 376 // that calls to its methods fail since the tree is no longer valid after |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 ExecuteScript(L"document.body.children[0].focus()"); | 535 ExecuteScript(L"document.body.children[0].focus()"); |
533 ui_test_utils::WaitForNotification( | 536 ui_test_utils::WaitForNotification( |
534 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); | 537 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); |
535 | 538 |
536 // Check that the accessibility tree of the browser has been updated. | 539 // Check that the accessibility tree of the browser has been updated. |
537 div_checker.SetExpectedState( | 540 div_checker.SetExpectedState( |
538 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSED); | 541 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSED); |
539 document_checker.CheckAccessible(GetRendererAccessible()); | 542 document_checker.CheckAccessible(GetRendererAccessible()); |
540 | 543 |
541 // Focus the document accessible. This will un-focus the current node. | 544 // Focus the document accessible. This will un-focus the current node. |
542 ScopedComPtr<IAccessible> document_accessible(GetRendererAccessible()); | 545 base::win::ScopedComPtr<IAccessible> document_accessible( |
| 546 GetRendererAccessible()); |
543 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 547 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); |
544 HRESULT hr = document_accessible->accSelect( | 548 HRESULT hr = document_accessible->accSelect( |
545 SELFLAG_TAKEFOCUS, CreateI4Variant(CHILDID_SELF)); | 549 SELFLAG_TAKEFOCUS, CreateI4Variant(CHILDID_SELF)); |
546 ASSERT_EQ(S_OK, hr); | 550 ASSERT_EQ(S_OK, hr); |
547 ui_test_utils::WaitForNotification( | 551 ui_test_utils::WaitForNotification( |
548 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); | 552 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); |
549 | 553 |
550 // Check that the accessibility tree of the browser has been updated. | 554 // Check that the accessibility tree of the browser has been updated. |
551 div_checker.SetExpectedState( | 555 div_checker.SetExpectedState( |
552 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY); | 556 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 596 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
593 DISABLED_ContainsRendererAccessibilityTree) { | 597 DISABLED_ContainsRendererAccessibilityTree) { |
594 GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); | 598 GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); |
595 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); | 599 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); |
596 GetRendererAccessible(); | 600 GetRendererAccessible(); |
597 ui_test_utils::WaitForNotification( | 601 ui_test_utils::WaitForNotification( |
598 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); | 602 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); |
599 | 603 |
600 // Get the accessibility object for the browser window. | 604 // Get the accessibility object for the browser window. |
601 HWND browser_hwnd = browser()->window()->GetNativeHandle(); | 605 HWND browser_hwnd = browser()->window()->GetNativeHandle(); |
602 ScopedComPtr<IAccessible> browser_accessible; | 606 base::win::ScopedComPtr<IAccessible> browser_accessible; |
603 HRESULT hr = AccessibleObjectFromWindow( | 607 HRESULT hr = AccessibleObjectFromWindow( |
604 browser_hwnd, | 608 browser_hwnd, |
605 OBJID_WINDOW, | 609 OBJID_WINDOW, |
606 IID_IAccessible, | 610 IID_IAccessible, |
607 reinterpret_cast<void**>(browser_accessible.Receive())); | 611 reinterpret_cast<void**>(browser_accessible.Receive())); |
608 ASSERT_EQ(S_OK, hr); | 612 ASSERT_EQ(S_OK, hr); |
609 | 613 |
610 // Get the accessibility object for the renderer client document. | 614 // Get the accessibility object for the renderer client document. |
611 ScopedComPtr<IAccessible> document_accessible(GetRendererAccessible()); | 615 base::win::ScopedComPtr<IAccessible> document_accessible( |
| 616 GetRendererAccessible()); |
612 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 617 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); |
613 ScopedComPtr<IAccessible2> document_accessible2; | 618 base::win::ScopedComPtr<IAccessible2> document_accessible2; |
614 hr = QueryIAccessible2(document_accessible, document_accessible2.Receive()); | 619 hr = QueryIAccessible2(document_accessible, document_accessible2.Receive()); |
615 ASSERT_EQ(S_OK, hr); | 620 ASSERT_EQ(S_OK, hr); |
616 | 621 |
617 // TODO(ctguil): Pointer comparison of retrieved IAccessible pointers dosen't | 622 // TODO(ctguil): Pointer comparison of retrieved IAccessible pointers dosen't |
618 // seem to work for here. Perhaps make IAccessible2 available in views to make | 623 // seem to work for here. Perhaps make IAccessible2 available in views to make |
619 // unique id comparison available. | 624 // unique id comparison available. |
620 bool found = false; | 625 bool found = false; |
621 ScopedComPtr<IAccessible> parent = document_accessible; | 626 base::win::ScopedComPtr<IAccessible> parent = document_accessible; |
622 while (parent.get()) { | 627 while (parent.get()) { |
623 ScopedComPtr<IDispatch> parent_dispatch; | 628 base::win::ScopedComPtr<IDispatch> parent_dispatch; |
624 hr = parent->get_accParent(parent_dispatch.Receive()); | 629 hr = parent->get_accParent(parent_dispatch.Receive()); |
625 ASSERT_TRUE(SUCCEEDED(hr)); | 630 ASSERT_TRUE(SUCCEEDED(hr)); |
626 if (!parent_dispatch.get()) { | 631 if (!parent_dispatch.get()) { |
627 ASSERT_EQ(hr, S_FALSE); | 632 ASSERT_EQ(hr, S_FALSE); |
628 break; | 633 break; |
629 } | 634 } |
630 | 635 |
631 parent.Release(); | 636 parent.Release(); |
632 hr = parent_dispatch.QueryInterface(parent.Receive()); | 637 hr = parent_dispatch.QueryInterface(parent.Receive()); |
633 ASSERT_EQ(S_OK, hr); | 638 ASSERT_EQ(S_OK, hr); |
(...skipping 16 matching lines...) Expand all Loading... |
650 | 655 |
651 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 656 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
652 SupportsISimpleDOM) { | 657 SupportsISimpleDOM) { |
653 GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); | 658 GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); |
654 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); | 659 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); |
655 GetRendererAccessible(); | 660 GetRendererAccessible(); |
656 ui_test_utils::WaitForNotification( | 661 ui_test_utils::WaitForNotification( |
657 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); | 662 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); |
658 | 663 |
659 // Get the IAccessible object for the document. | 664 // Get the IAccessible object for the document. |
660 ScopedComPtr<IAccessible> document_accessible(GetRendererAccessible()); | 665 base::win::ScopedComPtr<IAccessible> document_accessible( |
| 666 GetRendererAccessible()); |
661 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 667 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); |
662 | 668 |
663 // Get the ISimpleDOM object for the document. | 669 // Get the ISimpleDOM object for the document. |
664 ScopedComPtr<IServiceProvider> service_provider; | 670 base::win::ScopedComPtr<IServiceProvider> service_provider; |
665 HRESULT hr = static_cast<IAccessible*>(document_accessible)->QueryInterface( | 671 HRESULT hr = static_cast<IAccessible*>(document_accessible)->QueryInterface( |
666 service_provider.Receive()); | 672 service_provider.Receive()); |
667 ASSERT_EQ(S_OK, hr); | 673 ASSERT_EQ(S_OK, hr); |
668 const GUID refguid = {0x0c539790, 0x12e4, 0x11cf, | 674 const GUID refguid = {0x0c539790, 0x12e4, 0x11cf, |
669 0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}; | 675 0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}; |
670 ScopedComPtr<ISimpleDOMNode> document_isimpledomnode; | 676 base::win::ScopedComPtr<ISimpleDOMNode> document_isimpledomnode; |
671 hr = static_cast<IServiceProvider *>(service_provider)->QueryService( | 677 hr = static_cast<IServiceProvider *>(service_provider)->QueryService( |
672 refguid, IID_ISimpleDOMNode, | 678 refguid, IID_ISimpleDOMNode, |
673 reinterpret_cast<void**>(document_isimpledomnode.Receive())); | 679 reinterpret_cast<void**>(document_isimpledomnode.Receive())); |
674 ASSERT_EQ(S_OK, hr); | 680 ASSERT_EQ(S_OK, hr); |
675 | 681 |
676 BSTR node_name; | 682 BSTR node_name; |
677 short name_space_id; // NOLINT | 683 short name_space_id; // NOLINT |
678 BSTR node_value; | 684 BSTR node_value; |
679 unsigned int num_children; | 685 unsigned int num_children; |
680 unsigned int unique_id; | 686 unsigned int unique_id; |
681 unsigned short node_type; // NOLINT | 687 unsigned short node_type; // NOLINT |
682 hr = document_isimpledomnode->get_nodeInfo( | 688 hr = document_isimpledomnode->get_nodeInfo( |
683 &node_name, &name_space_id, &node_value, &num_children, &unique_id, | 689 &node_name, &name_space_id, &node_value, &num_children, &unique_id, |
684 &node_type); | 690 &node_type); |
685 ASSERT_EQ(S_OK, hr); | 691 ASSERT_EQ(S_OK, hr); |
686 EXPECT_EQ(NODETYPE_DOCUMENT, node_type); | 692 EXPECT_EQ(NODETYPE_DOCUMENT, node_type); |
687 EXPECT_EQ(1, num_children); | 693 EXPECT_EQ(1, num_children); |
688 | 694 |
689 ScopedComPtr<ISimpleDOMNode> body_isimpledomnode; | 695 base::win::ScopedComPtr<ISimpleDOMNode> body_isimpledomnode; |
690 hr = document_isimpledomnode->get_firstChild( | 696 hr = document_isimpledomnode->get_firstChild( |
691 body_isimpledomnode.Receive()); | 697 body_isimpledomnode.Receive()); |
692 ASSERT_EQ(S_OK, hr); | 698 ASSERT_EQ(S_OK, hr); |
693 hr = body_isimpledomnode->get_nodeInfo( | 699 hr = body_isimpledomnode->get_nodeInfo( |
694 &node_name, &name_space_id, &node_value, &num_children, &unique_id, | 700 &node_name, &name_space_id, &node_value, &num_children, &unique_id, |
695 &node_type); | 701 &node_type); |
696 ASSERT_EQ(S_OK, hr); | 702 ASSERT_EQ(S_OK, hr); |
697 EXPECT_STREQ(L"body", wstring(node_name, SysStringLen(node_name)).c_str()); | 703 EXPECT_STREQ(L"body", wstring(node_name, SysStringLen(node_name)).c_str()); |
698 EXPECT_EQ(NODETYPE_ELEMENT, node_type); | 704 EXPECT_EQ(NODETYPE_ELEMENT, node_type); |
699 EXPECT_EQ(1, num_children); | 705 EXPECT_EQ(1, num_children); |
700 | 706 |
701 ScopedComPtr<ISimpleDOMNode> checkbox_isimpledomnode; | 707 base::win::ScopedComPtr<ISimpleDOMNode> checkbox_isimpledomnode; |
702 hr = body_isimpledomnode->get_firstChild( | 708 hr = body_isimpledomnode->get_firstChild( |
703 checkbox_isimpledomnode.Receive()); | 709 checkbox_isimpledomnode.Receive()); |
704 ASSERT_EQ(S_OK, hr); | 710 ASSERT_EQ(S_OK, hr); |
705 hr = checkbox_isimpledomnode->get_nodeInfo( | 711 hr = checkbox_isimpledomnode->get_nodeInfo( |
706 &node_name, &name_space_id, &node_value, &num_children, &unique_id, | 712 &node_name, &name_space_id, &node_value, &num_children, &unique_id, |
707 &node_type); | 713 &node_type); |
708 ASSERT_EQ(S_OK, hr); | 714 ASSERT_EQ(S_OK, hr); |
709 EXPECT_STREQ(L"input", wstring(node_name, SysStringLen(node_name)).c_str()); | 715 EXPECT_STREQ(L"input", wstring(node_name, SysStringLen(node_name)).c_str()); |
710 EXPECT_EQ(NODETYPE_ELEMENT, node_type); | 716 EXPECT_EQ(NODETYPE_ELEMENT, node_type); |
711 EXPECT_EQ(0, num_children); | 717 EXPECT_EQ(0, num_children); |
712 } | 718 } |
713 } // namespace. | 719 } // namespace. |
OLD | NEW |