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

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

Issue 9146028: Define the public interface for content browser SiteInstance. This interface is implemented by th... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 "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_impl.h"
14 #include "content/browser/tab_contents/navigation_entry_impl.h" 14 #include "content/browser/tab_contents/navigation_entry_impl.h"
15 #include "content/common/view_messages.h" 15 #include "content/common/view_messages.h"
16 #include "content/public/common/page_transition_types.h" 16 #include "content/public/common/page_transition_types.h"
17 #include "webkit/glue/webkit_glue.h" 17 #include "webkit/glue/webkit_glue.h"
18 #include "webkit/forms/password_form.h" 18 #include "webkit/forms/password_form.h"
19 19
20 using content::NavigationEntry; 20 using content::NavigationEntry;
21 using content::WebContents; 21 using content::WebContents;
22 22
23 TestTabContents::TestTabContents(content::BrowserContext* browser_context, 23 TestTabContents::TestTabContents(content::BrowserContext* browser_context,
24 SiteInstance* instance) 24 content::SiteInstance* instance)
25 : TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL), 25 : TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL),
26 transition_cross_site(false), 26 transition_cross_site(false),
27 delegate_view_override_(NULL), 27 delegate_view_override_(NULL),
28 expect_set_history_length_and_prune_(false), 28 expect_set_history_length_and_prune_(false),
29 expect_set_history_length_and_prune_site_instance_(NULL), 29 expect_set_history_length_and_prune_site_instance_(NULL),
30 expect_set_history_length_and_prune_history_length_(0), 30 expect_set_history_length_and_prune_history_length_(0),
31 expect_set_history_length_and_prune_min_page_id_(-1) { 31 expect_set_history_length_and_prune_min_page_id_(-1) {
32 } 32 }
33 33
34 TestTabContents::~TestTabContents() { 34 TestTabContents::~TestTabContents() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool TestTabContents::CreateRenderViewForRenderManager( 79 bool TestTabContents::CreateRenderViewForRenderManager(
80 RenderViewHost* render_view_host) { 80 RenderViewHost* render_view_host) {
81 // This will go to a TestRenderViewHost. 81 // This will go to a TestRenderViewHost.
82 render_view_host->CreateRenderView(string16(), -1); 82 render_view_host->CreateRenderView(string16(), -1);
83 return true; 83 return true;
84 } 84 }
85 85
86 WebContents* TestTabContents::Clone() { 86 WebContents* TestTabContents::Clone() {
87 TabContents* tc = new TestTabContents( 87 TabContents* tc = new TestTabContents(
88 GetBrowserContext(), 88 GetBrowserContext(),
89 SiteInstance::CreateSiteInstance(GetBrowserContext())); 89 content::SiteInstance::CreateSiteInstance(GetBrowserContext()));
90 tc->GetControllerImpl().CopyStateFrom(controller_); 90 tc->GetControllerImpl().CopyStateFrom(controller_);
91 return tc; 91 return tc;
92 } 92 }
93 93
94 void TestTabContents::NavigateAndCommit(const GURL& url) { 94 void TestTabContents::NavigateAndCommit(const GURL& url) {
95 GetController().LoadURL( 95 GetController().LoadURL(
96 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 96 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
97 GURL loaded_url(url); 97 GURL loaded_url(url);
98 bool reverse_on_redirect = false; 98 bool reverse_on_redirect = false;
99 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 99 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 rvh->SendShouldCloseACK(true); 137 rvh->SendShouldCloseACK(true);
138 } 138 }
139 139
140 content::RenderViewHostDelegate::View* TestTabContents::GetViewDelegate() { 140 content::RenderViewHostDelegate::View* TestTabContents::GetViewDelegate() {
141 if (delegate_view_override_) 141 if (delegate_view_override_)
142 return delegate_view_override_; 142 return delegate_view_override_;
143 return TabContents::GetViewDelegate(); 143 return TabContents::GetViewDelegate();
144 } 144 }
145 145
146 void TestTabContents::ExpectSetHistoryLengthAndPrune( 146 void TestTabContents::ExpectSetHistoryLengthAndPrune(
147 const SiteInstance* site_instance, 147 const content::SiteInstance* site_instance,
148 int history_length, 148 int history_length,
149 int32 min_page_id) { 149 int32 min_page_id) {
150 expect_set_history_length_and_prune_ = true; 150 expect_set_history_length_and_prune_ = true;
151 expect_set_history_length_and_prune_site_instance_ = site_instance; 151 expect_set_history_length_and_prune_site_instance_ =
152 reinterpret_cast<const SiteInstanceImpl*>(site_instance);
jam 2012/01/24 03:29:33 ditto
ananta 2012/01/24 23:46:26 Done.
152 expect_set_history_length_and_prune_history_length_ = history_length; 153 expect_set_history_length_and_prune_history_length_ = history_length;
153 expect_set_history_length_and_prune_min_page_id_ = min_page_id; 154 expect_set_history_length_and_prune_min_page_id_ = min_page_id;
154 } 155 }
155 156
156 void TestTabContents::SetHistoryLengthAndPrune( 157 void TestTabContents::SetHistoryLengthAndPrune(
157 const SiteInstance* site_instance, int history_length, int32 min_page_id) { 158 const content::SiteInstance* site_instance, int history_length,
159 int32 min_page_id) {
158 EXPECT_TRUE(expect_set_history_length_and_prune_); 160 EXPECT_TRUE(expect_set_history_length_and_prune_);
159 expect_set_history_length_and_prune_ = false; 161 expect_set_history_length_and_prune_ = false;
160 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); 162 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance);
161 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, 163 EXPECT_EQ(expect_set_history_length_and_prune_history_length_,
162 history_length); 164 history_length);
163 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); 165 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id);
164 } 166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698