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

Side by Side Diff: ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Revert comment. Created 3 years, 7 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 "ui/views/controls/tabbed_pane/tabbed_pane.h" 5 #include "ui/views/controls/tabbed_pane/tabbed_pane.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Check the first tab is selected. 156 // Check the first tab is selected.
157 EXPECT_EQ(0, tabbed_pane_->GetSelectedTabIndex()); 157 EXPECT_EQ(0, tabbed_pane_->GetSelectedTabIndex());
158 158
159 // Check the a11y information for each tab. 159 // Check the a11y information for each tab.
160 for (int i = 0; i < kNumTabs; ++i) { 160 for (int i = 0; i < kNumTabs; ++i) {
161 ui::AXNodeData data; 161 ui::AXNodeData data;
162 162
163 // AXViewObjWrapper::Serialize() and NativeViewAccessibilityBase::GetData() 163 // AXViewObjWrapper::Serialize() and NativeViewAccessibilityBase::GetData()
164 // are normally responsible for clearing the state from the default 164 // are normally responsible for clearing the state from the default
165 // AXNodeData constructor. Do the same here. 165 // AXNodeData constructor. Do the same here.
166 data.state = 0; 166 data.ClearBitfields();
167 167
168 GetTabAt(i)->GetAccessibleNodeData(&data); 168 GetTabAt(i)->GetAccessibleNodeData(&data);
169 SCOPED_TRACE(testing::Message() << "Tab at index: " << i); 169 SCOPED_TRACE(testing::Message() << "Tab at index: " << i);
170 EXPECT_EQ(ui::AX_ROLE_TAB, data.role); 170 EXPECT_EQ(ui::AX_ROLE_TAB, data.role);
171 EXPECT_EQ(DefaultTabTitle(), data.GetString16Attribute(ui::AX_ATTR_NAME)); 171 EXPECT_EQ(DefaultTabTitle(), data.GetString16Attribute(ui::AX_ATTR_NAME));
172 EXPECT_TRUE(data.HasStateFlag(ui::AX_STATE_SELECTABLE)); 172 EXPECT_TRUE(data.HasState(ui::AX_STATE_SELECTABLE));
173 EXPECT_EQ(i == 0, data.HasStateFlag(ui::AX_STATE_SELECTED)); 173 EXPECT_EQ(i == 0, data.HasState(ui::AX_STATE_SELECTED));
174 } 174 }
175 175
176 ui::AXActionData action; 176 ui::AXActionData action;
177 action.action = ui::AX_ACTION_SET_SELECTION; 177 action.action = ui::AX_ACTION_SET_SELECTION;
178 // Select the first tab. 178 // Select the first tab.
179 179
180 GetTabAt(0)->HandleAccessibleAction(action); 180 GetTabAt(0)->HandleAccessibleAction(action);
181 EXPECT_EQ(0, tabbed_pane_->GetSelectedTabIndex()); 181 EXPECT_EQ(0, tabbed_pane_->GetSelectedTabIndex());
182 182
183 // Select the second tab. 183 // Select the second tab.
184 GetTabAt(1)->HandleAccessibleAction(action); 184 GetTabAt(1)->HandleAccessibleAction(action);
185 EXPECT_EQ(1, tabbed_pane_->GetSelectedTabIndex()); 185 EXPECT_EQ(1, tabbed_pane_->GetSelectedTabIndex());
186 // Select the second tab again. 186 // Select the second tab again.
187 GetTabAt(1)->HandleAccessibleAction(action); 187 GetTabAt(1)->HandleAccessibleAction(action);
188 EXPECT_EQ(1, tabbed_pane_->GetSelectedTabIndex()); 188 EXPECT_EQ(1, tabbed_pane_->GetSelectedTabIndex());
189 189
190 widget->CloseNow(); 190 widget->CloseNow();
191 } 191 }
192 192
193 } // namespace test 193 } // namespace test
194 } // namespace views 194 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698