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/win/scoped_comptr.h" | 6 #include "base/win/scoped_comptr.h" |
7 #include "content/browser/accessibility/browser_accessibility_manager.h" | 7 #include "content/browser/accessibility/browser_accessibility_manager.h" |
8 #include "content/browser/accessibility/browser_accessibility_win.h" | 8 #include "content/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" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); |
191 | 191 |
192 // Notify the BrowserAccessibilityManager that the text child has changed. | 192 // Notify the BrowserAccessibilityManager that the text child has changed. |
193 text.name = L"new text"; | 193 text.name = L"new text"; |
194 ViewHostMsg_AccessibilityNotification_Params param; | 194 ViewHostMsg_AccessibilityNotification_Params param; |
195 param.notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; | 195 param.notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; |
196 param.acc_obj = text; | 196 param.acc_tree = text; |
| 197 param.includes_children = true; |
| 198 param.id = text.id; |
197 std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; | 199 std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; |
198 notifications.push_back(param); | 200 notifications.push_back(param); |
199 manager->OnAccessibilityNotifications(notifications); | 201 manager->OnAccessibilityNotifications(notifications); |
200 | 202 |
201 // Query for the text IAccessible and verify that it now returns "new text" | 203 // Query for the text IAccessible and verify that it now returns "new text" |
202 // as its value. | 204 // as its value. |
203 hr = manager->GetRoot()->toBrowserAccessibilityWin()->get_accChild( | 205 hr = manager->GetRoot()->toBrowserAccessibilityWin()->get_accChild( |
204 CreateI4Variant(1), | 206 CreateI4Variant(1), |
205 text_dispatch.Receive()); | 207 text_dispatch.Receive()); |
206 ASSERT_EQ(S_OK, hr); | 208 ASSERT_EQ(S_OK, hr); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 root, | 258 root, |
257 NULL, | 259 NULL, |
258 new CountedBrowserAccessibilityFactory()); | 260 new CountedBrowserAccessibilityFactory()); |
259 ASSERT_EQ(4, CountedBrowserAccessibility::global_obj_count_); | 261 ASSERT_EQ(4, CountedBrowserAccessibility::global_obj_count_); |
260 | 262 |
261 // Notify the BrowserAccessibilityManager that the div node and its children | 263 // Notify the BrowserAccessibilityManager that the div node and its children |
262 // were removed and ensure that only one BrowserAccessibility instance exists. | 264 // were removed and ensure that only one BrowserAccessibility instance exists. |
263 root.children.clear(); | 265 root.children.clear(); |
264 ViewHostMsg_AccessibilityNotification_Params param; | 266 ViewHostMsg_AccessibilityNotification_Params param; |
265 param.notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; | 267 param.notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; |
266 param.acc_obj = root; | 268 param.acc_tree = root; |
| 269 param.includes_children = true; |
| 270 param.id = root.id; |
267 std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; | 271 std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; |
268 notifications.push_back(param); | 272 notifications.push_back(param); |
269 manager->OnAccessibilityNotifications(notifications); | 273 manager->OnAccessibilityNotifications(notifications); |
270 ASSERT_EQ(1, CountedBrowserAccessibility::global_obj_count_); | 274 ASSERT_EQ(1, CountedBrowserAccessibility::global_obj_count_); |
271 | 275 |
272 // Delete the manager and test that all BrowserAccessibility instances are | 276 // Delete the manager and test that all BrowserAccessibility instances are |
273 // deleted. | 277 // deleted. |
274 delete manager; | 278 delete manager; |
275 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); | 279 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); |
276 } | 280 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 361 |
358 ASSERT_EQ(S_OK, text1_obj->get_text(0, IA2_TEXT_OFFSET_LENGTH, &text)); | 362 ASSERT_EQ(S_OK, text1_obj->get_text(0, IA2_TEXT_OFFSET_LENGTH, &text)); |
359 ASSERT_EQ(text, string16(L"One two three.\nFour five six.")); | 363 ASSERT_EQ(text, string16(L"One two three.\nFour five six.")); |
360 SysFreeString(text); | 364 SysFreeString(text); |
361 | 365 |
362 // Delete the manager and test that all BrowserAccessibility instances are | 366 // Delete the manager and test that all BrowserAccessibility instances are |
363 // deleted. | 367 // deleted. |
364 delete manager; | 368 delete manager; |
365 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); | 369 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); |
366 } | 370 } |
OLD | NEW |