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

Unified Diff: ui/views/widget/native_widget_mac_accessibility_unittest.mm

Issue 2969293002: Revert of Fix lifetime problems in AXPlatformNodeCocoa. (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_mac_accessibility_unittest.mm
diff --git a/ui/views/widget/native_widget_mac_accessibility_unittest.mm b/ui/views/widget/native_widget_mac_accessibility_unittest.mm
index 7988061f77efa2586fffa9bad4f6539daeecf5d5..d1958391749c7af098267155b7104dde4881cbf8 100644
--- a/ui/views/widget/native_widget_mac_accessibility_unittest.mm
+++ b/ui/views/widget/native_widget_mac_accessibility_unittest.mm
@@ -139,86 +139,6 @@
};
} // namespace
-
-// Test that all methods in the NSAccessibility informal protocol can be called
-// on a retained accessibility object after the source view is deleted.
-TEST_F(NativeWidgetMacAccessibilityTest, Lifetime) {
- Textfield* view = AddChildTextfield(widget()->GetContentsView()->size());
- base::scoped_nsobject<NSObject> ax_node(view->GetNativeViewAccessible(),
- base::scoped_policy::RETAIN);
-
- NSString* kAttribute = NSAccessibilityValueAttribute;
- NSString* kParamAttribute =
- NSAccessibilityStringForRangeParameterizedAttribute;
- NSString* kAction = NSAccessibilityShowMenuAction;
-
- EXPECT_TRUE(
- [[ax_node accessibilityAttributeNames] containsObject:kAttribute]);
- EXPECT_NSEQ(kTestStringValue,
- [ax_node accessibilityAttributeValue:kAttribute]);
- EXPECT_TRUE([ax_node accessibilityIsAttributeSettable:kAttribute]);
- EXPECT_TRUE([[ax_node accessibilityActionNames] containsObject:kAction]);
- EXPECT_FALSE([ax_node accessibilityIsIgnored]);
-
- // Not implemented, but be sure to update this test if it ever is.
- EXPECT_FALSE(
- [ax_node respondsToSelector:@selector(accessibilityActionDescription:)]);
-
- EXPECT_TRUE([[ax_node accessibilityParameterizedAttributeNames]
- containsObject:kParamAttribute]);
- NSValue* range = [NSValue valueWithRange:NSMakeRange(0, kTestStringLength)];
- EXPECT_NSEQ(
- kTestStringValue,
- [ax_node accessibilityAttributeValue:kParamAttribute forParameter:range]);
-
- // The following is also "not implemented", but the informal protocol category
- // provides a default implementation.
- EXPECT_EQ(NSNotFound, [ax_node accessibilityIndexOfChild:nil]);
-
- // The only usually available array attribute is AXChildren, so go up a level
- // to the Widget to test that a bit. The default implementation just gets the
- // attribute normally and returns its size (if it's an array).
- NSString* kChildren = NSAccessibilityChildrenAttribute;
- base::scoped_nsobject<NSObject> ax_parent(
- [ax_node accessibilityAttributeValue:NSAccessibilityParentAttribute],
- base::scoped_policy::RETAIN);
- EXPECT_EQ(1u, [ax_parent accessibilityArrayAttributeCount:kChildren]);
- EXPECT_EQ(
- ax_node.get(),
- [ax_parent accessibilityArrayAttributeValues:kChildren index:0
- maxCount:1][0]);
-
- // If it is not an array, the default implementation throws an exception, so
- // it's impossible to test these methods further on |ax_node|, apart from the
- // following, before deleting the view.
- EXPECT_EQ(0u, [ax_node accessibilityArrayAttributeCount:kChildren]);
-
- delete view;
-
- EXPECT_TRUE(
- [ax_node respondsToSelector:@selector(accessibilityAttributeNames)]);
- EXPECT_EQ(@[], [ax_node accessibilityAttributeNames]);
- EXPECT_EQ(nil, [ax_node accessibilityAttributeValue:kAttribute]);
- EXPECT_FALSE([ax_node accessibilityIsAttributeSettable:kAttribute]);
- [ax_node accessibilitySetValue:kTestStringValue forAttribute:kAttribute];
-
- EXPECT_EQ(@[], [ax_node accessibilityActionNames]);
- [ax_node accessibilityPerformAction:kAction];
-
- EXPECT_TRUE([ax_node accessibilityIsIgnored]);
- EXPECT_EQ(nil, [ax_node accessibilityHitTest:NSZeroPoint]);
- EXPECT_EQ(nil, [ax_node accessibilityFocusedUIElement]);
-
- EXPECT_EQ(@[], [ax_node accessibilityParameterizedAttributeNames]);
- EXPECT_NSEQ(nil, [ax_node accessibilityAttributeValue:kParamAttribute
- forParameter:range]);
-
- // Test the attributes with default implementations provided.
- EXPECT_EQ(NSNotFound, [ax_node accessibilityIndexOfChild:nil]);
-
- // The Widget is currently still around, but the child should be gone.
- EXPECT_EQ(0u, [ax_parent accessibilityArrayAttributeCount:kChildren]);
-}
// Check that potentially keyboard-focusable elements are always leaf nodes.
TEST_F(NativeWidgetMacAccessibilityTest, FocusableElementsAreLeafNodes) {
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698