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/accessibility/native_view_accessibility_unittest.cc

Issue 2795543002: Add GetScreenBoundsRect to ui::AXPlatformNodeDelegate (Closed)
Patch Set: Add GetScreenBoundsRect() to ui::AXPlatformNodeDelegate Created 3 years, 8 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 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 }; 86 };
87 87
88 TEST_F(NativeViewAccessibilityTest, RoleShouldMatch) { 88 TEST_F(NativeViewAccessibilityTest, RoleShouldMatch) {
89 EXPECT_EQ(ui::AX_ROLE_BUTTON, button_accessibility()->GetData().role); 89 EXPECT_EQ(ui::AX_ROLE_BUTTON, button_accessibility()->GetData().role);
90 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, label_accessibility()->GetData().role); 90 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, label_accessibility()->GetData().role);
91 } 91 }
92 92
93 TEST_F(NativeViewAccessibilityTest, BoundsShouldMatch) { 93 TEST_F(NativeViewAccessibilityTest, BoundsShouldMatch) {
94 gfx::Rect bounds = 94 gfx::Rect bounds =
95 gfx::ToEnclosingRect(button_accessibility()->GetData().location); 95 gfx::ToEnclosingRect(button_accessibility()->GetData().location);
96 bounds.Offset(button_accessibility()->GetGlobalCoordinateOffset()); 96 gfx::Rect screen_bounds = button_accessibility()->GetScreenBoundsRect();
97
97 EXPECT_EQ(button_->GetBoundsInScreen(), bounds); 98 EXPECT_EQ(button_->GetBoundsInScreen(), bounds);
99 EXPECT_EQ(screen_bounds, bounds);
98 } 100 }
99 101
100 TEST_F(NativeViewAccessibilityTest, LabelIsChildOfButton) { 102 TEST_F(NativeViewAccessibilityTest, LabelIsChildOfButton) {
101 EXPECT_EQ(1, button_accessibility()->GetChildCount()); 103 EXPECT_EQ(1, button_accessibility()->GetChildCount());
102 EXPECT_EQ(label_->GetNativeViewAccessible(), 104 EXPECT_EQ(label_->GetNativeViewAccessible(),
103 button_accessibility()->ChildAtIndex(0)); 105 button_accessibility()->ChildAtIndex(0));
104 EXPECT_EQ(button_->GetNativeViewAccessible(), 106 EXPECT_EQ(button_->GetNativeViewAccessible(),
105 label_accessibility()->GetParent()); 107 label_accessibility()->GetParent());
106 } 108 }
107 109
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // During the destruction of parent, OnBlur will be called and change the 234 // During the destruction of parent, OnBlur will be called and change the
233 // visibility to false. 235 // visibility to false.
234 parent->SetVisible(true); 236 parent->SetVisible(true);
235 AXAuraObjCache* ax = AXAuraObjCache::GetInstance(); 237 AXAuraObjCache* ax = AXAuraObjCache::GetInstance();
236 ax->GetOrCreate(widget.get()); 238 ax->GetOrCreate(widget.get());
237 } 239 }
238 #endif 240 #endif
239 241
240 } // namespace test 242 } // namespace test
241 } // namespace views 243 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698