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

Side by Side Diff: content/browser/accessibility/browser_accessibility_mac_unittest.mm

Issue 21269002: Make AccessibilityNodeData more compact. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows compile Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; 70 root.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA;
71 root.string_attributes[AccessibilityNodeData::ATTR_HELP] = 71 root.AddStringAttribute(AccessibilityNodeData::ATTR_HELP, "HelpText");
72 ASCIIToUTF16("HelpText");
73 root.child_ids.push_back(1001); 72 root.child_ids.push_back(1001);
74 root.child_ids.push_back(1002); 73 root.child_ids.push_back(1002);
75 74
76 AccessibilityNodeData child1; 75 AccessibilityNodeData child1;
77 child1.id = 1001; 76 child1.id = 1001;
78 child1.name = ASCIIToUTF16("Child1"); 77 child1.SetName("Child1");
79 child1.location.set_width(250); 78 child1.location.set_width(250);
80 child1.location.set_height(100); 79 child1.location.set_height(100);
81 child1.role = AccessibilityNodeData::ROLE_BUTTON; 80 child1.role = AccessibilityNodeData::ROLE_BUTTON;
82 81
83 AccessibilityNodeData child2; 82 AccessibilityNodeData child2;
84 child2.id = 1002; 83 child2.id = 1002;
85 child2.location.set_x(250); 84 child2.location.set_x(250);
86 child2.location.set_width(250); 85 child2.location.set_width(250);
87 child2.location.set_height(100); 86 child2.location.set_height(100);
88 child2.role = AccessibilityNodeData::ROLE_HEADING; 87 child2.role = AccessibilityNodeData::ROLE_HEADING;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 155
157 // Now any attributes we query should return nil. 156 // Now any attributes we query should return nil.
158 EXPECT_EQ(nil, [retainedFirstChild 157 EXPECT_EQ(nil, [retainedFirstChild
159 accessibilityAttributeValue:NSAccessibilityTitleAttribute]); 158 accessibilityAttributeValue:NSAccessibilityTitleAttribute]);
160 159
161 // Don't leak memory in the test. 160 // Don't leak memory in the test.
162 [retainedFirstChild release]; 161 [retainedFirstChild release];
163 } 162 }
164 163
165 } // namespace content 164 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698