| 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/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "ui/accessibility/ax_node_data.h" | 7 #include "ui/accessibility/ax_node_data.h" |
| 8 #include "ui/gfx/geometry/rect_conversions.h" | 8 #include "ui/gfx/geometry/rect_conversions.h" |
| 9 #include "ui/views/accessibility/ax_aura_obj_cache.h" | 9 #include "ui/views/accessibility/ax_aura_obj_cache.h" |
| 10 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" | 10 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 TEST_F(NativeViewAccessibilityTest, RoleShouldMatch) { | 81 TEST_F(NativeViewAccessibilityTest, RoleShouldMatch) { |
| 82 EXPECT_EQ(ui::AX_ROLE_BUTTON, button_accessibility()->GetData().role); | 82 EXPECT_EQ(ui::AX_ROLE_BUTTON, button_accessibility()->GetData().role); |
| 83 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, label_accessibility()->GetData().role); | 83 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, label_accessibility()->GetData().role); |
| 84 } | 84 } |
| 85 | 85 |
| 86 TEST_F(NativeViewAccessibilityTest, BoundsShouldMatch) { | 86 TEST_F(NativeViewAccessibilityTest, BoundsShouldMatch) { |
| 87 gfx::Rect bounds = | 87 gfx::Rect bounds = |
| 88 gfx::ToEnclosingRect(button_accessibility()->GetData().location); | 88 gfx::ToEnclosingRect(button_accessibility()->GetData().location); |
| 89 bounds.Offset(button_accessibility()->GetGlobalCoordinateOffset()); | 89 gfx::Rect screen_bounds = button_accessibility()->GetScreenBoundsRect(); |
| 90 bounds.Offset(screen_bounds.x(), screen_bounds.y()); |
| 91 |
| 90 EXPECT_EQ(button_->GetBoundsInScreen(), bounds); | 92 EXPECT_EQ(button_->GetBoundsInScreen(), bounds); |
| 91 } | 93 } |
| 92 | 94 |
| 93 TEST_F(NativeViewAccessibilityTest, LabelIsChildOfButton) { | 95 TEST_F(NativeViewAccessibilityTest, LabelIsChildOfButton) { |
| 94 EXPECT_EQ(1, button_accessibility()->GetChildCount()); | 96 EXPECT_EQ(1, button_accessibility()->GetChildCount()); |
| 95 EXPECT_EQ(label_->GetNativeViewAccessible(), | 97 EXPECT_EQ(label_->GetNativeViewAccessible(), |
| 96 button_accessibility()->ChildAtIndex(0)); | 98 button_accessibility()->ChildAtIndex(0)); |
| 97 EXPECT_EQ(button_->GetNativeViewAccessible(), | 99 EXPECT_EQ(button_->GetNativeViewAccessible(), |
| 98 label_accessibility()->GetParent()); | 100 label_accessibility()->GetParent()); |
| 99 } | 101 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // During the destruction of parent, OnBlur will be called and change the | 227 // During the destruction of parent, OnBlur will be called and change the |
| 226 // visibility to false. | 228 // visibility to false. |
| 227 parent->SetVisible(true); | 229 parent->SetVisible(true); |
| 228 AXAuraObjCache* ax = AXAuraObjCache::GetInstance(); | 230 AXAuraObjCache* ax = AXAuraObjCache::GetInstance(); |
| 229 ax->GetOrCreate(widget.get()); | 231 ax->GetOrCreate(widget.get()); |
| 230 } | 232 } |
| 231 #endif | 233 #endif |
| 232 | 234 |
| 233 } // namespace test | 235 } // namespace test |
| 234 } // namespace views | 236 } // namespace views |
| OLD | NEW |