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

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

Issue 9706012: Add abstractions that let embedders drive tests of WebContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove CONTENT_EXPORT on statically linked functions. Merge to head for commit. Created 8 years, 9 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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "content/browser/browser_thread_impl.h" 6 #include "content/browser/browser_thread_impl.h"
7 #include "content/browser/mock_content_browser_client.h" 7 #include "content/browser/mock_content_browser_client.h"
8 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
9 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/tab_contents/navigation_controller_impl.h" 10 #include "content/browser/tab_contents/navigation_controller_impl.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManagerTestBrowserClient); 126 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManagerTestBrowserClient);
127 }; 127 };
128 128
129 } // namespace 129 } // namespace
130 130
131 class RenderViewHostManagerTest 131 class RenderViewHostManagerTest
132 : public RenderViewHostImplTestHarness { 132 : public RenderViewHostImplTestHarness {
133 public: 133 public:
134 virtual void SetUp() OVERRIDE { 134 virtual void SetUp() OVERRIDE {
135 RenderViewHostTestHarness::SetUp(); 135 RenderViewHostImplTestHarness::SetUp();
136 old_client_ = content::GetContentClient(); 136 old_client_ = content::GetContentClient();
137 old_browser_client_ = content::GetContentClient()->browser();
137 content::SetContentClient(&client_); 138 content::SetContentClient(&client_);
138 old_browser_client_ = content::GetContentClient()->browser();
139 content::GetContentClient()->set_browser(&browser_client_); 139 content::GetContentClient()->set_browser(&browser_client_);
140 url_util::AddStandardScheme(chrome::kChromeUIScheme); 140 url_util::AddStandardScheme(chrome::kChromeUIScheme);
141 } 141 }
142 142
143 virtual void TearDown() OVERRIDE { 143 virtual void TearDown() OVERRIDE {
144 RenderViewHostTestHarness::TearDown(); 144 RenderViewHostImplTestHarness::TearDown();
145 content::GetContentClient()->set_browser(old_browser_client_); 145 content::GetContentClient()->set_browser(old_browser_client_);
146 content::SetContentClient(old_client_); 146 content::SetContentClient(old_client_);
147 } 147 }
148 148
149 void set_should_create_webui(bool should_create_webui) { 149 void set_should_create_webui(bool should_create_webui) {
150 browser_client_.set_should_create_webui(should_create_webui); 150 browser_client_.set_should_create_webui(should_create_webui);
151 } 151 }
152 152
153 void NavigateActiveAndCommit(const GURL& url) { 153 void NavigateActiveAndCommit(const GURL& url) {
154 // Note: we navigate the active RenderViewHost because previous navigations 154 // Note: we navigate the active RenderViewHost because previous navigations
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 762
763 // We should be able to navigate forward. 763 // We should be able to navigate forward.
764 contents()->GetController().GoForward(); 764 contents()->GetController().GoForward();
765 contents()->ProceedWithCrossSiteNavigation(); 765 contents()->ProceedWithCrossSiteNavigation();
766 const NavigationEntry* entry2 = contents()->GetController().GetPendingEntry(); 766 const NavigationEntry* entry2 = contents()->GetController().GetPendingEntry();
767 rvh2->SendNavigate(entry2->GetPageID(), entry2->GetURL()); 767 rvh2->SendNavigate(entry2->GetPageID(), entry2->GetURL());
768 EXPECT_EQ(rvh2, rvh()); 768 EXPECT_EQ(rvh2, rvh());
769 EXPECT_FALSE(rvh2->is_swapped_out()); 769 EXPECT_FALSE(rvh2->is_swapped_out());
770 EXPECT_TRUE(rvh1->is_swapped_out()); 770 EXPECT_TRUE(rvh1->is_swapped_out());
771 } 771 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698