| 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 10 matching lines...) Expand all Loading... |
| 21 TestButton() : Button(NULL) {} | 21 TestButton() : Button(NULL) {} |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 class NativeViewAccessibilityTest : public ViewsTestBase { | 26 class NativeViewAccessibilityTest : public ViewsTestBase { |
| 27 public: | 27 public: |
| 28 NativeViewAccessibilityTest() {} | 28 NativeViewAccessibilityTest() {} |
| 29 virtual ~NativeViewAccessibilityTest() {} | 29 virtual ~NativeViewAccessibilityTest() {} |
| 30 | 30 |
| 31 virtual void SetUp() OVERRIDE { | 31 virtual void SetUp() override { |
| 32 ViewsTestBase::SetUp(); | 32 ViewsTestBase::SetUp(); |
| 33 button_.reset(new TestButton()); | 33 button_.reset(new TestButton()); |
| 34 button_->SetSize(gfx::Size(20, 20)); | 34 button_->SetSize(gfx::Size(20, 20)); |
| 35 button_accessibility_ = NativeViewAccessibility::Create(button_.get()); | 35 button_accessibility_ = NativeViewAccessibility::Create(button_.get()); |
| 36 | 36 |
| 37 label_.reset(new Label); | 37 label_.reset(new Label); |
| 38 button_->AddChildView(label_.get()); | 38 button_->AddChildView(label_.get()); |
| 39 label_accessibility_ = NativeViewAccessibility::Create(label_.get()); | 39 label_accessibility_ = NativeViewAccessibility::Create(label_.get()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual void TearDown() OVERRIDE { | 42 virtual void TearDown() override { |
| 43 button_accessibility_->Destroy(); | 43 button_accessibility_->Destroy(); |
| 44 button_accessibility_ = NULL; | 44 button_accessibility_ = NULL; |
| 45 label_accessibility_->Destroy(); | 45 label_accessibility_->Destroy(); |
| 46 label_accessibility_ = NULL; | 46 label_accessibility_ = NULL; |
| 47 ViewsTestBase::TearDown(); | 47 ViewsTestBase::TearDown(); |
| 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_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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 |