| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/accessibility/ax_view_state.h" | 6 #include "ui/accessibility/ax_view_state.h" |
| 7 #include "ui/views/accessibility/native_view_accessibility.h" | 7 #include "ui/views/accessibility/native_view_accessibility.h" |
| 8 #include "ui/views/controls/button/button.h" | 8 #include "ui/views/controls/button/button.h" |
| 9 #include "ui/views/controls/label.h" | 9 #include "ui/views/controls/label.h" |
| 10 #include "ui/views/test/views_test_base.h" | 10 #include "ui/views/test/views_test_base.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 scoped_ptr<TestButton> button_; | 51 scoped_ptr<TestButton> button_; |
| 52 NativeViewAccessibility* button_accessibility_; | 52 NativeViewAccessibility* button_accessibility_; |
| 53 scoped_ptr<Label> label_; | 53 scoped_ptr<Label> label_; |
| 54 NativeViewAccessibility* label_accessibility_; | 54 NativeViewAccessibility* label_accessibility_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 TEST_F(NativeViewAccessibilityTest, RoleShouldMatch) { | 57 TEST_F(NativeViewAccessibilityTest, RoleShouldMatch) { |
| 58 EXPECT_EQ(ui::AX_ROLE_BUTTON, button_accessibility_->GetData().role); | 58 EXPECT_EQ(ui::AX_ROLE_BUTTON, button_accessibility_->GetData()->role); |
| 59 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, label_accessibility_->GetData().role); | 59 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, label_accessibility_->GetData()->role); |
| 60 } | 60 } |
| 61 | 61 |
| 62 TEST_F(NativeViewAccessibilityTest, BoundsShouldMatch) { | 62 TEST_F(NativeViewAccessibilityTest, BoundsShouldMatch) { |
| 63 gfx::Rect bounds = button_accessibility_->GetData().location; | 63 gfx::Rect bounds = button_accessibility_->GetData()->location; |
| 64 bounds.Offset(button_accessibility_->GetGlobalCoordinateOffset()); | 64 bounds.Offset(button_accessibility_->GetGlobalCoordinateOffset()); |
| 65 EXPECT_EQ(button_->GetBoundsInScreen(), bounds); | 65 EXPECT_EQ(button_->GetBoundsInScreen(), bounds); |
| 66 } | 66 } |
| 67 | 67 |
| 68 TEST_F(NativeViewAccessibilityTest, LabelIsChildOfButton) { | 68 TEST_F(NativeViewAccessibilityTest, LabelIsChildOfButton) { |
| 69 EXPECT_EQ(1, button_accessibility_->GetChildCount()); | 69 EXPECT_EQ(1, button_accessibility_->GetChildCount()); |
| 70 EXPECT_EQ(label_->GetNativeViewAccessible(), | 70 EXPECT_EQ(label_->GetNativeViewAccessible(), |
| 71 button_accessibility_->ChildAtIndex(0)); | 71 button_accessibility_->ChildAtIndex(0)); |
| 72 EXPECT_EQ(button_->GetNativeViewAccessible(), | 72 EXPECT_EQ(button_->GetNativeViewAccessible(), |
| 73 label_accessibility_->GetParent()); | 73 label_accessibility_->GetParent()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace test | 76 } // namespace test |
| 77 } // namespace views | 77 } // namespace views |
| OLD | NEW |