summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autofill/autofill_manager.cc2
-rw-r--r--content/browser/debugger/devtools_manager_unittest.cc3
-rw-r--r--content/browser/download/save_package_unittest.cc2
-rw-r--r--content/browser/intents/internal_web_intents_dispatcher_unittest.cc2
-rw-r--r--content/browser/renderer_host/render_view_host_unittest.cc11
-rw-r--r--content/browser/renderer_host/test_render_view_host.cc6
-rw-r--r--content/browser/renderer_host/test_render_view_host.h6
-rw-r--r--content/browser/tab_contents/navigation_controller_impl_unittest.cc19
-rw-r--r--content/browser/tab_contents/render_view_host_manager.h3
-rw-r--r--content/browser/tab_contents/render_view_host_manager_unittest.cc29
-rw-r--r--content/browser/tab_contents/tab_contents.h5
-rw-r--r--content/browser/tab_contents/tab_contents_unittest.cc15
-rw-r--r--content/browser/tab_contents/test_web_contents.cc (renamed from content/browser/tab_contents/test_tab_contents.cc)55
-rw-r--r--content/browser/tab_contents/test_web_contents.h (renamed from content/browser/tab_contents/test_tab_contents.h)67
-rw-r--r--content/browser/tab_contents/web_drag_dest_mac_unittest.mm2
-rw-r--r--content/content_tests.gypi4
-rw-r--r--content/test/test_renderer_host.cc8
-rw-r--r--content/test/web_contents_tester.cc22
18 files changed, 129 insertions, 132 deletions
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 3de229c..5b475a1 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -184,7 +184,7 @@ AutofillManager::AutofillManager(TabContentsWrapper* tab_contents)
user_did_autofill_(false),
user_did_edit_autofilled_field_(false),
external_delegate_(NULL) {
- // |personal_data_| is NULL when using TestTabContents.
+ // |personal_data_| is NULL when using test-enabled WebContents.
personal_data_ = PersonalDataManagerFactory::GetForProfile(
tab_contents->profile()->GetOriginalProfile());
}
diff --git a/content/browser/debugger/devtools_manager_unittest.cc b/content/browser/debugger/devtools_manager_unittest.cc
index 4ba7d73..dfc0f40 100644
--- a/content/browser/debugger/devtools_manager_unittest.cc
+++ b/content/browser/debugger/devtools_manager_unittest.cc
@@ -8,13 +8,12 @@
#include "content/browser/debugger/render_view_devtools_agent_host.h"
#include "content/browser/mock_content_browser_client.h"
#include "content/browser/renderer_host/test_render_view_host.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "content/common/view_messages.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/devtools_agent_host_registry.h"
#include "content/public/browser/devtools_client_host.h"
#include "content/public/browser/web_contents_delegate.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::TimeDelta;
diff --git a/content/browser/download/save_package_unittest.cc b/content/browser/download/save_package_unittest.cc
index 3f23bc9..3abcb69 100644
--- a/content/browser/download/save_package_unittest.cc
+++ b/content/browser/download/save_package_unittest.cc
@@ -12,7 +12,7 @@
#include "content/browser/browser_thread_impl.h"
#include "content/browser/download/save_package.h"
#include "content/browser/renderer_host/test_render_view_host.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "content/test/net/url_request_mock_http_job.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/intents/internal_web_intents_dispatcher_unittest.cc b/content/browser/intents/internal_web_intents_dispatcher_unittest.cc
index f28f07f..dbdb64d 100644
--- a/content/browser/intents/internal_web_intents_dispatcher_unittest.cc
+++ b/content/browser/intents/internal_web_intents_dispatcher_unittest.cc
@@ -7,7 +7,7 @@
#include "content/browser/intents/intent_injector.h"
#include "content/browser/intents/internal_web_intents_dispatcher.h"
#include "content/browser/renderer_host/test_render_view_host.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "webkit/glue/web_intent_data.h"
#include "webkit/glue/web_intent_reply_data.h"
diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc
index 9aeddda..caa5157 100644
--- a/content/browser/renderer_host/render_view_host_unittest.cc
+++ b/content/browser/renderer_host/render_view_host_unittest.cc
@@ -5,7 +5,7 @@
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_controller_impl.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "content/common/view_messages.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/common/bindings_policy.h"
@@ -15,6 +15,7 @@
#include "webkit/glue/webdropdata.h"
using content::RenderViewHostImplTestHarness;
+using content::TestWebContents;
class RenderViewHostTest : public RenderViewHostImplTestHarness {
};
@@ -67,8 +68,8 @@ TEST_F(RenderViewHostTest, ResetUnloadOnReload) {
// Ensure we do not grant bindings to a process shared with unprivileged views.
TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) {
// Create another view in the same process.
- scoped_ptr<TestTabContents> new_tab(
- new TestTabContents(browser_context(), rvh()->GetSiteInstance()));
+ scoped_ptr<TestWebContents> new_tab(
+ new TestWebContents(browser_context(), rvh()->GetSiteInstance()));
rvh()->AllowBindings(content::BINDINGS_POLICY_WEB_UI);
EXPECT_FALSE(rvh()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI);
@@ -124,9 +125,9 @@ class MockDraggingRenderViewHostDelegateView
};
TEST_F(RenderViewHostTest, StartDragging) {
- TestTabContents* tab_contents = contents();
+ TestWebContents* web_contents = contents();
MockDraggingRenderViewHostDelegateView view_delegate;
- tab_contents->set_view_delegate(&view_delegate);
+ web_contents->set_view_delegate(&view_delegate);
WebDropData drop_data;
GURL file_url = GURL("file:///home/user/secrets.txt");
diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc
index b85ef89..fc6da12 100644
--- a/content/browser/renderer_host/test_render_view_host.cc
+++ b/content/browser/renderer_host/test_render_view_host.cc
@@ -6,7 +6,7 @@
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/tab_contents/navigation_controller_impl.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "content/common/dom_storage_common.h"
#include "content/common/view_messages.h"
#include "content/public/browser/navigation_controller.h"
@@ -315,8 +315,8 @@ TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() {
return static_cast<TestRenderViewHost*>(active_rvh());
}
-TestTabContents* RenderViewHostImplTestHarness::contents() {
- return static_cast<TestTabContents*>(web_contents());
+TestWebContents* RenderViewHostImplTestHarness::contents() {
+ return static_cast<TestWebContents*>(web_contents());
}
} // namespace content
diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h
index aedd9495..d222e98 100644
--- a/content/browser/renderer_host/test_render_view_host.h
+++ b/content/browser/renderer_host/test_render_view_host.h
@@ -21,7 +21,6 @@
//
// To use, derive your test base class from RenderViewHostImplTestHarness.
-class TestTabContents;
struct ViewHostMsg_FrameNavigate_Params;
namespace gfx {
@@ -31,6 +30,7 @@ class Rect;
namespace content {
class SiteInstance;
+class TestWebContents;
// Utility function to initialize ViewHostMsg_NavigateParams_Params
// with given |page_id|, |url| and |transition_type|.
@@ -178,7 +178,7 @@ class TestRenderWidgetHostView : public RenderWidgetHostViewBase {
// TestRenderViewHost ----------------------------------------------------------
-// TODO(brettw) this should use a TestTabContents which should be generalized
+// TODO(brettw) this should use a TestWebContents which should be generalized
// from the TabContents test. We will probably also need that class' version of
// CreateRenderViewForRenderManager when more complicate tests start using this.
//
@@ -307,7 +307,7 @@ class RenderViewHostImplTestHarness
TestRenderViewHost* test_rvh();
TestRenderViewHost* pending_test_rvh();
TestRenderViewHost* active_test_rvh();
- TestTabContents* contents();
+ TestWebContents* contents();
private:
DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness);
diff --git a/content/browser/tab_contents/navigation_controller_impl_unittest.cc b/content/browser/tab_contents/navigation_controller_impl_unittest.cc
index 73ba9b3..e6bf817 100644
--- a/content/browser/tab_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/tab_contents/navigation_controller_impl_unittest.cc
@@ -21,7 +21,7 @@
#include "content/browser/tab_contents/navigation_controller_impl.h"
#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "content/common/view_messages.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/notification_registrar.h"
@@ -41,6 +41,7 @@ using content::NavigationEntryImpl;
using content::RenderViewHostImplTestHarness;
using content::SiteInstance;
using content::TestRenderViewHost;
+using content::TestWebContents;
using content::WebContents;
// NavigationControllerTest ----------------------------------------------------
@@ -2083,8 +2084,8 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune) {
EXPECT_EQ(1, controller.GetEntryAtIndex(1)->GetPageID());
EXPECT_EQ(1, contents()->GetMaxPageIDForSiteInstance(instance1));
- scoped_ptr<TestTabContents> other_contents(
- static_cast<TestTabContents*>(CreateTestWebContents()));
+ scoped_ptr<TestWebContents> other_contents(
+ static_cast<TestWebContents*>(CreateTestWebContents()));
NavigationControllerImpl& other_controller =
other_contents->GetControllerImpl();
other_contents->NavigateAndCommit(url3);
@@ -2129,8 +2130,8 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune2) {
NavigateAndCommit(url2);
controller.GoBack();
- scoped_ptr<TestTabContents> other_contents(
- static_cast<TestTabContents*>(CreateTestWebContents()));
+ scoped_ptr<TestWebContents> other_contents(
+ static_cast<TestWebContents*>(CreateTestWebContents()));
NavigationControllerImpl& other_controller =
other_contents->GetControllerImpl();
other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1);
@@ -2164,8 +2165,8 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune3) {
NavigateAndCommit(url2);
controller.GoBack();
- scoped_ptr<TestTabContents> other_contents(
- static_cast<TestTabContents*>(CreateTestWebContents()));
+ scoped_ptr<TestWebContents> other_contents(
+ static_cast<TestWebContents*>(CreateTestWebContents()));
NavigationControllerImpl& other_controller =
other_contents->GetControllerImpl();
other_controller.LoadURL(
@@ -2215,8 +2216,8 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPruneMaxEntries) {
NavigateAndCommit(url2);
NavigateAndCommit(url3);
- scoped_ptr<TestTabContents> other_contents(
- static_cast<TestTabContents*>(CreateTestWebContents()));
+ scoped_ptr<TestWebContents> other_contents(
+ static_cast<TestWebContents*>(CreateTestWebContents()));
NavigationControllerImpl& other_controller =
other_contents->GetControllerImpl();
other_contents->NavigateAndCommit(url4);
diff --git a/content/browser/tab_contents/render_view_host_manager.h b/content/browser/tab_contents/render_view_host_manager.h
index 8f710e5..89462f6 100644
--- a/content/browser/tab_contents/render_view_host_manager.h
+++ b/content/browser/tab_contents/render_view_host_manager.h
@@ -26,6 +26,7 @@ class NavigationEntryImpl;
class RenderViewHost;
class RenderViewHostImpl;
class RenderWidgetHostView;
+class TestWebContents;
}
// Manages RenderViewHosts for a TabContents. Normally there is only one and
@@ -200,7 +201,7 @@ class CONTENT_EXPORT RenderViewHostManager
bool IsSwappedOut(content::RenderViewHost* rvh);
private:
- friend class TestTabContents;
+ friend class content::TestWebContents;
friend class RenderViewHostManagerTest;
// Returns whether this tab should transition to a new renderer for
diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc
index 820f93e..66027fd 100644
--- a/content/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -10,7 +10,7 @@
#include "content/browser/tab_contents/navigation_controller_impl.h"
#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/render_view_host_manager.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "content/common/test_url_constants.h"
#include "content/common/view_messages.h"
#include "content/public/browser/notification_details.h"
@@ -41,6 +41,7 @@ using content::RenderViewHostImpl;
using content::RenderViewHostImplTestHarness;
using content::SiteInstance;
using content::TestRenderViewHost;
+using content::TestWebContents;
using content::WebContents;
using content::WebUI;
using content::WebUIController;
@@ -201,7 +202,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) {
NavigateActiveAndCommit(kDestUrl);
// Make a second tab.
- TestTabContents contents2(browser_context(), NULL);
+ TestWebContents contents2(browser_context(), NULL);
// Load the two URLs in the second tab. Note that the first navigation creates
// a RVH that's not pending (since there is no cross-site transition), so
@@ -362,7 +363,7 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) {
ASSERT_TRUE(controller().GetLastCommittedEntry());
EXPECT_TRUE(kUrl == controller().GetLastCommittedEntry()->GetURL());
EXPECT_FALSE(controller().GetPendingEntry());
- // Because we're using TestTabContents and TestRenderViewHost in this
+ // Because we're using TestWebContents and TestRenderViewHost in this
// unittest, no one calls TabContents::RenderViewCreated(). So, we see no
// EnableViewSourceMode message, here.
@@ -389,15 +390,15 @@ TEST_F(RenderViewHostManagerTest, Init) {
static_cast<SiteInstanceImpl*>(SiteInstance::Create(browser_context()));
EXPECT_FALSE(instance->HasSite());
- TestTabContents tab_contents(browser_context(), instance);
- RenderViewHostManager manager(&tab_contents, &tab_contents);
+ TestWebContents web_contents(browser_context(), instance);
+ RenderViewHostManager manager(&web_contents, &web_contents);
manager.Init(browser_context(), instance, MSG_ROUTING_NONE);
RenderViewHost* host = manager.current_host();
ASSERT_TRUE(host);
EXPECT_TRUE(instance == host->GetSiteInstance());
- EXPECT_TRUE(&tab_contents == host->GetDelegate());
+ EXPECT_TRUE(&web_contents == host->GetDelegate());
EXPECT_TRUE(manager.GetRenderWidgetHostView());
EXPECT_FALSE(manager.pending_render_view_host());
}
@@ -409,14 +410,14 @@ TEST_F(RenderViewHostManagerTest, Navigate) {
SiteInstance* instance = SiteInstance::Create(browser_context());
- TestTabContents tab_contents(browser_context(), instance);
+ TestWebContents web_contents(browser_context(), instance);
notifications.ListenFor(
content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
content::Source<NavigationController>(
- &tab_contents.GetController()));
+ &web_contents.GetController()));
// Create.
- RenderViewHostManager manager(&tab_contents, &tab_contents);
+ RenderViewHostManager manager(&web_contents, &web_contents);
manager.Init(browser_context(), instance, MSG_ROUTING_NONE);
@@ -501,14 +502,14 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) {
SiteInstance* instance = SiteInstance::Create(browser_context());
- TestTabContents tab_contents(browser_context(), instance);
+ TestWebContents web_contents(browser_context(), instance);
notifications.ListenFor(
content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
content::Source<NavigationController>(
- &tab_contents.GetController()));
+ &web_contents.GetController()));
// Create.
- RenderViewHostManager manager(&tab_contents, &tab_contents);
+ RenderViewHostManager manager(&web_contents, &web_contents);
manager.Init(browser_context(), instance, MSG_ROUTING_NONE);
@@ -652,8 +653,8 @@ TEST_F(RenderViewHostManagerTest, WebUI) {
BrowserThreadImpl ui_thread(BrowserThread::UI, MessageLoop::current());
SiteInstance* instance = SiteInstance::Create(browser_context());
- TestTabContents tab_contents(browser_context(), instance);
- RenderViewHostManager manager(&tab_contents, &tab_contents);
+ TestWebContents web_contents(browser_context(), instance);
+ RenderViewHostManager manager(&web_contents, &web_contents);
manager.Init(browser_context(), instance, MSG_ROUTING_NONE);
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index ff5171a..a155ad2 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -41,6 +41,7 @@ class JavaScriptDialogCreator;
class RenderViewHost;
class RenderViewHostImpl;
class SiteInstance;
+class TestWebContents;
class WebContentsDelegate;
class WebContentsObserver;
class WebContentsView;
@@ -389,8 +390,8 @@ class CONTENT_EXPORT TabContents
// So InterstitialPageImpl can access SetIsLoading.
friend class InterstitialPageImpl;
- // TODO(brettw) TestTabContents shouldn't exist!
- friend class TestTabContents;
+ // TODO(brettw) TestWebContents shouldn't exist!
+ friend class content::TestWebContents;
// Callback function when showing JS dialogs.
void OnDialogClosed(content::RenderViewHost* rvh,
diff --git a/content/browser/tab_contents/tab_contents_unittest.cc b/content/browser/tab_contents/tab_contents_unittest.cc
index b0aa456..a00c3f1e 100644
--- a/content/browser/tab_contents/tab_contents_unittest.cc
+++ b/content/browser/tab_contents/tab_contents_unittest.cc
@@ -10,7 +10,7 @@
#include "content/browser/site_instance_impl.h"
#include "content/browser/tab_contents/interstitial_page_impl.h"
#include "content/browser/tab_contents/navigation_entry_impl.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "content/common/view_messages.h"
#include "content/public/browser/interstitial_page_delegate.h"
#include "content/public/browser/navigation_details.h"
@@ -40,6 +40,7 @@ using content::SiteInstance;
using content::RenderViewHost;
using content::RenderViewHostImplTestHarness;
using content::TestRenderViewHost;
+using content::TestWebContents;
using content::WebContents;
using content::WebUI;
using content::WebUIController;
@@ -544,7 +545,7 @@ TEST_F(TabContentsTest, NavigateTwoTabsCrossSite) {
contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED);
// Open a new tab with the same SiteInstance, navigated to the same site.
- TestTabContents contents2(browser_context_.get(), instance1);
+ TestWebContents contents2(browser_context_.get(), instance1);
contents2.transition_cross_site = true;
contents2.GetController().LoadURL(url, content::Referrer(),
content::PAGE_TRANSITION_TYPED,
@@ -607,7 +608,7 @@ TEST_F(TabContentsTest, CrossSiteComparesAgainstCurrentPage) {
orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED);
// Open a related tab to a second site.
- TestTabContents contents2(browser_context_.get(), instance1);
+ TestWebContents contents2(browser_context_.get(), instance1);
contents2.transition_cross_site = true;
const GURL url2("http://www.yahoo.com");
contents2.GetController().LoadURL(url2, content::Referrer(),
@@ -1861,8 +1862,8 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) {
// Create another NavigationController.
GURL url3("http://foo2");
- scoped_ptr<TestTabContents> other_contents(
- static_cast<TestTabContents*>(CreateTestWebContents()));
+ scoped_ptr<TestWebContents> other_contents(
+ static_cast<TestWebContents*>(CreateTestWebContents()));
NavigationControllerImpl& other_controller =
other_contents->GetControllerImpl();
other_contents->NavigateAndCommit(url3);
@@ -1890,8 +1891,8 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneTargetInterstitial) {
contents()->NavigateAndCommit(url1);
// Create another NavigationController.
- scoped_ptr<TestTabContents> other_contents(
- static_cast<TestTabContents*>(CreateTestWebContents()));
+ scoped_ptr<TestWebContents> other_contents(
+ static_cast<TestWebContents*>(CreateTestWebContents()));
NavigationControllerImpl& other_controller =
other_contents->GetControllerImpl();
diff --git a/content/browser/tab_contents/test_tab_contents.cc b/content/browser/tab_contents/test_web_contents.cc
index 31f15eb..da27f49 100644
--- a/content/browser/tab_contents/test_tab_contents.cc
+++ b/content/browser/tab_contents/test_web_contents.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include <utility>
@@ -17,14 +17,9 @@
#include "webkit/forms/password_form.h"
#include "webkit/glue/webkit_glue.h"
-using content::NavigationEntry;
-using content::RenderViewHost;
-using content::RenderViewHostImpl;
-using content::SiteInstance;
-using content::TestRenderViewHost;
-using content::WebContents;
+namespace content {
-TestTabContents::TestTabContents(content::BrowserContext* browser_context,
+TestWebContents::TestWebContents(BrowserContext* browser_context,
SiteInstance* instance)
: TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL),
transition_cross_site(false),
@@ -35,34 +30,34 @@ TestTabContents::TestTabContents(content::BrowserContext* browser_context,
expect_set_history_length_and_prune_min_page_id_(-1) {
}
-TestTabContents::~TestTabContents() {
+TestWebContents::~TestWebContents() {
}
-RenderViewHost* TestTabContents::GetPendingRenderViewHost() const {
+RenderViewHost* TestWebContents::GetPendingRenderViewHost() const {
return render_manager_.pending_render_view_host_;
}
-TestRenderViewHost* TestTabContents::pending_test_rvh() const {
+TestRenderViewHost* TestWebContents::pending_test_rvh() const {
return static_cast<TestRenderViewHost*>(GetPendingRenderViewHost());
}
-void TestTabContents::TestDidNavigate(RenderViewHost* render_view_host,
+void TestWebContents::TestDidNavigate(RenderViewHost* render_view_host,
int page_id,
const GURL& url,
- content::PageTransition transition) {
+ PageTransition transition) {
TestDidNavigateWithReferrer(render_view_host,
page_id,
url,
- content::Referrer(),
+ Referrer(),
transition);
}
-void TestTabContents::TestDidNavigateWithReferrer(
+void TestWebContents::TestDidNavigateWithReferrer(
RenderViewHost* render_view_host,
int page_id,
const GURL& url,
- const content::Referrer& referrer,
- content::PageTransition transition) {
+ const Referrer& referrer,
+ PageTransition transition) {
ViewHostMsg_FrameNavigate_Params params;
params.page_id = page_id;
@@ -83,11 +78,11 @@ void TestTabContents::TestDidNavigateWithReferrer(
DidNavigate(render_view_host, params);
}
-WebPreferences TestTabContents::TestGetWebkitPrefs() {
+WebPreferences TestWebContents::TestGetWebkitPrefs() {
return GetWebkitPrefs();
}
-bool TestTabContents::CreateRenderViewForRenderManager(
+bool TestWebContents::CreateRenderViewForRenderManager(
RenderViewHost* render_view_host) {
// This will go to a TestRenderViewHost.
static_cast<RenderViewHostImpl*>(
@@ -95,17 +90,17 @@ bool TestTabContents::CreateRenderViewForRenderManager(
return true;
}
-WebContents* TestTabContents::Clone() {
- TabContents* tc = new TestTabContents(
+WebContents* TestWebContents::Clone() {
+ TabContents* tc = new TestWebContents(
GetBrowserContext(),
SiteInstance::Create(GetBrowserContext()));
tc->GetControllerImpl().CopyStateFrom(controller_);
return tc;
}
-void TestTabContents::NavigateAndCommit(const GURL& url) {
+void TestWebContents::NavigateAndCommit(const GURL& url) {
GetController().LoadURL(
- url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
+ url, Referrer(), PAGE_TRANSITION_LINK, std::string());
GURL loaded_url(url);
bool reverse_on_redirect = false;
BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(
@@ -116,7 +111,7 @@ void TestTabContents::NavigateAndCommit(const GURL& url) {
CommitPendingNavigation();
}
-void TestTabContents::CommitPendingNavigation() {
+void TestWebContents::CommitPendingNavigation() {
// If we are doing a cross-site navigation, this simulates the current RVH
// notifying that it has unloaded so the pending RVH is resumed and can
// navigate.
@@ -142,12 +137,12 @@ void TestTabContents::CommitPendingNavigation() {
static_cast<RenderViewHostImpl*>(old_rvh)->OnSwapOutACK();
}
-int TestTabContents::GetNumberOfFocusCalls() {
+int TestWebContents::GetNumberOfFocusCalls() {
NOTREACHED();
return 0;
}
-void TestTabContents::ProceedWithCrossSiteNavigation() {
+void TestWebContents::ProceedWithCrossSiteNavigation() {
if (!GetPendingRenderViewHost())
return;
TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>(
@@ -155,13 +150,13 @@ void TestTabContents::ProceedWithCrossSiteNavigation() {
rvh->SendShouldCloseACK(true);
}
-content::RenderViewHostDelegate::View* TestTabContents::GetViewDelegate() {
+RenderViewHostDelegate::View* TestWebContents::GetViewDelegate() {
if (delegate_view_override_)
return delegate_view_override_;
return TabContents::GetViewDelegate();
}
-void TestTabContents::ExpectSetHistoryLengthAndPrune(
+void TestWebContents::ExpectSetHistoryLengthAndPrune(
const SiteInstance* site_instance,
int history_length,
int32 min_page_id) {
@@ -172,7 +167,7 @@ void TestTabContents::ExpectSetHistoryLengthAndPrune(
expect_set_history_length_and_prune_min_page_id_ = min_page_id;
}
-void TestTabContents::SetHistoryLengthAndPrune(
+void TestWebContents::SetHistoryLengthAndPrune(
const SiteInstance* site_instance, int history_length,
int32 min_page_id) {
EXPECT_TRUE(expect_set_history_length_and_prune_);
@@ -182,3 +177,5 @@ void TestTabContents::SetHistoryLengthAndPrune(
history_length);
EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id);
}
+
+} // namespace content
diff --git a/content/browser/tab_contents/test_tab_contents.h b/content/browser/tab_contents/test_web_contents.h
index a3e590f..aa2ea71 100644
--- a/content/browser/tab_contents/test_tab_contents.h
+++ b/content/browser/tab_contents/test_web_contents.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_
-#define CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_
+#ifndef CONTENT_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
+#define CONTENT_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
#pragma once
#include "content/browser/tab_contents/tab_contents.h"
@@ -14,41 +14,36 @@
class SiteInstanceImpl;
namespace content {
+
class RenderViewHost;
class TestRenderViewHost;
class WebContentsTester;
-}
// Subclass TabContents to ensure it creates TestRenderViewHosts
// and does not do anything involving views.
-//
-// TODO(joi): Rename TestWebContents.
-// TODO(joi): Move to content namespace.
-class TestTabContents : public TabContents, public content::WebContentsTester {
+class TestWebContents : public TabContents, public WebContentsTester {
public:
- TestTabContents(content::BrowserContext* browser_context,
- content::SiteInstance* instance);
- virtual ~TestTabContents();
+ TestWebContents(BrowserContext* browser_context, SiteInstance* instance);
+ virtual ~TestWebContents();
// WebContentsTester implementation.
virtual void CommitPendingNavigation() OVERRIDE;
virtual int GetNumberOfFocusCalls() OVERRIDE;
- virtual content::RenderViewHost* GetPendingRenderViewHost() const OVERRIDE;
+ virtual RenderViewHost* GetPendingRenderViewHost() const OVERRIDE;
virtual void NavigateAndCommit(const GURL& url) OVERRIDE;
virtual void ProceedWithCrossSiteNavigation() OVERRIDE;
- virtual void TestDidNavigate(content::RenderViewHost* render_view_host,
+ virtual void TestDidNavigate(RenderViewHost* render_view_host,
int page_id,
const GURL& url,
- content::PageTransition transition) OVERRIDE;
- virtual void TestDidNavigateWithReferrer(
- content::RenderViewHost* render_view_host,
- int page_id,
- const GURL& url,
- const content::Referrer& referrer,
- content::PageTransition transition) OVERRIDE;
+ PageTransition transition) OVERRIDE;
+ virtual void TestDidNavigateWithReferrer(RenderViewHost* render_view_host,
+ int page_id,
+ const GURL& url,
+ const Referrer& referrer,
+ PageTransition transition) OVERRIDE;
virtual WebPreferences TestGetWebkitPrefs() OVERRIDE;
- content::TestRenderViewHost* pending_test_rvh() const;
+ TestRenderViewHost* pending_test_rvh() const;
// State accessor.
bool cross_navigation_pending() {
@@ -61,39 +56,37 @@ class TestTabContents : public TabContents, public content::WebContentsTester {
// Prevent interaction with views.
virtual bool CreateRenderViewForRenderManager(
- content::RenderViewHost* render_view_host) OVERRIDE;
+ RenderViewHost* render_view_host) OVERRIDE;
virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {}
- // Returns a clone of this TestTabContents. The returned object is also a
- // TestTabContents. The caller owns the returned object.
- virtual content::WebContents* Clone() OVERRIDE;
+ // Returns a clone of this TestWebContents. The returned object is also a
+ // TestWebContents. The caller owns the returned object.
+ virtual WebContents* Clone() OVERRIDE;
// Set by individual tests.
bool transition_cross_site;
// Allow mocking of the RenderViewHostDelegate::View.
- virtual content::RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
- void set_view_delegate(content::RenderViewHostDelegate::View* view) {
+ virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
+ void set_view_delegate(RenderViewHostDelegate::View* view) {
delegate_view_override_ = view;
}
// Establish expected arguments for |SetHistoryLengthAndPrune()|. When
// |SetHistoryLengthAndPrune()| is called, the arguments are compared
// with the expected arguments specified here.
- void ExpectSetHistoryLengthAndPrune(
- const content::SiteInstance* site_instance,
- int history_length,
- int32 min_page_id);
+ void ExpectSetHistoryLengthAndPrune(const SiteInstance* site_instance,
+ int history_length,
+ int32 min_page_id);
// Compares the arguments passed in with the expected arguments passed in
// to |ExpectSetHistoryLengthAndPrune()|.
- virtual void SetHistoryLengthAndPrune(
- const content::SiteInstance* site_instance,
- int history_length,
- int32 min_page_id) OVERRIDE;
+ virtual void SetHistoryLengthAndPrune(const SiteInstance* site_instance,
+ int history_length,
+ int32 min_page_id) OVERRIDE;
private:
- content::RenderViewHostDelegate::View* delegate_view_override_;
+ RenderViewHostDelegate::View* delegate_view_override_;
// Expectations for arguments of |SetHistoryLengthAndPrune()|.
bool expect_set_history_length_and_prune_;
@@ -103,4 +96,6 @@ class TestTabContents : public TabContents, public content::WebContentsTester {
int32 expect_set_history_length_and_prune_min_page_id_;
};
-#endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_
+} // namespace content
+
+#endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
diff --git a/content/browser/tab_contents/web_drag_dest_mac_unittest.mm b/content/browser/tab_contents/web_drag_dest_mac_unittest.mm
index 0502581..e04400c 100644
--- a/content/browser/tab_contents/web_drag_dest_mac_unittest.mm
+++ b/content/browser/tab_contents/web_drag_dest_mac_unittest.mm
@@ -7,7 +7,7 @@
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
#include "content/browser/renderer_host/test_render_view_host.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#import "content/browser/tab_contents/web_drag_dest_mac.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "third_party/mozilla/NSPasteboard+Utils.h"
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index f43fa94..41e442b 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -42,8 +42,8 @@
'browser/renderer_host/test_backing_store.h',
'browser/renderer_host/test_render_view_host.cc',
'browser/renderer_host/test_render_view_host.h',
- 'browser/tab_contents/test_tab_contents.cc',
- 'browser/tab_contents/test_tab_contents.h',
+ 'browser/tab_contents/test_web_contents.cc',
+ 'browser/tab_contents/test_web_contents.h',
'common/test_url_constants.cc',
'common/test_url_constants.h',
'gpu/gpu_idirect3d9_mock_win.cc',
diff --git a/content/test/test_renderer_host.cc b/content/test/test_renderer_host.cc
index 7c99439..21df81b 100644
--- a/content/test/test_renderer_host.cc
+++ b/content/test/test_renderer_host.cc
@@ -8,7 +8,7 @@
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/tab_contents/navigation_entry_impl.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
#include "content/public/browser/web_contents.h"
#include "content/test/mock_render_process_host.h"
#include "content/test/test_browser_context.h"
@@ -141,7 +141,7 @@ RenderViewHost* RenderViewHostTestHarness::rvh() {
}
RenderViewHost* RenderViewHostTestHarness::pending_rvh() {
- return static_cast<TestTabContents*>(web_contents())->
+ return static_cast<TestWebContents*>(web_contents())->
GetRenderManagerForTesting()->pending_render_view_host();
}
@@ -173,11 +173,11 @@ WebContents* RenderViewHostTestHarness::CreateTestWebContents() {
// This will be deleted when the TabContents goes away.
SiteInstance* instance = SiteInstance::Create(browser_context_.get());
- return new TestTabContents(browser_context_.get(), instance);
+ return new TestWebContents(browser_context_.get(), instance);
}
void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) {
- static_cast<TestTabContents*>(web_contents())->NavigateAndCommit(url);
+ static_cast<TestWebContents*>(web_contents())->NavigateAndCommit(url);
}
void RenderViewHostTestHarness::Reload() {
diff --git a/content/test/web_contents_tester.cc b/content/test/web_contents_tester.cc
index afe2802..e58054a 100644
--- a/content/test/web_contents_tester.cc
+++ b/content/test/web_contents_tester.cc
@@ -4,7 +4,7 @@
#include "content/test/web_contents_tester.h"
-#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/browser/tab_contents/test_web_contents.h"
namespace content {
@@ -13,11 +13,11 @@ namespace {
// The two subclasses here are instantiated via the deprecated
// CreateWebContentsFor... factories below.
-class TestTabContentsCountFocus : public TestTabContents {
+class TestWebContentsCountFocus : public TestWebContents {
public:
- TestTabContentsCountFocus(content::BrowserContext* browser_context,
+ TestWebContentsCountFocus(content::BrowserContext* browser_context,
content::SiteInstance* instance)
- : TestTabContents(browser_context, instance), focus_called_(0) {
+ : TestWebContents(browser_context, instance), focus_called_(0) {
}
virtual int GetNumberOfFocusCalls() OVERRIDE {
@@ -32,12 +32,12 @@ class TestTabContentsCountFocus : public TestTabContents {
int focus_called_;
};
-class TestTabContentsCountSetFocusToLocationBar : public TestTabContents {
+class TestWebContentsCountSetFocusToLocationBar : public TestWebContents {
public:
- TestTabContentsCountSetFocusToLocationBar(
+ TestWebContentsCountSetFocusToLocationBar(
content::BrowserContext* browser_context,
SiteInstance* instance)
- : TestTabContents(browser_context, instance), focus_called_(0) {
+ : TestWebContents(browser_context, instance), focus_called_(0) {
}
virtual void SetFocusToLocationBar(bool select_all) { ++focus_called_; }
@@ -53,21 +53,21 @@ class TestTabContentsCountSetFocusToLocationBar : public TestTabContents {
// static
WebContentsTester* WebContentsTester::For(WebContents* contents) {
- return static_cast<TestTabContents*>(contents);
+ return static_cast<TestWebContents*>(contents);
}
// static
WebContents* WebContentsTester::CreateTestWebContents(
BrowserContext* browser_context,
SiteInstance* instance) {
- return new TestTabContents(browser_context, instance);
+ return new TestWebContents(browser_context, instance);
}
// static
WebContents* WebContentsTester::CreateTestWebContentsCountSetFocusToLocationBar(
BrowserContext* browser_context,
SiteInstance* instance) {
- return new TestTabContentsCountSetFocusToLocationBar(
+ return new TestWebContentsCountSetFocusToLocationBar(
browser_context, instance);
}
@@ -75,7 +75,7 @@ WebContents* WebContentsTester::CreateTestWebContentsCountSetFocusToLocationBar(
WebContents* WebContentsTester::CreateTestWebContentsCountFocus(
BrowserContext* browser_context,
SiteInstance* instance) {
- return new TestTabContentsCountFocus(browser_context, instance);
+ return new TestWebContentsCountFocus(browser_context, instance);
}
} // namespace content