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

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 464593003: Don't swap out the old RenderFrameHost until the new one commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase past PlzNavigate CL Created 6 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
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_widget.h » ('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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 15 matching lines...) Expand all
26 #include "content/public/renderer/document_state.h" 26 #include "content/public/renderer/document_state.h"
27 #include "content/public/renderer/navigation_state.h" 27 #include "content/public/renderer/navigation_state.h"
28 #include "content/public/test/browser_test_utils.h" 28 #include "content/public/test/browser_test_utils.h"
29 #include "content/public/test/render_view_test.h" 29 #include "content/public/test/render_view_test.h"
30 #include "content/public/test/test_utils.h" 30 #include "content/public/test/test_utils.h"
31 #include "content/renderer/accessibility/renderer_accessibility.h" 31 #include "content/renderer/accessibility/renderer_accessibility.h"
32 #include "content/renderer/accessibility/renderer_accessibility_complete.h" 32 #include "content/renderer/accessibility/renderer_accessibility_complete.h"
33 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" 33 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h"
34 #include "content/renderer/history_controller.h" 34 #include "content/renderer/history_controller.h"
35 #include "content/renderer/history_serialization.h" 35 #include "content/renderer/history_serialization.h"
36 #include "content/renderer/render_process.h"
36 #include "content/renderer/render_view_impl.h" 37 #include "content/renderer/render_view_impl.h"
37 #include "content/shell/browser/shell.h" 38 #include "content/shell/browser/shell.h"
38 #include "content/shell/browser/shell_browser_context.h" 39 #include "content/shell/browser/shell_browser_context.h"
39 #include "content/test/frame_load_waiter.h" 40 #include "content/test/frame_load_waiter.h"
40 #include "content/test/mock_keyboard.h" 41 #include "content/test/mock_keyboard.h"
41 #include "net/base/net_errors.h" 42 #include "net/base/net_errors.h"
42 #include "net/cert/cert_status_flags.h" 43 #include "net/cert/cert_status_flags.h"
43 #include "testing/gtest/include/gtest/gtest.h" 44 #include "testing/gtest/include/gtest/gtest.h"
44 #include "third_party/WebKit/public/platform/WebData.h" 45 #include "third_party/WebKit/public/platform/WebData.h"
45 #include "third_party/WebKit/public/platform/WebHTTPBody.h" 46 #include "third_party/WebKit/public/platform/WebHTTPBody.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 new_view->Close(); 491 new_view->Close();
491 new_view->Release(); 492 new_view->Release();
492 } 493 }
493 494
494 // Ensure the RenderViewImpl sends an ACK to a SwapOut request, even if it is 495 // Ensure the RenderViewImpl sends an ACK to a SwapOut request, even if it is
495 // already swapped out. http://crbug.com/93427. 496 // already swapped out. http://crbug.com/93427.
496 TEST_F(RenderViewImplTest, SendSwapOutACK) { 497 TEST_F(RenderViewImplTest, SendSwapOutACK) {
497 LoadHTML("<div>Page A</div>"); 498 LoadHTML("<div>Page A</div>");
498 int initial_page_id = view_page_id(); 499 int initial_page_id = view_page_id();
499 500
501 // Increment the ref count so that we don't exit when swapping out.
502 RenderProcess::current()->AddRefProcess();
503
500 // Respond to a swap out request. 504 // Respond to a swap out request.
501 view()->main_render_frame()->OnSwapOut(kProxyRoutingId); 505 view()->main_render_frame()->OnSwapOut(kProxyRoutingId);
502 506
503 // Ensure the swap out commits synchronously. 507 // Ensure the swap out commits synchronously.
504 EXPECT_NE(initial_page_id, view_page_id()); 508 EXPECT_NE(initial_page_id, view_page_id());
505 509
506 // Check for a valid OnSwapOutACK. 510 // Check for a valid OnSwapOutACK.
507 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( 511 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
508 FrameHostMsg_SwapOut_ACK::ID); 512 FrameHostMsg_SwapOut_ACK::ID);
509 ASSERT_TRUE(msg); 513 ASSERT_TRUE(msg);
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 ProcessPendingMessages(); 2434 ProcessPendingMessages();
2431 base::Time after_navigation = 2435 base::Time after_navigation =
2432 base::Time::Now() + base::TimeDelta::FromDays(1); 2436 base::Time::Now() + base::TimeDelta::FromDays(1);
2433 2437
2434 base::Time late_nav_reported_start = 2438 base::Time late_nav_reported_start =
2435 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); 2439 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart());
2436 EXPECT_LE(late_nav_reported_start, after_navigation); 2440 EXPECT_LE(late_nav_reported_start, after_navigation);
2437 } 2441 }
2438 2442
2439 } // namespace content 2443 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698