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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/scoped_comptr_win.h" | 6 #include "base/win/scoped_comptr.h" |
7 #include "chrome/browser/accessibility/browser_accessibility_manager.h" | 7 #include "chrome/browser/accessibility/browser_accessibility_manager.h" |
8 #include "chrome/browser/accessibility/browser_accessibility_win.h" | 8 #include "chrome/browser/accessibility/browser_accessibility_win.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 using webkit_glue::WebAccessibility; | 12 using webkit_glue::WebAccessibility; |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Subclass of BrowserAccessibilityWin that counts the number of instances. | 16 // Subclass of BrowserAccessibilityWin that counts the number of instances. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 CountedBrowserAccessibility::global_obj_count_ = 0; | 165 CountedBrowserAccessibility::global_obj_count_ = 0; |
166 BrowserAccessibilityManager* manager = | 166 BrowserAccessibilityManager* manager = |
167 BrowserAccessibilityManager::Create( | 167 BrowserAccessibilityManager::Create( |
168 GetDesktopWindow(), | 168 GetDesktopWindow(), |
169 root, | 169 root, |
170 NULL, | 170 NULL, |
171 new CountedBrowserAccessibilityFactory()); | 171 new CountedBrowserAccessibilityFactory()); |
172 | 172 |
173 // Query for the text IAccessible and verify that it returns "old text" as its | 173 // Query for the text IAccessible and verify that it returns "old text" as its |
174 // value. | 174 // value. |
175 ScopedComPtr<IDispatch> text_dispatch; | 175 base::win::ScopedComPtr<IDispatch> text_dispatch; |
176 HRESULT hr = manager->GetRoot()->toBrowserAccessibilityWin()->get_accChild( | 176 HRESULT hr = manager->GetRoot()->toBrowserAccessibilityWin()->get_accChild( |
177 CreateI4Variant(1), text_dispatch.Receive()); | 177 CreateI4Variant(1), text_dispatch.Receive()); |
178 ASSERT_EQ(S_OK, hr); | 178 ASSERT_EQ(S_OK, hr); |
179 | 179 |
180 ScopedComPtr<IAccessible> text_accessible; | 180 base::win::ScopedComPtr<IAccessible> text_accessible; |
181 hr = text_dispatch.QueryInterface(text_accessible.Receive()); | 181 hr = text_dispatch.QueryInterface(text_accessible.Receive()); |
182 ASSERT_EQ(S_OK, hr); | 182 ASSERT_EQ(S_OK, hr); |
183 | 183 |
184 CComBSTR name; | 184 CComBSTR name; |
185 hr = text_accessible->get_accName(CreateI4Variant(CHILDID_SELF), &name); | 185 hr = text_accessible->get_accName(CreateI4Variant(CHILDID_SELF), &name); |
186 ASSERT_EQ(S_OK, hr); | 186 ASSERT_EQ(S_OK, hr); |
187 EXPECT_STREQ(L"old text", name.m_str); | 187 EXPECT_STREQ(L"old text", name.m_str); |
188 | 188 |
189 text_dispatch.Release(); | 189 text_dispatch.Release(); |
190 text_accessible.Release(); | 190 text_accessible.Release(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 ASSERT_EQ(start, 0); | 356 ASSERT_EQ(start, 0); |
357 ASSERT_EQ(end, 13); | 357 ASSERT_EQ(end, 13); |
358 ASSERT_EQ(text, string16(L"One two three")); | 358 ASSERT_EQ(text, string16(L"One two three")); |
359 SysFreeString(text); | 359 SysFreeString(text); |
360 | 360 |
361 // Delete the manager and test that all BrowserAccessibility instances are | 361 // Delete the manager and test that all BrowserAccessibility instances are |
362 // deleted. | 362 // deleted. |
363 delete manager; | 363 delete manager; |
364 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); | 364 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); |
365 } | 365 } |
OLD | NEW |