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

Side by Side Diff: ui/views/widget/native_widget_mac_unittest.mm

Issue 2119413004: a11y: Exclude children of nested keyboard accessible controls from a11y tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Before revert of cross-platform ignored a11y elements. 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/native_widget_mac_accessibility_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "ui/views/widget/native_widget_mac.h" 5 #import "ui/views/widget/native_widget_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/foundation_util.h" 9 #import "base/mac/foundation_util.h"
10 #import "base/mac/scoped_nsautorelease_pool.h" 10 #import "base/mac/scoped_nsautorelease_pool.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 // Tests that an accessibility request from the system makes its way through to 645 // Tests that an accessibility request from the system makes its way through to
646 // a views::Label filling the window. 646 // a views::Label filling the window.
647 TEST_F(NativeWidgetMacTest, AccessibilityIntegration) { 647 TEST_F(NativeWidgetMacTest, AccessibilityIntegration) {
648 Widget* widget = CreateTopLevelPlatformWidget(); 648 Widget* widget = CreateTopLevelPlatformWidget();
649 gfx::Rect screen_rect(50, 50, 100, 100); 649 gfx::Rect screen_rect(50, 50, 100, 100);
650 widget->SetBounds(screen_rect); 650 widget->SetBounds(screen_rect);
651 651
652 const base::string16 test_string = base::ASCIIToUTF16("Green"); 652 const base::string16 test_string = base::ASCIIToUTF16("Green");
653 views::Label* label = new views::Label(test_string); 653 views::Label* label = new views::Label(test_string);
654 label->SetBounds(0, 0, 100, 100); 654 label->SetBounds(0, 0, 100, 100);
655 label->SetFocusBehavior(ClientView::FocusBehavior::ACCESSIBLE_ONLY);
655 widget->GetContentsView()->AddChildView(label); 656 widget->GetContentsView()->AddChildView(label);
656 widget->Show(); 657 widget->Show();
657 658
658 // Accessibility hit tests come in Cocoa screen coordinates. 659 // Accessibility hit tests come in Cocoa screen coordinates.
659 NSRect nsrect = gfx::ScreenRectToNSRect(screen_rect); 660 NSRect nsrect = gfx::ScreenRectToNSRect(screen_rect);
660 NSPoint midpoint = NSMakePoint(NSMidX(nsrect), NSMidY(nsrect)); 661 NSPoint midpoint = NSMakePoint(NSMidX(nsrect), NSMidY(nsrect));
661 662
662 id hit = [widget->GetNativeWindow() accessibilityHitTest:midpoint]; 663 id hit = [widget->GetNativeWindow() accessibilityHitTest:midpoint];
663 id title = [hit accessibilityAttributeValue:NSAccessibilityTitleAttribute]; 664 id title = [hit accessibilityAttributeValue:NSAccessibilityTitleAttribute];
664 EXPECT_NSEQ(title, @"Green"); 665 EXPECT_NSEQ(@"Green", title);
665 666
666 widget->CloseNow(); 667 widget->CloseNow();
667 } 668 }
668 669
669 // Tests creating a views::Widget parented off a native NSWindow. 670 // Tests creating a views::Widget parented off a native NSWindow.
670 TEST_F(NativeWidgetMacTest, NonWidgetParent) { 671 TEST_F(NativeWidgetMacTest, NonWidgetParent) {
671 NSWindow* native_parent = MakeNativeParent(); 672 NSWindow* native_parent = MakeNativeParent();
672 673
673 base::scoped_nsobject<NSView> anchor_view( 674 base::scoped_nsobject<NSView> anchor_view(
674 [[NSView alloc] initWithFrame:[[native_parent contentView] bounds]]); 675 [[NSView alloc] initWithFrame:[[native_parent contentView] bounds]]);
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 1794
1794 - (void)dealloc { 1795 - (void)dealloc {
1795 if (deallocFlag_) { 1796 if (deallocFlag_) {
1796 DCHECK(!*deallocFlag_); 1797 DCHECK(!*deallocFlag_);
1797 *deallocFlag_ = true; 1798 *deallocFlag_ = true;
1798 } 1799 }
1799 [super dealloc]; 1800 [super dealloc];
1800 } 1801 }
1801 1802
1802 @end 1803 @end
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_mac_accessibility_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698