OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 @end | 45 @end |
46 | 46 |
47 | 47 |
48 class BrowserAccessibilityTest : public CocoaTest { | 48 class BrowserAccessibilityTest : public CocoaTest { |
49 public: | 49 public: |
50 virtual void SetUp() { | 50 virtual void SetUp() { |
51 CocoaTest::SetUp(); | 51 CocoaTest::SetUp(); |
52 WebAccessibility root; | 52 WebAccessibility root; |
| 53 root.id = 1000; |
53 root.location.set_width(500); | 54 root.location.set_width(500); |
54 root.location.set_height(100); | 55 root.location.set_height(100); |
55 root.role = WebAccessibility::ROLE_WEB_AREA; | 56 root.role = WebAccessibility::ROLE_WEB_AREA; |
56 root.string_attributes[WebAccessibility::ATTR_HELP] = | 57 root.string_attributes[WebAccessibility::ATTR_HELP] = |
57 ASCIIToUTF16("HelpText"); | 58 ASCIIToUTF16("HelpText"); |
58 | 59 |
59 WebAccessibility child1; | 60 WebAccessibility child1; |
| 61 child1.id = 1001; |
60 child1.name = ASCIIToUTF16("Child1"); | 62 child1.name = ASCIIToUTF16("Child1"); |
61 child1.location.set_width(250); | 63 child1.location.set_width(250); |
62 child1.location.set_height(100); | 64 child1.location.set_height(100); |
63 child1.role = WebAccessibility::ROLE_BUTTON; | 65 child1.role = WebAccessibility::ROLE_BUTTON; |
64 | 66 |
65 WebAccessibility child2; | 67 WebAccessibility child2; |
| 68 child2.id = 1002; |
66 child2.location.set_x(250); | 69 child2.location.set_x(250); |
67 child2.location.set_width(250); | 70 child2.location.set_width(250); |
68 child2.location.set_height(100); | 71 child2.location.set_height(100); |
69 child2.role = WebAccessibility::ROLE_HEADING; | 72 child2.role = WebAccessibility::ROLE_HEADING; |
70 | 73 |
71 root.children.push_back(child1); | 74 root.children.push_back(child1); |
72 root.children.push_back(child2); | 75 root.children.push_back(child2); |
73 | 76 |
74 delegate_.reset([[MockAccessibilityDelegate alloc] init]); | 77 delegate_.reset([[MockAccessibilityDelegate alloc] init]); |
75 manager_.reset( | 78 manager_.reset( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 accessibilityAttributeValue:NSAccessibilityHelpAttribute]; | 118 accessibilityAttributeValue:NSAccessibilityHelpAttribute]; |
116 EXPECT_NSEQ(@"HelpText", helpText); | 119 EXPECT_NSEQ(@"HelpText", helpText); |
117 } | 120 } |
118 | 121 |
119 // Test querying for an invalid attribute to ensure it doesn't crash. | 122 // Test querying for an invalid attribute to ensure it doesn't crash. |
120 TEST_F(BrowserAccessibilityTest, InvalidAttributeTest) { | 123 TEST_F(BrowserAccessibilityTest, InvalidAttributeTest) { |
121 NSString* shouldBeNil = [accessibility_ | 124 NSString* shouldBeNil = [accessibility_ |
122 accessibilityAttributeValue:@"NSAnInvalidAttribute"]; | 125 accessibilityAttributeValue:@"NSAnInvalidAttribute"]; |
123 EXPECT_TRUE(shouldBeNil == nil); | 126 EXPECT_TRUE(shouldBeNil == nil); |
124 } | 127 } |
OLD | NEW |