OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/accessibility/browser_accessibility_cocoa.h" | 10 #include "content/browser/accessibility/browser_accessibility_cocoa.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 CocoaTest::SetUp(); | 60 CocoaTest::SetUp(); |
61 RebuildAccessibilityTree(); | 61 RebuildAccessibilityTree(); |
62 } | 62 } |
63 | 63 |
64 protected: | 64 protected: |
65 void RebuildAccessibilityTree() { | 65 void RebuildAccessibilityTree() { |
66 AccessibilityNodeData root; | 66 AccessibilityNodeData root; |
67 root.id = 1000; | 67 root.id = 1000; |
68 root.location.set_width(500); | 68 root.location.set_width(500); |
69 root.location.set_height(100); | 69 root.location.set_height(100); |
70 root.role = WebKit::WebAXRoleRootWebArea; | 70 root.role = blink::WebAXRoleRootWebArea; |
71 root.AddStringAttribute(AccessibilityNodeData::ATTR_HELP, "HelpText"); | 71 root.AddStringAttribute(AccessibilityNodeData::ATTR_HELP, "HelpText"); |
72 root.child_ids.push_back(1001); | 72 root.child_ids.push_back(1001); |
73 root.child_ids.push_back(1002); | 73 root.child_ids.push_back(1002); |
74 | 74 |
75 AccessibilityNodeData child1; | 75 AccessibilityNodeData child1; |
76 child1.id = 1001; | 76 child1.id = 1001; |
77 child1.SetName("Child1"); | 77 child1.SetName("Child1"); |
78 child1.location.set_width(250); | 78 child1.location.set_width(250); |
79 child1.location.set_height(100); | 79 child1.location.set_height(100); |
80 child1.role = WebKit::WebAXRoleButton; | 80 child1.role = blink::WebAXRoleButton; |
81 | 81 |
82 AccessibilityNodeData child2; | 82 AccessibilityNodeData child2; |
83 child2.id = 1002; | 83 child2.id = 1002; |
84 child2.location.set_x(250); | 84 child2.location.set_x(250); |
85 child2.location.set_width(250); | 85 child2.location.set_width(250); |
86 child2.location.set_height(100); | 86 child2.location.set_height(100); |
87 child2.role = WebKit::WebAXRoleHeading; | 87 child2.role = blink::WebAXRoleHeading; |
88 | 88 |
89 delegate_.reset([[MockAccessibilityDelegate alloc] init]); | 89 delegate_.reset([[MockAccessibilityDelegate alloc] init]); |
90 manager_.reset( | 90 manager_.reset( |
91 new BrowserAccessibilityManagerMac(delegate_, root, NULL)); | 91 new BrowserAccessibilityManagerMac(delegate_, root, NULL)); |
92 manager_->UpdateNodesForTesting(child1, child2); | 92 manager_->UpdateNodesForTesting(child1, child2); |
93 accessibility_.reset([manager_->GetRoot()->ToBrowserAccessibilityCocoa() | 93 accessibility_.reset([manager_->GetRoot()->ToBrowserAccessibilityCocoa() |
94 retain]); | 94 retain]); |
95 } | 95 } |
96 | 96 |
97 base::scoped_nsobject<MockAccessibilityDelegate> delegate_; | 97 base::scoped_nsobject<MockAccessibilityDelegate> delegate_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 // Now any attributes we query should return nil. | 155 // Now any attributes we query should return nil. |
156 EXPECT_EQ(nil, [retainedFirstChild | 156 EXPECT_EQ(nil, [retainedFirstChild |
157 accessibilityAttributeValue:NSAccessibilityTitleAttribute]); | 157 accessibilityAttributeValue:NSAccessibilityTitleAttribute]); |
158 | 158 |
159 // Don't leak memory in the test. | 159 // Don't leak memory in the test. |
160 [retainedFirstChild release]; | 160 [retainedFirstChild release]; |
161 } | 161 } |
162 | 162 |
163 } // namespace content | 163 } // namespace content |
OLD | NEW |