OLD | NEW |
---|---|
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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "content/common/frame_messages.h" | 6 #include "content/common/frame_messages.h" |
7 #include "content/common/view_message_enums.h" | 7 #include "content/common/view_message_enums.h" |
8 #include "content/public/test/render_view_test.h" | 8 #include "content/public/test/render_view_test.h" |
9 #include "content/renderer/accessibility/renderer_accessibility_complete.h" | 9 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
10 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 AccessibilityHostMsg_EventParams event; | 509 AccessibilityHostMsg_EventParams event; |
510 GetLastAccEvent(&event); | 510 GetLastAccEvent(&event); |
511 ASSERT_EQ(5U, event.update.nodes.size()); | 511 ASSERT_EQ(5U, event.update.nodes.size()); |
512 | 512 |
513 EXPECT_EQ(body.axID(), event.update.nodes[0].id); | 513 EXPECT_EQ(body.axID(), event.update.nodes[0].id); |
514 EXPECT_EQ(text_1.axID(), event.update.nodes[1].id); | 514 EXPECT_EQ(text_1.axID(), event.update.nodes[1].id); |
515 // The third event is to update text_2, but its id changes | 515 // The third event is to update text_2, but its id changes |
516 // so we don't have a test expectation for it. | 516 // so we don't have a test expectation for it. |
517 } | 517 } |
518 | 518 |
519 TEST_F(RendererAccessibilityTest, EventOnObjectNotInTree) { | |
520 // Test RendererAccessibilityComplete and make sure it doesn't sent anything | |
Peter Lundblad
2014/05/07 23:03:24
nit: s/sent/send/
dmazzoni
2014/05/08 15:12:23
Done.
| |
521 // if we get a notification from Blink for an object that isn't in the | |
522 // tree, like the scroll area that's the parent of the main document, | |
523 // which we don't expose. | |
524 std::string html = "<body><input></body>"; | |
525 LoadHTML(html.c_str()); | |
526 | |
527 scoped_ptr<TestRendererAccessibilityComplete> accessibility( | |
528 new TestRendererAccessibilityComplete(view())); | |
529 accessibility->SendPendingAccessibilityEvents(); | |
530 EXPECT_EQ(3, CountAccessibilityNodesSentToBrowser()); | |
531 | |
532 WebDocument document = view()->GetWebView()->mainFrame()->document(); | |
533 WebAXObject root_obj = document.accessibilityObject(); | |
534 WebAXObject scroll_area = root_obj.parentObject(); | |
535 EXPECT_EQ(blink::WebAXRoleScrollArea, scroll_area.role()); | |
536 | |
537 // Try to fire a message on the scroll area, and assert that we just | |
538 // ignore it. | |
539 sink_->ClearMessages(); | |
540 accessibility->HandleAXEvent(scroll_area, | |
541 ui::AX_EVENT_VALUE_CHANGED); | |
542 | |
543 accessibility->SendPendingAccessibilityEvents(); | |
544 | |
545 const IPC::Message* message = | |
546 sink_->GetUniqueMessageMatching(AccessibilityHostMsg_Events::ID); | |
547 ASSERT_TRUE(message); | |
548 Tuple1<std::vector<AccessibilityHostMsg_EventParams> > param; | |
549 AccessibilityHostMsg_Events::Read(message, ¶m); | |
550 ASSERT_EQ(0U, param.a.size()); | |
551 } | |
552 | |
519 } // namespace content | 553 } // namespace content |
OLD | NEW |