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

Side by Side Diff: content/renderer/accessibility/renderer_accessibility_browsertest.cc

Issue 145283003: Switch AccessibilityMode to be a bitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src@enable
Patch Set: Created 6 years, 11 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
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/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "content/common/view_messages.h" 6 #include "content/common/view_messages.h"
7 #include "content/public/test/render_view_test.h" 7 #include "content/public/test/render_view_test.h"
8 #include "content/renderer/accessibility/renderer_accessibility_complete.h" 8 #include "content/renderer/accessibility/renderer_accessibility_complete.h"
9 #include "content/renderer/render_view_impl.h" 9 #include "content/renderer/render_view_impl.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 RenderViewImpl* view() { 61 RenderViewImpl* view() {
62 return static_cast<RenderViewImpl*>(view_); 62 return static_cast<RenderViewImpl*>(view_);
63 } 63 }
64 64
65 virtual void SetUp() { 65 virtual void SetUp() {
66 RenderViewTest::SetUp(); 66 RenderViewTest::SetUp();
67 sink_ = &render_thread_->sink(); 67 sink_ = &render_thread_->sink();
68 } 68 }
69 69
70 void SetMode(AccessibilityMode mode) { 70 void SetMode(unsigned int mode) {
71 view()->OnSetAccessibilityMode(mode); 71 view()->OnSetAccessibilityMode(mode);
72 } 72 }
73 73
74 void GetLastAccEvent( 74 void GetLastAccEvent(
75 AccessibilityHostMsg_EventParams* params) { 75 AccessibilityHostMsg_EventParams* params) {
76 const IPC::Message* message = 76 const IPC::Message* message =
77 sink_->GetUniqueMessageMatching(AccessibilityHostMsg_Events::ID); 77 sink_->GetUniqueMessageMatching(AccessibilityHostMsg_Events::ID);
78 ASSERT_TRUE(message); 78 ASSERT_TRUE(message);
79 Tuple1<std::vector<AccessibilityHostMsg_EventParams> > param; 79 Tuple1<std::vector<AccessibilityHostMsg_EventParams> > param;
80 AccessibilityHostMsg_Events::Read(message, &param); 80 AccessibilityHostMsg_Events::Read(message, &param);
(...skipping 11 matching lines...) Expand all
92 IPC::TestSink* sink_; 92 IPC::TestSink* sink_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityTest); 94 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityTest);
95 }; 95 };
96 96
97 TEST_F(RendererAccessibilityTest, EditableTextModeFocusEvents) { 97 TEST_F(RendererAccessibilityTest, EditableTextModeFocusEvents) {
98 // This is not a test of true web accessibility, it's a test of 98 // This is not a test of true web accessibility, it's a test of
99 // a mode used on Windows 8 in Metro mode where an extremely simplified 99 // a mode used on Windows 8 in Metro mode where an extremely simplified
100 // accessibility tree containing only the current focused node is 100 // accessibility tree containing only the current focused node is
101 // generated. 101 // generated.
102 SetMode(AccessibilityModeEditableTextOnly); 102 SetMode(AccessibilityModeFlagRenderer &
103 AccessibilityModeFlagEditableTextOnly);
103 104
104 // Set a minimum size and give focus so simulated events work. 105 // Set a minimum size and give focus so simulated events work.
105 view()->webwidget()->resize(blink::WebSize(500, 500)); 106 view()->webwidget()->resize(blink::WebSize(500, 500));
106 view()->webwidget()->setFocus(true); 107 view()->webwidget()->setFocus(true);
107 108
108 std::string html = 109 std::string html =
109 "<body>" 110 "<body>"
110 " <input>" 111 " <input>"
111 " <textarea></textarea>" 112 " <textarea></textarea>"
112 " <p contentEditable>Editable</p>" 113 " <p contentEditable>Editable</p>"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 GetLastAccEvent(&event); 533 GetLastAccEvent(&event);
533 ASSERT_EQ(5U, event.nodes.size()); 534 ASSERT_EQ(5U, event.nodes.size());
534 535
535 EXPECT_EQ(body.axID(), event.nodes[0].id); 536 EXPECT_EQ(body.axID(), event.nodes[0].id);
536 EXPECT_EQ(text_1.axID(), event.nodes[1].id); 537 EXPECT_EQ(text_1.axID(), event.nodes[1].id);
537 // The third event is to update text_2, but its id changes 538 // The third event is to update text_2, but its id changes
538 // so we don't have a test expectation for it. 539 // so we don't have a test expectation for it.
539 } 540 }
540 541
541 } // namespace content 542 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698