| OLD | NEW |
| 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/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.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/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 9 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
| 10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 old_browser_client_(NULL) { | 274 old_browser_client_(NULL) { |
| 275 } | 275 } |
| 276 | 276 |
| 277 virtual void SetUp() { | 277 virtual void SetUp() { |
| 278 // These tests treat tabcontentstest as a privileged WebUI scheme. | 278 // These tests treat tabcontentstest as a privileged WebUI scheme. |
| 279 // We must register it similarly to kChromeUIScheme. | 279 // We must register it similarly to kChromeUIScheme. |
| 280 url_util::AddStandardScheme("tabcontentstest"); | 280 url_util::AddStandardScheme("tabcontentstest"); |
| 281 | 281 |
| 282 old_client_ = content::GetContentClient(); | 282 old_client_ = content::GetContentClient(); |
| 283 old_browser_client_ = content::GetContentClient()->browser(); | 283 old_browser_client_ = content::GetContentClient()->browser(); |
| 284 content::SetContentClient(&client_); | 284 old_user_agent_ = content::GetUserAgent(); |
| 285 content::Initialize(&client_, "TabContentsTest"); |
| 285 content::GetContentClient()->set_browser(&browser_client_); | 286 content::GetContentClient()->set_browser(&browser_client_); |
| 286 RenderViewHostImplTestHarness::SetUp(); | 287 RenderViewHostImplTestHarness::SetUp(); |
| 287 } | 288 } |
| 288 | 289 |
| 289 virtual void TearDown() { | 290 virtual void TearDown() { |
| 290 content::GetContentClient()->set_browser(old_browser_client_); | 291 content::GetContentClient()->set_browser(old_browser_client_); |
| 291 content::SetContentClient(old_client_); | 292 content::Initialize(old_client_, old_user_agent_); |
| 292 RenderViewHostImplTestHarness::TearDown(); | 293 RenderViewHostImplTestHarness::TearDown(); |
| 293 } | 294 } |
| 294 | 295 |
| 295 private: | 296 private: |
| 296 TabContentsTestClient client_; | 297 TabContentsTestClient client_; |
| 297 TabContentsTestBrowserClient browser_client_; | 298 TabContentsTestBrowserClient browser_client_; |
| 298 content::TestBrowserThread ui_thread_; | 299 content::TestBrowserThread ui_thread_; |
| 299 content::ContentClient* old_client_; | 300 content::ContentClient* old_client_; |
| 300 content::ContentBrowserClient* old_browser_client_; | 301 content::ContentBrowserClient* old_browser_client_; |
| 302 std::string old_user_agent_; |
| 301 }; | 303 }; |
| 302 | 304 |
| 303 } // namespace | 305 } // namespace |
| 304 | 306 |
| 305 // Test to make sure that title updates get stripped of whitespace. | 307 // Test to make sure that title updates get stripped of whitespace. |
| 306 TEST_F(TabContentsTest, UpdateTitle) { | 308 TEST_F(TabContentsTest, UpdateTitle) { |
| 307 NavigationControllerImpl& cont = | 309 NavigationControllerImpl& cont = |
| 308 static_cast<NavigationControllerImpl&>(controller()); | 310 static_cast<NavigationControllerImpl&>(controller()); |
| 309 ViewHostMsg_FrameNavigate_Params params; | 311 ViewHostMsg_FrameNavigate_Params params; |
| 310 InitNavigateParams(¶ms, 0, GURL(chrome::kAboutBlankURL), | 312 InitNavigateParams(¶ms, 0, GURL(chrome::kAboutBlankURL), |
| (...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 // It should have a transient entry. | 1930 // It should have a transient entry. |
| 1929 EXPECT_TRUE(other_controller.GetTransientEntry()); | 1931 EXPECT_TRUE(other_controller.GetTransientEntry()); |
| 1930 | 1932 |
| 1931 // And the interstitial should be showing. | 1933 // And the interstitial should be showing. |
| 1932 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); | 1934 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); |
| 1933 | 1935 |
| 1934 // And the interstitial should do a reload on don't proceed. | 1936 // And the interstitial should do a reload on don't proceed. |
| 1935 EXPECT_TRUE(static_cast<InterstitialPageImpl*>( | 1937 EXPECT_TRUE(static_cast<InterstitialPageImpl*>( |
| 1936 other_contents->GetInterstitialPage())->reload_on_dont_proceed()); | 1938 other_contents->GetInterstitialPage())->reload_on_dont_proceed()); |
| 1937 } | 1939 } |
| OLD | NEW |