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

Side by Side Diff: content/browser/tab_contents/test_tab_contents.cc

Issue 7618016: Additional fixes for prerender/instant + browsing history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small changes Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/tab_contents/test_tab_contents.h" 5 #include "content/browser/tab_contents/test_tab_contents.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/browser_url_handler.h" 9 #include "content/browser/browser_url_handler.h"
10 #include "content/browser/renderer_host/mock_render_process_host.h" 10 #include "content/browser/renderer_host/mock_render_process_host.h"
11 #include "content/browser/renderer_host/render_view_host.h" 11 #include "content/browser/renderer_host/render_view_host.h"
12 #include "content/browser/renderer_host/test_render_view_host.h" 12 #include "content/browser/renderer_host/test_render_view_host.h"
13 #include "content/browser/site_instance.h" 13 #include "content/browser/site_instance.h"
14 #include "content/common/page_transition_types.h" 14 #include "content/common/page_transition_types.h"
15 15
16 TestTabContents::TestTabContents(content::BrowserContext* browser_context, 16 TestTabContents::TestTabContents(content::BrowserContext* browser_context,
17 SiteInstance* instance) 17 SiteInstance* instance)
18 : TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL), 18 : TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL),
19 transition_cross_site(false), 19 transition_cross_site(false),
20 delegate_view_override_(NULL) { 20 delegate_view_override_(NULL),
21 expect_set_history_length_and_prune_(false),
22 expect_set_history_length_and_prune_site_instance_(NULL),
23 expect_set_history_length_and_prune_history_length_(0),
24 expect_set_history_length_and_prune_min_page_id_(-1) {
21 } 25 }
22 26
23 TestRenderViewHost* TestTabContents::pending_rvh() const { 27 TestRenderViewHost* TestTabContents::pending_rvh() const {
24 return static_cast<TestRenderViewHost*>( 28 return static_cast<TestRenderViewHost*>(
25 render_manager_.pending_render_view_host_); 29 render_manager_.pending_render_view_host_);
26 } 30 }
27 31
28 bool TestTabContents::CreateRenderViewForRenderManager( 32 bool TestTabContents::CreateRenderViewForRenderManager(
29 RenderViewHost* render_view_host) { 33 RenderViewHost* render_view_host) {
30 // This will go to a TestRenderViewHost. 34 // This will go to a TestRenderViewHost.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>( 87 TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>(
84 render_manager_.current_host()); 88 render_manager_.current_host());
85 rvh->SendShouldCloseACK(true); 89 rvh->SendShouldCloseACK(true);
86 } 90 }
87 91
88 RenderViewHostDelegate::View* TestTabContents::GetViewDelegate() { 92 RenderViewHostDelegate::View* TestTabContents::GetViewDelegate() {
89 if (delegate_view_override_) 93 if (delegate_view_override_)
90 return delegate_view_override_; 94 return delegate_view_override_;
91 return TabContents::GetViewDelegate(); 95 return TabContents::GetViewDelegate();
92 } 96 }
97
98 void TestTabContents::ExpectSetHistoryLengthAndPrune(
99 const SiteInstance* site_instance,
100 int history_length,
101 int32 min_page_id) {
102 expect_set_history_length_and_prune_ = true;
103 expect_set_history_length_and_prune_site_instance_ = site_instance;
104 expect_set_history_length_and_prune_history_length_ = history_length;
105 expect_set_history_length_and_prune_min_page_id_ = min_page_id;
106 }
107
108 void TestTabContents::SetHistoryLengthAndPrune(
109 const SiteInstance* site_instance, int history_length, int32 min_page_id) {
110 EXPECT_TRUE(expect_set_history_length_and_prune_);
111 expect_set_history_length_and_prune_ = false;
112 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance);
113 EXPECT_EQ(expect_set_history_length_and_prune_history_length_,
114 history_length);
115 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id);
116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698