Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: content/browser/accessibility/browser_accessibility_win_unittest.cc

Issue 14264015: Misc. cleanup: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/accessibility/accessibility_win_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/win/scoped_bstr.h" 6 #include "base/win/scoped_bstr.h"
7 #include "base/win/scoped_comptr.h" 7 #include "base/win/scoped_comptr.h"
8 #include "base/win/scoped_variant.h" 8 #include "base/win/scoped_variant.h"
9 #include "content/browser/accessibility/browser_accessibility_manager.h" 9 #include "content/browser/accessibility/browser_accessibility_manager.h"
10 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 10 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
11 #include "content/browser/accessibility/browser_accessibility_win.h" 11 #include "content/browser/accessibility/browser_accessibility_win.h"
12 #include "content/common/accessibility_messages.h" 12 #include "content/common/accessibility_messages.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "ui/base/win/atl_module.h" 14 #include "ui/base/win/atl_module.h"
15 15
16 namespace content { 16 namespace content {
17 namespace { 17 namespace {
18 18
19
20 // CountedBrowserAccessibility ------------------------------------------------
21
19 // Subclass of BrowserAccessibilityWin that counts the number of instances. 22 // Subclass of BrowserAccessibilityWin that counts the number of instances.
20 class CountedBrowserAccessibility : public BrowserAccessibilityWin { 23 class CountedBrowserAccessibility : public BrowserAccessibilityWin {
21 public: 24 public:
22 CountedBrowserAccessibility() { global_obj_count_++; } 25 CountedBrowserAccessibility();
23 virtual ~CountedBrowserAccessibility() { global_obj_count_--; } 26 virtual ~CountedBrowserAccessibility();
24 static int global_obj_count_; 27
28 static int num_instances() { return num_instances_; }
29
30 private:
31 static int num_instances_;
32
33 DISALLOW_COPY_AND_ASSIGN(CountedBrowserAccessibility);
25 }; 34 };
26 35
27 int CountedBrowserAccessibility::global_obj_count_ = 0; 36 // static
37 int CountedBrowserAccessibility::num_instances_ = 0;
38
39 CountedBrowserAccessibility::CountedBrowserAccessibility() {
40 ++num_instances_;
41 }
42
43 CountedBrowserAccessibility::~CountedBrowserAccessibility() {
44 --num_instances_;
45 }
46
47
48 // CountedBrowserAccessibilityFactory -----------------------------------------
28 49
29 // Factory that creates a CountedBrowserAccessibility. 50 // Factory that creates a CountedBrowserAccessibility.
30 class CountedBrowserAccessibilityFactory 51 class CountedBrowserAccessibilityFactory : public BrowserAccessibilityFactory {
31 : public BrowserAccessibilityFactory {
32 public: 52 public:
33 virtual ~CountedBrowserAccessibilityFactory() {} 53 CountedBrowserAccessibilityFactory();
34 virtual BrowserAccessibility* Create() { 54
35 CComObject<CountedBrowserAccessibility>* instance; 55 private:
36 HRESULT hr = CComObject<CountedBrowserAccessibility>::CreateInstance( 56 virtual ~CountedBrowserAccessibilityFactory();
37 &instance); 57
38 DCHECK(SUCCEEDED(hr)); 58 virtual BrowserAccessibility* Create() OVERRIDE;
39 instance->AddRef(); 59
40 return instance; 60 DISALLOW_COPY_AND_ASSIGN(CountedBrowserAccessibilityFactory);
41 }
42 }; 61 };
43 62
44 } // anonymous namespace 63 CountedBrowserAccessibilityFactory::CountedBrowserAccessibilityFactory() {
64 }
65
66 CountedBrowserAccessibilityFactory::~CountedBrowserAccessibilityFactory() {
67 }
68
69 BrowserAccessibility* CountedBrowserAccessibilityFactory::Create() {
70 CComObject<CountedBrowserAccessibility>* instance;
71 HRESULT hr = CComObject<CountedBrowserAccessibility>::CreateInstance(
72 &instance);
73 DCHECK(SUCCEEDED(hr));
74 instance->AddRef();
75 return instance;
76 }
77
78 } // namespace
79
80
81 // BrowserAccessibilityTest ---------------------------------------------------
45 82
46 class BrowserAccessibilityTest : public testing::Test { 83 class BrowserAccessibilityTest : public testing::Test {
47 public: 84 public:
48 BrowserAccessibilityTest() {} 85 BrowserAccessibilityTest();
86 virtual ~BrowserAccessibilityTest();
49 87
50 private: 88 private:
51 virtual void SetUp() { 89 virtual void SetUp() OVERRIDE;
52 ui::win::CreateATLModuleIfNeeded();
53 }
54 90
55 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityTest); 91 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityTest);
56 }; 92 };
57 93
94 BrowserAccessibilityTest::BrowserAccessibilityTest() {
95 }
96
97 BrowserAccessibilityTest::~BrowserAccessibilityTest() {
98 }
99
100 void BrowserAccessibilityTest::SetUp() {
101 ui::win::CreateATLModuleIfNeeded();
102 }
103
104
105 // Actual tests ---------------------------------------------------------------
106
58 // Test that BrowserAccessibilityManager correctly releases the tree of 107 // Test that BrowserAccessibilityManager correctly releases the tree of
59 // BrowserAccessibility instances upon delete. 108 // BrowserAccessibility instances upon delete.
60 TEST_F(BrowserAccessibilityTest, TestNoLeaks) { 109 TEST_F(BrowserAccessibilityTest, TestNoLeaks) {
61 // Create AccessibilityNodeData objects for a simple document tree, 110 // Create AccessibilityNodeData objects for a simple document tree,
62 // representing the accessibility information used to initialize 111 // representing the accessibility information used to initialize
63 // BrowserAccessibilityManager. 112 // BrowserAccessibilityManager.
64 AccessibilityNodeData button; 113 AccessibilityNodeData button;
65 button.id = 2; 114 button.id = 2;
66 button.name = L"Button"; 115 button.name = L"Button";
67 button.role = AccessibilityNodeData::ROLE_BUTTON; 116 button.role = AccessibilityNodeData::ROLE_BUTTON;
(...skipping 10 matching lines...) Expand all
78 root.name = L"Document"; 127 root.name = L"Document";
79 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; 128 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA;
80 root.state = 0; 129 root.state = 0;
81 root.child_ids.push_back(2); 130 root.child_ids.push_back(2);
82 root.child_ids.push_back(3); 131 root.child_ids.push_back(3);
83 132
84 // Construct a BrowserAccessibilityManager with this 133 // Construct a BrowserAccessibilityManager with this
85 // AccessibilityNodeData tree and a factory for an instance-counting 134 // AccessibilityNodeData tree and a factory for an instance-counting
86 // BrowserAccessibility, and ensure that exactly 3 instances were 135 // BrowserAccessibility, and ensure that exactly 3 instances were
87 // created. Note that the manager takes ownership of the factory. 136 // created. Note that the manager takes ownership of the factory.
88 CountedBrowserAccessibility::global_obj_count_ = 0; 137 int initial_instances = CountedBrowserAccessibility::num_instances();
89 BrowserAccessibilityManager* manager = 138 scoped_ptr<BrowserAccessibilityManager> manager(
90 BrowserAccessibilityManager::Create( 139 BrowserAccessibilityManager::Create(
91 root, 140 root, NULL, new CountedBrowserAccessibilityFactory()));
92 NULL,
93 new CountedBrowserAccessibilityFactory());
94 manager->UpdateNodesForTesting(button, checkbox); 141 manager->UpdateNodesForTesting(button, checkbox);
95 ASSERT_EQ(3, CountedBrowserAccessibility::global_obj_count_); 142 ASSERT_EQ(initial_instances + 3,
dmazzoni 2013/04/15 21:51:44 This change looks like it will make it harder to u
Peter Kasting 2013/04/15 23:33:40 I liked that idea and changed to that and then dec
143 CountedBrowserAccessibility::num_instances());
96 144
97 // Delete the manager and test that all 3 instances are deleted. 145 // Delete the manager and test that all 3 instances are deleted.
98 delete manager; 146 manager.reset();
99 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 147 ASSERT_EQ(initial_instances, CountedBrowserAccessibility::num_instances());
100 148
101 // Construct a manager again, and this time use the IAccessible interface 149 // Construct a manager again, and this time use the IAccessible interface
102 // to get new references to two of the three nodes in the tree. 150 // to get new references to two of the three nodes in the tree.
103 manager = 151 manager.reset(BrowserAccessibilityManager::Create(
104 BrowserAccessibilityManager::Create( 152 root, NULL, new CountedBrowserAccessibilityFactory()));
105 root,
106 NULL,
107 new CountedBrowserAccessibilityFactory());
108 manager->UpdateNodesForTesting(button, checkbox); 153 manager->UpdateNodesForTesting(button, checkbox);
109 ASSERT_EQ(3, CountedBrowserAccessibility::global_obj_count_); 154 ASSERT_EQ(initial_instances + 3,
155 CountedBrowserAccessibility::num_instances());
110 IAccessible* root_accessible = 156 IAccessible* root_accessible =
111 manager->GetRoot()->ToBrowserAccessibilityWin(); 157 manager->GetRoot()->ToBrowserAccessibilityWin();
112 IDispatch* root_iaccessible = NULL; 158 IDispatch* root_iaccessible = NULL;
113 IDispatch* child1_iaccessible = NULL; 159 IDispatch* child1_iaccessible = NULL;
114 base::win::ScopedVariant childid_self(CHILDID_SELF); 160 base::win::ScopedVariant childid_self(CHILDID_SELF);
115 HRESULT hr = root_accessible->get_accChild(childid_self, &root_iaccessible); 161 HRESULT hr = root_accessible->get_accChild(childid_self, &root_iaccessible);
116 ASSERT_EQ(S_OK, hr); 162 ASSERT_EQ(S_OK, hr);
117 base::win::ScopedVariant one(1); 163 base::win::ScopedVariant one(1);
118 hr = root_accessible->get_accChild(one, &child1_iaccessible); 164 hr = root_accessible->get_accChild(one, &child1_iaccessible);
119 ASSERT_EQ(S_OK, hr); 165 ASSERT_EQ(S_OK, hr);
120 166
121 // Now delete the manager, and only one of the three nodes in the tree 167 // Now delete the manager, and only one of the three nodes in the tree
122 // should be released. 168 // should be released.
123 delete manager; 169 manager.reset();
124 ASSERT_EQ(2, CountedBrowserAccessibility::global_obj_count_); 170 ASSERT_EQ(initial_instances + 2,
171 CountedBrowserAccessibility::num_instances());
125 172
126 // Release each of our references and make sure that each one results in 173 // Release each of our references and make sure that each one results in
127 // the instance being deleted as its reference count hits zero. 174 // the instance being deleted as its reference count hits zero.
128 root_iaccessible->Release(); 175 root_iaccessible->Release();
129 ASSERT_EQ(1, CountedBrowserAccessibility::global_obj_count_); 176 ASSERT_EQ(initial_instances + 1,
177 CountedBrowserAccessibility::num_instances());
130 child1_iaccessible->Release(); 178 child1_iaccessible->Release();
131 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 179 ASSERT_EQ(initial_instances, CountedBrowserAccessibility::num_instances());
132 } 180 }
133 181
134 TEST_F(BrowserAccessibilityTest, TestChildrenChange) { 182 TEST_F(BrowserAccessibilityTest, TestChildrenChange) {
135 // Create AccessibilityNodeData objects for a simple document tree, 183 // Create AccessibilityNodeData objects for a simple document tree,
136 // representing the accessibility information used to initialize 184 // representing the accessibility information used to initialize
137 // BrowserAccessibilityManager. 185 // BrowserAccessibilityManager.
138 AccessibilityNodeData text; 186 AccessibilityNodeData text;
139 text.id = 2; 187 text.id = 2;
140 text.role = AccessibilityNodeData::ROLE_STATIC_TEXT; 188 text.role = AccessibilityNodeData::ROLE_STATIC_TEXT;
141 text.name = L"old text"; 189 text.name = L"old text";
142 text.state = 0; 190 text.state = 0;
143 191
144 AccessibilityNodeData root; 192 AccessibilityNodeData root;
145 root.id = 1; 193 root.id = 1;
146 root.name = L"Document"; 194 root.name = L"Document";
147 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; 195 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA;
148 root.state = 0; 196 root.state = 0;
149 root.child_ids.push_back(2); 197 root.child_ids.push_back(2);
150 198
151 // Construct a BrowserAccessibilityManager with this 199 // Construct a BrowserAccessibilityManager with this
152 // AccessibilityNodeData tree and a factory for an instance-counting 200 // AccessibilityNodeData tree and a factory for an instance-counting
153 // BrowserAccessibility. 201 // BrowserAccessibility.
154 CountedBrowserAccessibility::global_obj_count_ = 0; 202 int initial_instances = CountedBrowserAccessibility::num_instances();
155 BrowserAccessibilityManager* manager = 203 scoped_ptr<BrowserAccessibilityManager> manager(
156 BrowserAccessibilityManager::Create( 204 BrowserAccessibilityManager::Create(
157 root, 205 root, NULL, new CountedBrowserAccessibilityFactory()));
158 NULL,
159 new CountedBrowserAccessibilityFactory());
160 manager->UpdateNodesForTesting(text); 206 manager->UpdateNodesForTesting(text);
161 207
162 // Query for the text IAccessible and verify that it returns "old text" as its 208 // Query for the text IAccessible and verify that it returns "old text" as its
163 // value. 209 // value.
164 base::win::ScopedVariant one(1); 210 base::win::ScopedVariant one(1);
165 base::win::ScopedComPtr<IDispatch> text_dispatch; 211 base::win::ScopedComPtr<IDispatch> text_dispatch;
166 HRESULT hr = manager->GetRoot()->ToBrowserAccessibilityWin()->get_accChild( 212 HRESULT hr = manager->GetRoot()->ToBrowserAccessibilityWin()->get_accChild(
167 one, text_dispatch.Receive()); 213 one, text_dispatch.Receive());
168 ASSERT_EQ(S_OK, hr); 214 ASSERT_EQ(S_OK, hr);
169 215
(...skipping 17 matching lines...) Expand all
187 param.notification_type = AccessibilityNotificationChildrenChanged; 233 param.notification_type = AccessibilityNotificationChildrenChanged;
188 param.nodes.push_back(text); 234 param.nodes.push_back(text);
189 param.id = text.id; 235 param.id = text.id;
190 std::vector<AccessibilityHostMsg_NotificationParams> notifications; 236 std::vector<AccessibilityHostMsg_NotificationParams> notifications;
191 notifications.push_back(param); 237 notifications.push_back(param);
192 manager->OnAccessibilityNotifications(notifications); 238 manager->OnAccessibilityNotifications(notifications);
193 239
194 // Query for the text IAccessible and verify that it now returns "new text" 240 // Query for the text IAccessible and verify that it now returns "new text"
195 // as its value. 241 // as its value.
196 hr = manager->GetRoot()->ToBrowserAccessibilityWin()->get_accChild( 242 hr = manager->GetRoot()->ToBrowserAccessibilityWin()->get_accChild(
197 one, 243 one, text_dispatch.Receive());
198 text_dispatch.Receive());
199 ASSERT_EQ(S_OK, hr); 244 ASSERT_EQ(S_OK, hr);
200 245
201 hr = text_dispatch.QueryInterface(text_accessible.Receive()); 246 hr = text_dispatch.QueryInterface(text_accessible.Receive());
202 ASSERT_EQ(S_OK, hr); 247 ASSERT_EQ(S_OK, hr);
203 248
204 hr = text_accessible->get_accName(childid_self, name.Receive()); 249 hr = text_accessible->get_accName(childid_self, name.Receive());
205 ASSERT_EQ(S_OK, hr); 250 ASSERT_EQ(S_OK, hr);
206 EXPECT_EQ(L"new text", string16(name)); 251 EXPECT_EQ(L"new text", string16(name));
207 252
208 text_dispatch.Release(); 253 text_dispatch.Release();
209 text_accessible.Release(); 254 text_accessible.Release();
210 255
211 // Delete the manager and test that all BrowserAccessibility instances are 256 // Delete the manager and test that all BrowserAccessibility instances are
212 // deleted. 257 // deleted.
213 delete manager; 258 manager.reset();
214 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 259 ASSERT_EQ(initial_instances, CountedBrowserAccessibility::num_instances());
215 } 260 }
216 261
217 TEST_F(BrowserAccessibilityTest, TestChildrenChangeNoLeaks) { 262 TEST_F(BrowserAccessibilityTest, TestChildrenChangeNoLeaks) {
218 // Create AccessibilityNodeData objects for a simple document tree, 263 // Create AccessibilityNodeData objects for a simple document tree,
219 // representing the accessibility information used to initialize 264 // representing the accessibility information used to initialize
220 // BrowserAccessibilityManager. 265 // BrowserAccessibilityManager.
221 AccessibilityNodeData div; 266 AccessibilityNodeData div;
222 div.id = 2; 267 div.id = 2;
223 div.role = AccessibilityNodeData::ROLE_GROUP; 268 div.role = AccessibilityNodeData::ROLE_GROUP;
224 div.state = 0; 269 div.state = 0;
(...skipping 14 matching lines...) Expand all
239 AccessibilityNodeData root; 284 AccessibilityNodeData root;
240 root.id = 1; 285 root.id = 1;
241 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; 286 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA;
242 root.state = 0; 287 root.state = 0;
243 root.child_ids.push_back(2); 288 root.child_ids.push_back(2);
244 289
245 // Construct a BrowserAccessibilityManager with this 290 // Construct a BrowserAccessibilityManager with this
246 // AccessibilityNodeData tree and a factory for an instance-counting 291 // AccessibilityNodeData tree and a factory for an instance-counting
247 // BrowserAccessibility and ensure that exactly 4 instances were 292 // BrowserAccessibility and ensure that exactly 4 instances were
248 // created. Note that the manager takes ownership of the factory. 293 // created. Note that the manager takes ownership of the factory.
249 CountedBrowserAccessibility::global_obj_count_ = 0; 294 int initial_instances = CountedBrowserAccessibility::num_instances();
250 BrowserAccessibilityManager* manager = 295 scoped_ptr<BrowserAccessibilityManager> manager(
251 BrowserAccessibilityManager::Create( 296 BrowserAccessibilityManager::Create(
252 root, 297 root, NULL, new CountedBrowserAccessibilityFactory()));
253 NULL,
254 new CountedBrowserAccessibilityFactory());
255 manager->UpdateNodesForTesting(div, text3, text4); 298 manager->UpdateNodesForTesting(div, text3, text4);
256 ASSERT_EQ(4, CountedBrowserAccessibility::global_obj_count_); 299 ASSERT_EQ(initial_instances + 4,
300 CountedBrowserAccessibility::num_instances());
257 301
258 // Notify the BrowserAccessibilityManager that the div node and its children 302 // Notify the BrowserAccessibilityManager that the div node and its children
259 // were removed and ensure that only one BrowserAccessibility instance exists. 303 // were removed and ensure that only one BrowserAccessibility instance exists.
260 root.child_ids.clear(); 304 root.child_ids.clear();
261 AccessibilityHostMsg_NotificationParams param; 305 AccessibilityHostMsg_NotificationParams param;
262 param.notification_type = AccessibilityNotificationChildrenChanged; 306 param.notification_type = AccessibilityNotificationChildrenChanged;
263 param.nodes.push_back(root); 307 param.nodes.push_back(root);
264 param.id = root.id; 308 param.id = root.id;
265 std::vector<AccessibilityHostMsg_NotificationParams> notifications; 309 std::vector<AccessibilityHostMsg_NotificationParams> notifications;
266 notifications.push_back(param); 310 notifications.push_back(param);
267 manager->OnAccessibilityNotifications(notifications); 311 manager->OnAccessibilityNotifications(notifications);
268 ASSERT_EQ(1, CountedBrowserAccessibility::global_obj_count_); 312 ASSERT_EQ(initial_instances + 1,
313 CountedBrowserAccessibility::num_instances());
269 314
270 // Delete the manager and test that all BrowserAccessibility instances are 315 // Delete the manager and test that all BrowserAccessibility instances are
271 // deleted. 316 // deleted.
272 delete manager; 317 manager.reset();
273 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 318 ASSERT_EQ(initial_instances, CountedBrowserAccessibility::num_instances());
274 } 319 }
275 320
276 TEST_F(BrowserAccessibilityTest, TestTextBoundaries) { 321 TEST_F(BrowserAccessibilityTest, TestTextBoundaries) {
277 AccessibilityNodeData text1; 322 AccessibilityNodeData text1;
278 text1.id = 11; 323 text1.id = 11;
279 text1.role = AccessibilityNodeData::ROLE_TEXT_FIELD; 324 text1.role = AccessibilityNodeData::ROLE_TEXT_FIELD;
280 text1.state = 0; 325 text1.state = 0;
281 text1.value = L"One two three.\nFour five six."; 326 text1.value = L"One two three.\nFour five six.";
282 text1.line_breaks.push_back(15); 327 text1.line_breaks.push_back(15);
283 328
284 AccessibilityNodeData root; 329 AccessibilityNodeData root;
285 root.id = 1; 330 root.id = 1;
286 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; 331 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA;
287 root.state = 0; 332 root.state = 0;
288 root.child_ids.push_back(11); 333 root.child_ids.push_back(11);
289 334
290 CountedBrowserAccessibility::global_obj_count_ = 0; 335 int initial_instances = CountedBrowserAccessibility::num_instances();
291 BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( 336 scoped_ptr<BrowserAccessibilityManager> manager(
292 root, NULL, 337 BrowserAccessibilityManager::Create(
293 new CountedBrowserAccessibilityFactory()); 338 root, NULL, new CountedBrowserAccessibilityFactory()));
294 manager->UpdateNodesForTesting(text1); 339 manager->UpdateNodesForTesting(text1);
295 ASSERT_EQ(2, CountedBrowserAccessibility::global_obj_count_); 340 ASSERT_EQ(initial_instances + 2,
341 CountedBrowserAccessibility::num_instances());
296 342
297 BrowserAccessibilityWin* root_obj = 343 BrowserAccessibilityWin* root_obj =
298 manager->GetRoot()->ToBrowserAccessibilityWin(); 344 manager->GetRoot()->ToBrowserAccessibilityWin();
299 BrowserAccessibilityWin* text1_obj = 345 BrowserAccessibilityWin* text1_obj =
300 root_obj->GetChild(0)->ToBrowserAccessibilityWin(); 346 root_obj->GetChild(0)->ToBrowserAccessibilityWin();
301 347
302 base::win::ScopedBstr text;
303 long start;
304 long end;
305
306 long text1_len; 348 long text1_len;
307 ASSERT_EQ(S_OK, text1_obj->get_nCharacters(&text1_len)); 349 ASSERT_EQ(S_OK, text1_obj->get_nCharacters(&text1_len));
308 350
351 base::win::ScopedBstr text;
309 ASSERT_EQ(S_OK, text1_obj->get_text(0, text1_len, text.Receive())); 352 ASSERT_EQ(S_OK, text1_obj->get_text(0, text1_len, text.Receive()));
310 ASSERT_EQ(string16(text), text1.value); 353 ASSERT_EQ(text1.value, string16(text));
311 text.Reset(); 354 text.Reset();
312 355
313 ASSERT_EQ(S_OK, text1_obj->get_text(0, 4, text.Receive())); 356 ASSERT_EQ(S_OK, text1_obj->get_text(0, 4, text.Receive()));
314 ASSERT_STREQ(text, L"One "); 357 ASSERT_STREQ(L"One ", text);
315 text.Reset(); 358 text.Reset();
316 359
360 long start;
361 long end;
317 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( 362 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset(
318 1, IA2_TEXT_BOUNDARY_CHAR, &start, &end, text.Receive())); 363 1, IA2_TEXT_BOUNDARY_CHAR, &start, &end, text.Receive()));
319 ASSERT_EQ(start, 1); 364 ASSERT_EQ(1, start);
320 ASSERT_EQ(end, 2); 365 ASSERT_EQ(2, end);
321 ASSERT_STREQ(text, L"n"); 366 ASSERT_STREQ(L"n", text);
322 text.Reset(); 367 text.Reset();
323 368
324 ASSERT_EQ(S_FALSE, text1_obj->get_textAtOffset( 369 ASSERT_EQ(S_FALSE, text1_obj->get_textAtOffset(
325 text1_len, IA2_TEXT_BOUNDARY_CHAR, &start, &end, text.Receive())); 370 text1_len, IA2_TEXT_BOUNDARY_CHAR, &start, &end, text.Receive()));
326 ASSERT_EQ(start, text1_len); 371 ASSERT_EQ(text1_len, start);
327 ASSERT_EQ(end, text1_len); 372 ASSERT_EQ(text1_len, end);
328 text.Reset(); 373 text.Reset();
329 374
330 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( 375 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset(
331 1, IA2_TEXT_BOUNDARY_WORD, &start, &end, text.Receive())); 376 1, IA2_TEXT_BOUNDARY_WORD, &start, &end, text.Receive()));
332 ASSERT_EQ(start, 0); 377 ASSERT_EQ(0, start);
333 ASSERT_EQ(end, 3); 378 ASSERT_EQ(3, end);
334 ASSERT_STREQ(text, L"One"); 379 ASSERT_STREQ(L"One", text);
335 text.Reset(); 380 text.Reset();
336 381
337 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( 382 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset(
338 6, IA2_TEXT_BOUNDARY_WORD, &start, &end, text.Receive())); 383 6, IA2_TEXT_BOUNDARY_WORD, &start, &end, text.Receive()));
339 ASSERT_EQ(start, 4); 384 ASSERT_EQ(4, start);
340 ASSERT_EQ(end, 7); 385 ASSERT_EQ(7, end);
341 ASSERT_STREQ(text, L"two"); 386 ASSERT_STREQ(L"two", text);
342 text.Reset(); 387 text.Reset();
343 388
344 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( 389 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset(
345 text1_len, IA2_TEXT_BOUNDARY_WORD, &start, &end, text.Receive())); 390 text1_len, IA2_TEXT_BOUNDARY_WORD, &start, &end, text.Receive()));
346 ASSERT_EQ(start, 25); 391 ASSERT_EQ(25, start);
347 ASSERT_EQ(end, 29); 392 ASSERT_EQ(29, end);
348 ASSERT_STREQ(text, L"six."); 393 ASSERT_STREQ(L"six.", text);
349 text.Reset(); 394 text.Reset();
350 395
351 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( 396 ASSERT_EQ(S_OK, text1_obj->get_textAtOffset(
352 1, IA2_TEXT_BOUNDARY_LINE, &start, &end, text.Receive())); 397 1, IA2_TEXT_BOUNDARY_LINE, &start, &end, text.Receive()));
353 ASSERT_EQ(start, 0); 398 ASSERT_EQ(0, start);
354 ASSERT_EQ(end, 15); 399 ASSERT_EQ(15, end);
355 ASSERT_STREQ(text, L"One two three.\n"); 400 ASSERT_STREQ(L"One two three.\n", text);
356 text.Reset(); 401 text.Reset();
357 402
358 ASSERT_EQ(S_OK, 403 ASSERT_EQ(S_OK,
359 text1_obj->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); 404 text1_obj->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive()));
360 ASSERT_STREQ(text, L"One two three.\nFour five six."); 405 ASSERT_STREQ(L"One two three.\nFour five six.", text);
361 406
362 // Delete the manager and test that all BrowserAccessibility instances are 407 // Delete the manager and test that all BrowserAccessibility instances are
363 // deleted. 408 // deleted.
364 delete manager; 409 manager.reset();
365 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 410 ASSERT_EQ(initial_instances, CountedBrowserAccessibility::num_instances());
366 } 411 }
367 412
368 TEST_F(BrowserAccessibilityTest, TestSimpleHypertext) { 413 TEST_F(BrowserAccessibilityTest, TestSimpleHypertext) {
369 AccessibilityNodeData text1; 414 AccessibilityNodeData text1;
370 text1.id = 11; 415 text1.id = 11;
371 text1.role = AccessibilityNodeData::ROLE_STATIC_TEXT; 416 text1.role = AccessibilityNodeData::ROLE_STATIC_TEXT;
372 text1.state = 1 << AccessibilityNodeData::STATE_READONLY; 417 text1.state = 1 << AccessibilityNodeData::STATE_READONLY;
373 text1.name = L"One two three."; 418 text1.name = L"One two three.";
374 419
375 AccessibilityNodeData text2; 420 AccessibilityNodeData text2;
376 text2.id = 12; 421 text2.id = 12;
377 text2.role = AccessibilityNodeData::ROLE_STATIC_TEXT; 422 text2.role = AccessibilityNodeData::ROLE_STATIC_TEXT;
378 text2.state = 1 << AccessibilityNodeData::STATE_READONLY; 423 text2.state = 1 << AccessibilityNodeData::STATE_READONLY;
379 text2.name = L" Four five six."; 424 text2.name = L" Four five six.";
380 425
381 AccessibilityNodeData root; 426 AccessibilityNodeData root;
382 root.id = 1; 427 root.id = 1;
383 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; 428 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA;
384 root.state = 1 << AccessibilityNodeData::STATE_READONLY; 429 root.state = 1 << AccessibilityNodeData::STATE_READONLY;
385 root.child_ids.push_back(11); 430 root.child_ids.push_back(11);
386 root.child_ids.push_back(12); 431 root.child_ids.push_back(12);
387 432
388 CountedBrowserAccessibility::global_obj_count_ = 0; 433 int initial_instances = CountedBrowserAccessibility::num_instances();
389 BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( 434 scoped_ptr<BrowserAccessibilityManager> manager(
390 root, NULL, 435 BrowserAccessibilityManager::Create(
391 new CountedBrowserAccessibilityFactory()); 436 root, NULL, new CountedBrowserAccessibilityFactory()));
392 manager->UpdateNodesForTesting(root, text1, text2); 437 manager->UpdateNodesForTesting(root, text1, text2);
393 ASSERT_EQ(3, CountedBrowserAccessibility::global_obj_count_); 438 ASSERT_EQ(initial_instances + 3,
439 CountedBrowserAccessibility::num_instances());
394 440
395 BrowserAccessibilityWin* root_obj = 441 BrowserAccessibilityWin* root_obj =
396 manager->GetRoot()->ToBrowserAccessibilityWin(); 442 manager->GetRoot()->ToBrowserAccessibilityWin();
397 443
398 base::win::ScopedBstr text;
399
400 long text_len; 444 long text_len;
401 ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len)); 445 ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len));
402 446
447 base::win::ScopedBstr text;
403 ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, text.Receive())); 448 ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, text.Receive()));
404 EXPECT_EQ(string16(text), text1.name + text2.name); 449 EXPECT_EQ(text1.name + text2.name, string16(text));
405 450
406 long hyperlink_count; 451 long hyperlink_count;
407 ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count)); 452 ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count));
408 EXPECT_EQ(0, hyperlink_count); 453 EXPECT_EQ(0, hyperlink_count);
409 454
410 base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink; 455 base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink;
411 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive())); 456 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive()));
412 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(0, hyperlink.Receive())); 457 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(0, hyperlink.Receive()));
413 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive())); 458 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive()));
414 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(29, hyperlink.Receive())); 459 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(29, hyperlink.Receive()));
415 460
416 long hyperlink_index; 461 long hyperlink_index;
417 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); 462 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index));
418 EXPECT_EQ(-1, hyperlink_index); 463 EXPECT_EQ(-1, hyperlink_index);
419 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index)); 464 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index));
420 EXPECT_EQ(-1, hyperlink_index); 465 EXPECT_EQ(-1, hyperlink_index);
421 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(-1, &hyperlink_index)); 466 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(-1, &hyperlink_index));
422 EXPECT_EQ(-1, hyperlink_index); 467 EXPECT_EQ(-1, hyperlink_index);
423 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(29, &hyperlink_index)); 468 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(29, &hyperlink_index));
424 EXPECT_EQ(-1, hyperlink_index); 469 EXPECT_EQ(-1, hyperlink_index);
425 470
426 // Delete the manager and test that all BrowserAccessibility instances are 471 // Delete the manager and test that all BrowserAccessibility instances are
427 // deleted. 472 // deleted.
428 delete manager; 473 manager.reset();
429 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 474 ASSERT_EQ(initial_instances, CountedBrowserAccessibility::num_instances());
430 } 475 }
431 476
432 TEST_F(BrowserAccessibilityTest, TestComplexHypertext) { 477 TEST_F(BrowserAccessibilityTest, TestComplexHypertext) {
433 AccessibilityNodeData text1; 478 AccessibilityNodeData text1;
434 text1.id = 11; 479 text1.id = 11;
435 text1.role = AccessibilityNodeData::ROLE_STATIC_TEXT; 480 text1.role = AccessibilityNodeData::ROLE_STATIC_TEXT;
436 text1.state = 1 << AccessibilityNodeData::STATE_READONLY; 481 text1.state = 1 << AccessibilityNodeData::STATE_READONLY;
437 text1.name = L"One two three."; 482 text1.name = L"One two three.";
438 483
439 AccessibilityNodeData text2; 484 AccessibilityNodeData text2;
(...skipping 24 matching lines...) Expand all
464 509
465 AccessibilityNodeData root; 510 AccessibilityNodeData root;
466 root.id = 1; 511 root.id = 1;
467 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; 512 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA;
468 root.state = 1 << AccessibilityNodeData::STATE_READONLY; 513 root.state = 1 << AccessibilityNodeData::STATE_READONLY;
469 root.child_ids.push_back(11); 514 root.child_ids.push_back(11);
470 root.child_ids.push_back(13); 515 root.child_ids.push_back(13);
471 root.child_ids.push_back(12); 516 root.child_ids.push_back(12);
472 root.child_ids.push_back(14); 517 root.child_ids.push_back(14);
473 518
474 CountedBrowserAccessibility::global_obj_count_ = 0; 519 int initial_instances = CountedBrowserAccessibility::num_instances();
475 BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( 520 scoped_ptr<BrowserAccessibilityManager> manager(
476 root, NULL, 521 BrowserAccessibilityManager::Create(
477 new CountedBrowserAccessibilityFactory()); 522 root, NULL, new CountedBrowserAccessibilityFactory()));
478 manager->UpdateNodesForTesting(root, 523 manager->UpdateNodesForTesting(root,
479 text1, button1, button1_text, 524 text1, button1, button1_text,
480 text2, link1, link1_text); 525 text2, link1, link1_text);
481 526
482 ASSERT_EQ(7, CountedBrowserAccessibility::global_obj_count_); 527 ASSERT_EQ(initial_instances + 7,
528 CountedBrowserAccessibility::num_instances());
483 529
484 BrowserAccessibilityWin* root_obj = 530 BrowserAccessibilityWin* root_obj =
485 manager->GetRoot()->ToBrowserAccessibilityWin(); 531 manager->GetRoot()->ToBrowserAccessibilityWin();
486 532
487 base::win::ScopedBstr text;
488
489 long text_len; 533 long text_len;
490 ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len)); 534 ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len));
491 535
536 base::win::ScopedBstr text;
492 ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, text.Receive())); 537 ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, text.Receive()));
493 const string16 embed = BrowserAccessibilityWin::kEmbeddedCharacter; 538 const string16 embed = BrowserAccessibilityWin::kEmbeddedCharacter;
494 EXPECT_EQ(string16(text), text1.name + embed + text2.name + embed); 539 EXPECT_EQ(text1.name + embed + text2.name + embed, string16(text));
495 text.Reset(); 540 text.Reset();
496 541
497 long hyperlink_count; 542 long hyperlink_count;
498 ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count)); 543 ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count));
499 EXPECT_EQ(2, hyperlink_count); 544 EXPECT_EQ(2, hyperlink_count);
500 545
501 base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink; 546 base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink;
502 base::win::ScopedComPtr<IAccessibleText> hypertext; 547 base::win::ScopedComPtr<IAccessibleText> hypertext;
503 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive())); 548 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive()));
504 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(2, hyperlink.Receive())); 549 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(2, hyperlink.Receive()));
505 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive())); 550 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive()));
506 551
507 EXPECT_EQ(S_OK, root_obj->get_hyperlink(0, hyperlink.Receive())); 552 EXPECT_EQ(S_OK, root_obj->get_hyperlink(0, hyperlink.Receive()));
508 EXPECT_EQ(S_OK, 553 EXPECT_EQ(S_OK,
509 hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive())); 554 hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive()));
510 EXPECT_EQ(S_OK, hypertext->get_text(0, 3, text.Receive())); 555 EXPECT_EQ(S_OK, hypertext->get_text(0, 3, text.Receive()));
511 EXPECT_STREQ(text, L"red"); 556 EXPECT_STREQ(L"red", text);
512 text.Reset(); 557 text.Reset();
513 hyperlink.Release(); 558 hyperlink.Release();
514 hypertext.Release(); 559 hypertext.Release();
515 560
516 EXPECT_EQ(S_OK, root_obj->get_hyperlink(1, hyperlink.Receive())); 561 EXPECT_EQ(S_OK, root_obj->get_hyperlink(1, hyperlink.Receive()));
517 EXPECT_EQ(S_OK, 562 EXPECT_EQ(S_OK,
518 hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive())); 563 hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive()));
519 EXPECT_EQ(S_OK, hypertext->get_text(0, 4, text.Receive())); 564 EXPECT_EQ(S_OK, hypertext->get_text(0, 4, text.Receive()));
520 EXPECT_STREQ(text, L"blue"); 565 EXPECT_STREQ(L"blue", text);
521 text.Reset(); 566 text.Reset();
522 hyperlink.Release(); 567 hyperlink.Release();
523 hypertext.Release(); 568 hypertext.Release();
524 569
525 long hyperlink_index; 570 long hyperlink_index;
526 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); 571 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index));
527 EXPECT_EQ(-1, hyperlink_index); 572 EXPECT_EQ(-1, hyperlink_index);
528 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index)); 573 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index));
529 EXPECT_EQ(-1, hyperlink_index); 574 EXPECT_EQ(-1, hyperlink_index);
530 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(14, &hyperlink_index)); 575 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(14, &hyperlink_index));
531 EXPECT_EQ(0, hyperlink_index); 576 EXPECT_EQ(0, hyperlink_index);
532 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(30, &hyperlink_index)); 577 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(30, &hyperlink_index));
533 EXPECT_EQ(1, hyperlink_index); 578 EXPECT_EQ(1, hyperlink_index);
534 579
535 // Delete the manager and test that all BrowserAccessibility instances are 580 // Delete the manager and test that all BrowserAccessibility instances are
536 // deleted. 581 // deleted.
537 delete manager; 582 manager.reset();
538 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 583 ASSERT_EQ(initial_instances, CountedBrowserAccessibility::num_instances());
539 } 584 }
540 585
541 TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) { 586 TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) {
542 // Try creating an empty document with busy state. Readonly is 587 // Try creating an empty document with busy state. Readonly is
543 // set automatically. 588 // set automatically.
589 int initial_instances = CountedBrowserAccessibility::num_instances();
544 const int32 busy_state = 1 << AccessibilityNodeData::STATE_BUSY; 590 const int32 busy_state = 1 << AccessibilityNodeData::STATE_BUSY;
545 const int32 readonly_state = 1 << AccessibilityNodeData::STATE_READONLY; 591 const int32 readonly_state = 1 << AccessibilityNodeData::STATE_READONLY;
546 scoped_ptr<BrowserAccessibilityManager> manager; 592 scoped_ptr<BrowserAccessibilityManager> manager(
547 manager.reset(new BrowserAccessibilityManagerWin( 593 new BrowserAccessibilityManagerWin(
548 GetDesktopWindow(), 594 GetDesktopWindow(),
549 NULL, 595 NULL,
550 BrowserAccessibilityManagerWin::GetEmptyDocument(), 596 BrowserAccessibilityManagerWin::GetEmptyDocument(),
551 NULL, 597 NULL,
552 new CountedBrowserAccessibilityFactory())); 598 new CountedBrowserAccessibilityFactory()));
553 599
554 // Verify the root is as we expect by default. 600 // Verify the root is as we expect by default.
555 BrowserAccessibility* root = manager->GetRoot(); 601 BrowserAccessibility* root = manager->GetRoot();
556 EXPECT_EQ(0, root->renderer_id()); 602 EXPECT_EQ(0, root->renderer_id());
557 EXPECT_EQ(AccessibilityNodeData::ROLE_ROOT_WEB_AREA, root->role()); 603 EXPECT_EQ(AccessibilityNodeData::ROLE_ROOT_WEB_AREA, root->role());
558 EXPECT_EQ(busy_state | readonly_state, root->state()); 604 EXPECT_EQ(busy_state | readonly_state, root->state());
559 605
560 // Tree with a child textfield. 606 // Tree with a child textfield.
561 AccessibilityNodeData tree1_1; 607 AccessibilityNodeData tree1_1;
562 tree1_1.id = 1; 608 tree1_1.id = 1;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 655
610 // Verify the root has changed. 656 // Verify the root has changed.
611 EXPECT_NE(root, manager->GetRoot()); 657 EXPECT_NE(root, manager->GetRoot());
612 658
613 // And the new child exists. 659 // And the new child exists.
614 EXPECT_EQ(AccessibilityNodeData::ROLE_BUTTON, acc2_2->role()); 660 EXPECT_EQ(AccessibilityNodeData::ROLE_BUTTON, acc2_2->role());
615 EXPECT_EQ(3, acc2_2->renderer_id()); 661 EXPECT_EQ(3, acc2_2->renderer_id());
616 662
617 // Ensure we properly cleaned up. 663 // Ensure we properly cleaned up.
618 manager.reset(); 664 manager.reset();
619 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 665 ASSERT_EQ(initial_instances, CountedBrowserAccessibility::num_instances());
620 } 666 }
621 667
622 } // namespace content 668 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/accessibility_win_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698