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

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

Issue 281663002: Create RenderFrameProxyHost at time of swap-out instead of commit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix accessibility test. Created 6 years, 7 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 #include "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "content/common/frame_messages.h" 6 #include "content/common/frame_messages.h"
7 #include "content/common/view_message_enums.h" 7 #include "content/common/view_message_enums.h"
8 #include "content/public/test/render_view_test.h" 8 #include "content/public/test/render_view_test.h"
9 #include "content/renderer/accessibility/renderer_accessibility_complete.h" 9 #include "content/renderer/accessibility/renderer_accessibility_complete.h"
10 #include "content/renderer/render_view_impl.h" 10 #include "content/renderer/render_view_impl.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 AccessibilityMessagesQueueWhileSwappedOut 297 AccessibilityMessagesQueueWhileSwappedOut
298 #endif 298 #endif
299 299
300 TEST_F(RendererAccessibilityTest, 300 TEST_F(RendererAccessibilityTest,
301 MAYBE_AccessibilityMessagesQueueWhileSwappedOut) { 301 MAYBE_AccessibilityMessagesQueueWhileSwappedOut) {
302 std::string html = 302 std::string html =
303 "<body>" 303 "<body>"
304 " <p>Hello, world.</p>" 304 " <p>Hello, world.</p>"
305 "</body>"; 305 "</body>";
306 LoadHTML(html.c_str()); 306 LoadHTML(html.c_str());
307 static const int kProxyRoutingId = 13;
307 308
308 // Creating a RendererAccessibilityComplete should send the tree 309 // Creating a RendererAccessibilityComplete should send the tree
309 // to the browser. 310 // to the browser.
310 scoped_ptr<TestRendererAccessibilityComplete> accessibility( 311 scoped_ptr<TestRendererAccessibilityComplete> accessibility(
311 new TestRendererAccessibilityComplete(view())); 312 new TestRendererAccessibilityComplete(view()));
312 accessibility->SendPendingAccessibilityEvents(); 313 accessibility->SendPendingAccessibilityEvents();
313 EXPECT_EQ(5, CountAccessibilityNodesSentToBrowser()); 314 EXPECT_EQ(5, CountAccessibilityNodesSentToBrowser());
314 315
315 // Post a "value changed" event, but then swap out 316 // Post a "value changed" event, but then swap out
316 // before sending it. It shouldn't send the event while 317 // before sending it. It shouldn't send the event while
317 // swapped out. 318 // swapped out.
318 sink_->ClearMessages(); 319 sink_->ClearMessages();
319 WebDocument document = view()->GetWebView()->mainFrame()->document(); 320 WebDocument document = view()->GetWebView()->mainFrame()->document();
320 WebAXObject root_obj = document.accessibilityObject(); 321 WebAXObject root_obj = document.accessibilityObject();
321 accessibility->HandleAXEvent( 322 accessibility->HandleAXEvent(
322 root_obj, 323 root_obj,
323 ui::AX_EVENT_VALUE_CHANGED); 324 ui::AX_EVENT_VALUE_CHANGED);
324 view()->main_render_frame()->OnSwapOut(); 325 view()->main_render_frame()->OnSwapOut(kProxyRoutingId);
325 accessibility->SendPendingAccessibilityEvents(); 326 accessibility->SendPendingAccessibilityEvents();
326 EXPECT_FALSE(sink_->GetUniqueMessageMatching( 327 EXPECT_FALSE(sink_->GetUniqueMessageMatching(
327 AccessibilityHostMsg_Events::ID)); 328 AccessibilityHostMsg_Events::ID));
328 329
329 // Navigate, so we're not swapped out anymore. Now we should 330 // Navigate, so we're not swapped out anymore. Now we should
330 // send accessibility events again. Note that the 331 // send accessibility events again. Note that the
331 // message that was queued up before will be quickly discarded 332 // message that was queued up before will be quickly discarded
332 // because the element it was referring to no longer exists, 333 // because the element it was referring to no longer exists,
333 // so the event here is from loading this new page. 334 // so the event here is from loading this new page.
334 FrameMsg_Navigate_Params nav_params; 335 FrameMsg_Navigate_Params nav_params;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 GetLastAccEvent(&event); 511 GetLastAccEvent(&event);
511 ASSERT_EQ(5U, event.update.nodes.size()); 512 ASSERT_EQ(5U, event.update.nodes.size());
512 513
513 EXPECT_EQ(body.axID(), event.update.nodes[0].id); 514 EXPECT_EQ(body.axID(), event.update.nodes[0].id);
514 EXPECT_EQ(text_1.axID(), event.update.nodes[1].id); 515 EXPECT_EQ(text_1.axID(), event.update.nodes[1].id);
515 // The third event is to update text_2, but its id changes 516 // The third event is to update text_2, but its id changes
516 // so we don't have a test expectation for it. 517 // so we don't have a test expectation for it.
517 } 518 }
518 519
519 } // namespace content 520 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698