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

Side by Side Diff: content/renderer/accessibility/renderer_accessibility_browsertest.cc

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | content/renderer/android/email_detector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "base/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/common/accessibility_messages.h" 9 #include "content/common/accessibility_messages.h"
10 #include "content/common/frame_messages.h" 10 #include "content/common/frame_messages.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 std::string html = 109 std::string html =
110 "<body>" 110 "<body>"
111 " <div role='group' id='A'>" 111 " <div role='group' id='A'>"
112 " <div role='group' id='A1'></div>" 112 " <div role='group' id='A1'></div>"
113 " <div role='group' id='A2'></div>" 113 " <div role='group' id='A2'></div>"
114 " </div>" 114 " </div>"
115 "</body>"; 115 "</body>";
116 LoadHTML(html.c_str()); 116 LoadHTML(html.c_str());
117 117
118 // Creating a RendererAccessibility should sent the tree to the browser. 118 // Creating a RendererAccessibility should sent the tree to the browser.
119 scoped_ptr<TestRendererAccessibility> accessibility( 119 std::unique_ptr<TestRendererAccessibility> accessibility(
120 new TestRendererAccessibility(frame())); 120 new TestRendererAccessibility(frame()));
121 accessibility->SendPendingAccessibilityEvents(); 121 accessibility->SendPendingAccessibilityEvents();
122 EXPECT_EQ(4, CountAccessibilityNodesSentToBrowser()); 122 EXPECT_EQ(4, CountAccessibilityNodesSentToBrowser());
123 123
124 // If we post another event but the tree doesn't change, 124 // If we post another event but the tree doesn't change,
125 // we should only send 1 node to the browser. 125 // we should only send 1 node to the browser.
126 sink_->ClearMessages(); 126 sink_->ClearMessages();
127 WebDocument document = view()->GetWebView()->mainFrame()->document(); 127 WebDocument document = view()->GetWebView()->mainFrame()->document();
128 WebAXObject root_obj = document.accessibilityObject(); 128 WebAXObject root_obj = document.accessibilityObject();
129 accessibility->HandleAXEvent( 129 accessibility->HandleAXEvent(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 "<body>" 174 "<body>"
175 " <div role='group' id='A'>" 175 " <div role='group' id='A'>"
176 " <div role='group' id='B'>" 176 " <div role='group' id='B'>"
177 " <div role='group' id='C' style='visibility:visible'>" 177 " <div role='group' id='C' style='visibility:visible'>"
178 " </div>" 178 " </div>"
179 " </div>" 179 " </div>"
180 " </div>" 180 " </div>"
181 "</body>"; 181 "</body>";
182 LoadHTML(html.c_str()); 182 LoadHTML(html.c_str());
183 183
184 scoped_ptr<TestRendererAccessibility> accessibility( 184 std::unique_ptr<TestRendererAccessibility> accessibility(
185 new TestRendererAccessibility(frame())); 185 new TestRendererAccessibility(frame()));
186 accessibility->SendPendingAccessibilityEvents(); 186 accessibility->SendPendingAccessibilityEvents();
187 EXPECT_EQ(4, CountAccessibilityNodesSentToBrowser()); 187 EXPECT_EQ(4, CountAccessibilityNodesSentToBrowser());
188 188
189 WebDocument document = view()->GetWebView()->mainFrame()->document(); 189 WebDocument document = view()->GetWebView()->mainFrame()->document();
190 WebAXObject root_obj = document.accessibilityObject(); 190 WebAXObject root_obj = document.accessibilityObject();
191 WebAXObject node_a = root_obj.childAt(0); 191 WebAXObject node_a = root_obj.childAt(0);
192 WebAXObject node_b = node_a.childAt(0); 192 WebAXObject node_b = node_a.childAt(0);
193 WebAXObject node_c = node_b.childAt(0); 193 WebAXObject node_c = node_b.childAt(0);
194 194
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 "<body>" 226 "<body>"
227 " <div role='group' id='A'>" 227 " <div role='group' id='A'>"
228 " <div role='group' id='B' style='visibility:hidden'>" 228 " <div role='group' id='B' style='visibility:hidden'>"
229 " <div role='group' id='C' style='visibility:visible'>" 229 " <div role='group' id='C' style='visibility:visible'>"
230 " </div>" 230 " </div>"
231 " </div>" 231 " </div>"
232 " </div>" 232 " </div>"
233 "</body>"; 233 "</body>";
234 LoadHTML(html.c_str()); 234 LoadHTML(html.c_str());
235 235
236 scoped_ptr<TestRendererAccessibility> accessibility( 236 std::unique_ptr<TestRendererAccessibility> accessibility(
237 new TestRendererAccessibility(frame())); 237 new TestRendererAccessibility(frame()));
238 accessibility->SendPendingAccessibilityEvents(); 238 accessibility->SendPendingAccessibilityEvents();
239 EXPECT_EQ(3, CountAccessibilityNodesSentToBrowser()); 239 EXPECT_EQ(3, CountAccessibilityNodesSentToBrowser());
240 240
241 // Show node 'B', then send a childrenChanged on 'A'. 241 // Show node 'B', then send a childrenChanged on 'A'.
242 ExecuteJavaScriptForTests( 242 ExecuteJavaScriptForTests(
243 "document.getElementById('B').style.visibility = 'visible';"); 243 "document.getElementById('B').style.visibility = 'visible';");
244 ExecuteJavaScriptForTests("document.getElementById('B').offsetLeft;"); 244 ExecuteJavaScriptForTests("document.getElementById('B').offsetLeft;");
245 245
246 sink_->ClearMessages(); 246 sink_->ClearMessages();
(...skipping 23 matching lines...) Expand all
270 // Test RendererAccessibility and make sure it sends the 270 // Test RendererAccessibility and make sure it sends the
271 // proper event to the browser when an object in the tree 271 // proper event to the browser when an object in the tree
272 // is detached, but its children are not. This can happen when 272 // is detached, but its children are not. This can happen when
273 // a layout occurs and an anonymous render block is no longer needed. 273 // a layout occurs and an anonymous render block is no longer needed.
274 std::string html = 274 std::string html =
275 "<body aria-label='Body'>" 275 "<body aria-label='Body'>"
276 "<span>1</span><span style='display:block'>2</span>" 276 "<span>1</span><span style='display:block'>2</span>"
277 "</body>"; 277 "</body>";
278 LoadHTML(html.c_str()); 278 LoadHTML(html.c_str());
279 279
280 scoped_ptr<TestRendererAccessibility> accessibility( 280 std::unique_ptr<TestRendererAccessibility> accessibility(
281 new TestRendererAccessibility(frame())); 281 new TestRendererAccessibility(frame()));
282 accessibility->SendPendingAccessibilityEvents(); 282 accessibility->SendPendingAccessibilityEvents();
283 EXPECT_EQ(7, CountAccessibilityNodesSentToBrowser()); 283 EXPECT_EQ(7, CountAccessibilityNodesSentToBrowser());
284 284
285 // Initially, the accessibility tree looks like this: 285 // Initially, the accessibility tree looks like this:
286 // 286 //
287 // Document 287 // Document
288 // +--Body 288 // +--Body
289 // +--Anonymous Block 289 // +--Anonymous Block
290 // +--Static Text "1" 290 // +--Static Text "1"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 GetLastAccEvent(&event); 331 GetLastAccEvent(&event);
332 ASSERT_EQ(5U, event.update.nodes.size()); 332 ASSERT_EQ(5U, event.update.nodes.size());
333 333
334 EXPECT_EQ(body.axID(), event.update.nodes[0].id); 334 EXPECT_EQ(body.axID(), event.update.nodes[0].id);
335 EXPECT_EQ(text_1.axID(), event.update.nodes[1].id); 335 EXPECT_EQ(text_1.axID(), event.update.nodes[1].id);
336 // The third event is to update text_2, but its id changes 336 // The third event is to update text_2, but its id changes
337 // so we don't have a test expectation for it. 337 // so we don't have a test expectation for it.
338 } 338 }
339 339
340 } // namespace content 340 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/android/email_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698