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

Unified Diff: ui/views/controls/button/label_button_unittest.cc

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/image_button.cc ('k') | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/label_button_unittest.cc
diff --git a/ui/views/controls/button/label_button_unittest.cc b/ui/views/controls/button/label_button_unittest.cc
index 5df8d44839116eaea29a2a7d3f9937536d3a5bf9..4696e7353d9ac00849110b5368e9adf0ae785d5e 100644
--- a/ui/views/controls/button/label_button_unittest.cc
+++ b/ui/views/controls/button/label_button_unittest.cc
@@ -8,7 +8,7 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/accessibility/ax_view_state.h"
+#include "ui/accessibility/ax_node_data.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/test/material_design_controller_test_api.h"
#include "ui/base/ui_base_switches.h"
@@ -128,10 +128,10 @@ TEST_F(LabelButtonTest, Init) {
EXPECT_EQ(text, button.GetText());
- ui::AXViewState accessible_state;
- button.GetAccessibleState(&accessible_state);
- EXPECT_EQ(ui::AX_ROLE_BUTTON, accessible_state.role);
- EXPECT_EQ(text, accessible_state.name);
+ ui::AXNodeData accessible_node_data;
+ button.GetAccessibleNodeData(&accessible_node_data);
+ EXPECT_EQ(ui::AX_ROLE_BUTTON, accessible_node_data.role);
+ EXPECT_EQ(text, accessible_node_data.GetString16Attribute(ui::AX_ATTR_NAME));
EXPECT_FALSE(button.is_default());
EXPECT_EQ(button.style(), Button::STYLE_TEXTBUTTON);
@@ -171,27 +171,31 @@ TEST_F(LabelButtonTest, Label) {
EXPECT_LT(button_->GetPreferredSize().width(), long_text_width);
}
-// Test behavior of View::GetAccessibleState() for buttons when setting a label.
+// Test behavior of View::GetAccessibleNodeData() for buttons when setting a
+// label.
TEST_F(LabelButtonTest, AccessibleState) {
- ui::AXViewState accessible_state;
+ ui::AXNodeData accessible_node_data;
- button_->GetAccessibleState(&accessible_state);
- EXPECT_EQ(ui::AX_ROLE_BUTTON, accessible_state.role);
- EXPECT_EQ(base::string16(), accessible_state.name);
+ button_->GetAccessibleNodeData(&accessible_node_data);
+ EXPECT_EQ(ui::AX_ROLE_BUTTON, accessible_node_data.role);
+ EXPECT_EQ(base::string16(),
+ accessible_node_data.GetString16Attribute(ui::AX_ATTR_NAME));
// Without a label (e.g. image-only), the accessible name should automatically
// be set from the tooltip.
const base::string16 tooltip_text = ASCIIToUTF16("abc");
button_->SetTooltipText(tooltip_text);
- button_->GetAccessibleState(&accessible_state);
- EXPECT_EQ(tooltip_text, accessible_state.name);
+ button_->GetAccessibleNodeData(&accessible_node_data);
+ EXPECT_EQ(tooltip_text,
+ accessible_node_data.GetString16Attribute(ui::AX_ATTR_NAME));
EXPECT_EQ(base::string16(), button_->GetText());
// Setting a label overrides the tooltip text.
const base::string16 label_text = ASCIIToUTF16("def");
button_->SetText(label_text);
- button_->GetAccessibleState(&accessible_state);
- EXPECT_EQ(label_text, accessible_state.name);
+ button_->GetAccessibleNodeData(&accessible_node_data);
+ EXPECT_EQ(label_text,
+ accessible_node_data.GetString16Attribute(ui::AX_ATTR_NAME));
EXPECT_EQ(label_text, button_->GetText());
base::string16 tooltip;
« no previous file with comments | « ui/views/controls/button/image_button.cc ('k') | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698