| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 class BrowserAccessibilityTest : public ui::CocoaTest { | 58 class BrowserAccessibilityTest : public ui::CocoaTest { |
| 59 public: | 59 public: |
| 60 virtual void SetUp() { | 60 virtual void SetUp() { |
| 61 CocoaTest::SetUp(); | 61 CocoaTest::SetUp(); |
| 62 RebuildAccessibilityTree(); | 62 RebuildAccessibilityTree(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 void RebuildAccessibilityTree() { | 66 void RebuildAccessibilityTree() { |
| 67 AccessibilityNodeData root; | 67 ui::AXNodeData root; |
| 68 root.id = 1000; | 68 root.id = 1000; |
| 69 root.location.set_width(500); | 69 root.location.set_width(500); |
| 70 root.location.set_height(100); | 70 root.location.set_height(100); |
| 71 root.role = blink::WebAXRoleRootWebArea; | 71 root.role = ui::AX_ROLE_ROOT_WEB_AREA; |
| 72 root.AddStringAttribute(AccessibilityNodeData::ATTR_HELP, "HelpText"); | 72 root.AddStringAttribute(ui::AX_ATTR_HELP, "HelpText"); |
| 73 root.child_ids.push_back(1001); | 73 root.child_ids.push_back(1001); |
| 74 root.child_ids.push_back(1002); | 74 root.child_ids.push_back(1002); |
| 75 | 75 |
| 76 AccessibilityNodeData child1; | 76 ui::AXNodeData child1; |
| 77 child1.id = 1001; | 77 child1.id = 1001; |
| 78 child1.SetName("Child1"); | 78 child1.SetName("Child1"); |
| 79 child1.location.set_width(250); | 79 child1.location.set_width(250); |
| 80 child1.location.set_height(100); | 80 child1.location.set_height(100); |
| 81 child1.role = blink::WebAXRoleButton; | 81 child1.role = ui::AX_ROLE_BUTTON; |
| 82 | 82 |
| 83 AccessibilityNodeData child2; | 83 ui::AXNodeData child2; |
| 84 child2.id = 1002; | 84 child2.id = 1002; |
| 85 child2.location.set_x(250); | 85 child2.location.set_x(250); |
| 86 child2.location.set_width(250); | 86 child2.location.set_width(250); |
| 87 child2.location.set_height(100); | 87 child2.location.set_height(100); |
| 88 child2.role = blink::WebAXRoleHeading; | 88 child2.role = ui::AX_ROLE_HEADING; |
| 89 | 89 |
| 90 delegate_.reset([[MockAccessibilityDelegate alloc] init]); | 90 delegate_.reset([[MockAccessibilityDelegate alloc] init]); |
| 91 manager_.reset( | 91 manager_.reset( |
| 92 new BrowserAccessibilityManagerMac(delegate_, root, NULL)); | 92 new BrowserAccessibilityManagerMac(delegate_, root, NULL)); |
| 93 manager_->UpdateNodesForTesting(child1, child2); | 93 manager_->UpdateNodesForTesting(child1, child2); |
| 94 accessibility_.reset([manager_->GetRoot()->ToBrowserAccessibilityCocoa() | 94 accessibility_.reset([manager_->GetRoot()->ToBrowserAccessibilityCocoa() |
| 95 retain]); | 95 retain]); |
| 96 } | 96 } |
| 97 | 97 |
| 98 base::scoped_nsobject<MockAccessibilityDelegate> delegate_; | 98 base::scoped_nsobject<MockAccessibilityDelegate> delegate_; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 // Now any attributes we query should return nil. | 156 // Now any attributes we query should return nil. |
| 157 EXPECT_EQ(nil, [retainedFirstChild | 157 EXPECT_EQ(nil, [retainedFirstChild |
| 158 accessibilityAttributeValue:NSAccessibilityTitleAttribute]); | 158 accessibilityAttributeValue:NSAccessibilityTitleAttribute]); |
| 159 | 159 |
| 160 // Don't leak memory in the test. | 160 // Don't leak memory in the test. |
| 161 [retainedFirstChild release]; | 161 [retainedFirstChild release]; |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace content | 164 } // namespace content |
| OLD | NEW |