OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <oleacc.h> | 5 #include <oleacc.h> |
6 | 6 |
7 #include "base/win/scoped_bstr.h" | 7 #include "base/win/scoped_bstr.h" |
8 #include "base/win/scoped_comptr.h" | 8 #include "base/win/scoped_comptr.h" |
9 #include "base/win/scoped_variant.h" | 9 #include "base/win/scoped_variant.h" |
10 #include "third_party/iaccessible2/ia2_api_all.h" | 10 #include "third_party/iaccessible2/ia2_api_all.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 ASSERT_EQ(S_OK, textfield_accessible->get_accValue( | 74 ASSERT_EQ(S_OK, textfield_accessible->get_accValue( |
75 childid_self, value.Receive())); | 75 childid_self, value.Receive())); |
76 ASSERT_STREQ(L"Value", value); | 76 ASSERT_STREQ(L"Value", value); |
77 | 77 |
78 ScopedBstr new_value(L"New value"); | 78 ScopedBstr new_value(L"New value"); |
79 ASSERT_EQ(S_OK, textfield_accessible->put_accValue(childid_self, new_value)); | 79 ASSERT_EQ(S_OK, textfield_accessible->put_accValue(childid_self, new_value)); |
80 | 80 |
81 ASSERT_STREQ(L"New value", textfield->text().c_str()); | 81 ASSERT_STREQ(L"New value", textfield->text().c_str()); |
82 } | 82 } |
83 | 83 |
84 TEST_F(NativeViewAcccessibilityWinTest, UnattachedWebView) { | |
David Tseng
2015/02/18 19:51:19
What happened to this test?
dmazzoni
2015/02/18 23:20:20
Deleted on purpose because I got rid of the code t
| |
85 // This is a regression test. Calling get_accChild on the native accessible | |
86 // object for a WebView with no attached WebContents was causing an | |
87 // infinite loop and crash. This test simulates that with an ordinary | |
88 // View that registers itself as a web view with NativeViewAcccessibility. | |
89 | |
90 Widget widget; | |
91 Widget::InitParams init_params = | |
92 CreateParams(Widget::InitParams::TYPE_POPUP); | |
93 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | |
94 widget.Init(init_params); | |
95 | |
96 View* content = new View; | |
97 widget.SetContentsView(content); | |
98 | |
99 View* web_view = new View; | |
100 content->AddChildView(web_view); | |
101 NativeViewAccessibility::RegisterWebView(web_view); | |
102 | |
103 ScopedComPtr<IAccessible> web_view_accessible( | |
104 web_view->GetNativeViewAccessible()); | |
105 ScopedComPtr<IDispatch> result_dispatch; | |
106 ScopedVariant child_index(-999); | |
107 ASSERT_EQ(E_FAIL, web_view_accessible->get_accChild( | |
108 child_index, result_dispatch.Receive())); | |
109 | |
110 NativeViewAccessibility::UnregisterWebView(web_view); | |
111 } | |
112 | |
113 TEST_F(NativeViewAcccessibilityWinTest, AuraOwnedWidgets) { | 84 TEST_F(NativeViewAcccessibilityWinTest, AuraOwnedWidgets) { |
114 Widget widget; | 85 Widget widget; |
115 Widget::InitParams init_params = | 86 Widget::InitParams init_params = |
116 CreateParams(Widget::InitParams::TYPE_WINDOW); | 87 CreateParams(Widget::InitParams::TYPE_WINDOW); |
117 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 88 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
118 widget.Init(init_params); | 89 widget.Init(init_params); |
119 | 90 |
120 ScopedComPtr<IAccessible> root_view_accessible( | 91 ScopedComPtr<IAccessible> root_view_accessible( |
121 widget.GetRootView()->GetNativeViewAccessible()); | 92 widget.GetRootView()->GetNativeViewAccessible()); |
122 | 93 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 delete infobar; | 166 delete infobar; |
196 ASSERT_EQ(S_OK, root_view_accessible->get_relationTargetsOfType( | 167 ASSERT_EQ(S_OK, root_view_accessible->get_relationTargetsOfType( |
197 alerts_bstr, 0, &targets, &n_targets)); | 168 alerts_bstr, 0, &targets, &n_targets)); |
198 ASSERT_EQ(1, n_targets); | 169 ASSERT_EQ(1, n_targets); |
199 ASSERT_TRUE(infobar2_accessible.IsSameObject(targets[0])); | 170 ASSERT_TRUE(infobar2_accessible.IsSameObject(targets[0])); |
200 CoTaskMemFree(targets); | 171 CoTaskMemFree(targets); |
201 } | 172 } |
202 | 173 |
203 } // namespace test | 174 } // namespace test |
204 } // namespace views | 175 } // namespace views |
OLD | NEW |