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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_unittest.cc

Issue 1413643002: Separate RenderViewHost from RenderWidgetHost, part 2: public implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 714
715 TEST_F(RenderFrameHostManagerTest, WhiteListSwapCompositorFrame) { 715 TEST_F(RenderFrameHostManagerTest, WhiteListSwapCompositorFrame) {
716 // TODO(nasko): Check with kenrb whether this test can be rewritten and 716 // TODO(nasko): Check with kenrb whether this test can be rewritten and
717 // whether it makes sense when swapped out is replaced with proxies. 717 // whether it makes sense when swapped out is replaced with proxies.
718 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { 718 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) {
719 return; 719 return;
720 } 720 }
721 TestRenderFrameHost* swapped_out_rfh = CreateSwappedOutRenderFrameHost(); 721 TestRenderFrameHost* swapped_out_rfh = CreateSwappedOutRenderFrameHost();
722 TestRenderWidgetHostView* swapped_out_rwhv = 722 TestRenderWidgetHostView* swapped_out_rwhv =
723 static_cast<TestRenderWidgetHostView*>( 723 static_cast<TestRenderWidgetHostView*>(
724 swapped_out_rfh->GetRenderViewHost()->GetView()); 724 swapped_out_rfh->GetRenderViewHost()->GetWidget()->GetView());
725 EXPECT_FALSE(swapped_out_rwhv->did_swap_compositor_frame()); 725 EXPECT_FALSE(swapped_out_rwhv->did_swap_compositor_frame());
726 726
727 MockRenderProcessHost* process_host = swapped_out_rfh->GetProcess(); 727 MockRenderProcessHost* process_host = swapped_out_rfh->GetProcess();
728 process_host->sink().ClearMessages(); 728 process_host->sink().ClearMessages();
729 729
730 cc::CompositorFrame frame; 730 cc::CompositorFrame frame;
731 ViewHostMsg_SwapCompositorFrame msg( 731 ViewHostMsg_SwapCompositorFrame msg(
732 rvh()->GetRoutingID(), 0, frame, std::vector<IPC::Message>()); 732 rvh()->GetRoutingID(), 0, frame, std::vector<IPC::Message>());
733 733
734 EXPECT_TRUE(swapped_out_rfh->render_view_host()->OnMessageReceived(msg)); 734 EXPECT_TRUE(swapped_out_rfh->render_view_host()->OnMessageReceived(msg));
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 1811
1812 // A new RenderFrameHost should be created. 1812 // A new RenderFrameHost should be created.
1813 ASSERT_EQ(host2, GetPendingFrameHost(manager)); 1813 ASSERT_EQ(host2, GetPendingFrameHost(manager));
1814 EXPECT_NE(host2, host); 1814 EXPECT_NE(host2, host);
1815 1815
1816 EXPECT_EQ(host, manager->current_frame_host()); 1816 EXPECT_EQ(host, manager->current_frame_host());
1817 EXPECT_FALSE(manager->current_frame_host()->is_swapped_out()); 1817 EXPECT_FALSE(manager->current_frame_host()->is_swapped_out());
1818 EXPECT_EQ(host2, GetPendingFrameHost(manager)); 1818 EXPECT_EQ(host2, GetPendingFrameHost(manager));
1819 1819
1820 // 3) Close the tab. ------------------------- 1820 // 3) Close the tab. -------------------------
1821 notifications.ListenFor(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 1821 notifications.ListenFor(
1822 Source<RenderWidgetHost>(host2->render_view_host())); 1822 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
1823 Source<RenderWidgetHost>(host2->render_view_host()->GetWidget()));
1823 manager->OnBeforeUnloadACK(false, true, base::TimeTicks()); 1824 manager->OnBeforeUnloadACK(false, true, base::TimeTicks());
1824 1825
1825 EXPECT_TRUE( 1826 EXPECT_TRUE(
1826 notifications.Check1AndReset(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED)); 1827 notifications.Check1AndReset(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED));
1827 EXPECT_FALSE(GetPendingFrameHost(manager)); 1828 EXPECT_FALSE(GetPendingFrameHost(manager));
1828 EXPECT_EQ(host, manager->current_frame_host()); 1829 EXPECT_EQ(host, manager->current_frame_host());
1829 } 1830 }
1830 1831
1831 TEST_F(RenderFrameHostManagerTest, CloseWithPendingWhileUnresponsive) { 1832 TEST_F(RenderFrameHostManagerTest, CloseWithPendingWhileUnresponsive) {
1832 const GURL kUrl1("http://www.google.com/"); 1833 const GURL kUrl1("http://www.google.com/");
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 EXPECT_EQ(tree4, opener_frame_trees[3]); 2428 EXPECT_EQ(tree4, opener_frame_trees[3]);
2428 2429
2429 EXPECT_EQ(2U, nodes_with_back_links.size()); 2430 EXPECT_EQ(2U, nodes_with_back_links.size());
2430 EXPECT_TRUE(nodes_with_back_links.find(root1->child_at(1)) != 2431 EXPECT_TRUE(nodes_with_back_links.find(root1->child_at(1)) !=
2431 nodes_with_back_links.end()); 2432 nodes_with_back_links.end());
2432 EXPECT_TRUE(nodes_with_back_links.find(root4->child_at(0)) != 2433 EXPECT_TRUE(nodes_with_back_links.find(root4->child_at(0)) !=
2433 nodes_with_back_links.end()); 2434 nodes_with_back_links.end());
2434 } 2435 }
2435 2436
2436 } // namespace content 2437 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/browser/loader/resource_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698