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.h" | 8 #include "content/browser/renderer_host/render_view_host.h" |
9 #include "content/browser/renderer_host/render_widget_host_view.h" | 9 #include "content/browser/renderer_host/render_widget_host_view.h" |
10 #include "content/browser/renderer_host/test_render_view_host.h" | 10 #include "content/browser/renderer_host/test_render_view_host.h" |
11 #include "content/browser/site_instance_impl.h" | 11 #include "content/browser/site_instance_impl.h" |
12 #include "content/browser/tab_contents/interstitial_page.h" | 12 #include "content/browser/tab_contents/interstitial_page.h" |
13 #include "content/browser/tab_contents/navigation_entry_impl.h" | 13 #include "content/browser/tab_contents/navigation_entry_impl.h" |
14 #include "content/browser/tab_contents/test_tab_contents.h" | 14 #include "content/browser/tab_contents/test_tab_contents.h" |
15 #include "content/common/view_messages.h" | 15 #include "content/common/view_messages.h" |
16 #include "content/public/browser/navigation_details.h" | 16 #include "content/public/browser/navigation_details.h" |
17 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
18 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
20 #include "content/public/browser/web_ui_controller.h" | 20 #include "content/public/browser/web_ui_controller.h" |
21 #include "content/public/browser/web_ui_controller_factory.h" | 21 #include "content/public/browser/web_ui_controller_factory.h" |
22 #include "content/public/common/bindings_policy.h" | 22 #include "content/public/common/bindings_policy.h" |
23 #include "content/public/common/content_constants.h" | 23 #include "content/public/common/content_constants.h" |
24 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
25 #include "content/test/test_browser_thread.h" | 25 #include "content/test/test_browser_thread.h" |
| 26 #include "googleurl/src/url_util.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
27 #include "webkit/glue/webkit_glue.h" | 28 #include "webkit/glue/webkit_glue.h" |
28 | 29 |
29 using content::BrowserContext; | 30 using content::BrowserContext; |
30 using content::BrowserThread; | 31 using content::BrowserThread; |
31 using content::NavigationEntry; | 32 using content::NavigationEntry; |
32 using content::NavigationEntryImpl; | 33 using content::NavigationEntryImpl; |
33 using content::SiteInstance; | 34 using content::SiteInstance; |
34 using content::WebContents; | 35 using content::WebContents; |
35 using content::WebUI; | 36 using content::WebUI; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 }; | 225 }; |
225 | 226 |
226 class TabContentsTest : public RenderViewHostTestHarness { | 227 class TabContentsTest : public RenderViewHostTestHarness { |
227 public: | 228 public: |
228 TabContentsTest() | 229 TabContentsTest() |
229 : ui_thread_(BrowserThread::UI, &message_loop_), | 230 : ui_thread_(BrowserThread::UI, &message_loop_), |
230 old_browser_client_(NULL) { | 231 old_browser_client_(NULL) { |
231 } | 232 } |
232 | 233 |
233 virtual void SetUp() { | 234 virtual void SetUp() { |
| 235 // These tests treat tabcontentstest as a privileged WebUI scheme. |
| 236 // We must register it similarly to kChromeUIScheme. |
| 237 url_util::AddStandardScheme("tabcontentstest"); |
| 238 |
234 old_browser_client_ = content::GetContentClient()->browser(); | 239 old_browser_client_ = content::GetContentClient()->browser(); |
235 content::GetContentClient()->set_browser(&browser_client_); | 240 content::GetContentClient()->set_browser(&browser_client_); |
236 RenderViewHostTestHarness::SetUp(); | 241 RenderViewHostTestHarness::SetUp(); |
237 } | 242 } |
238 | 243 |
239 virtual void TearDown() { | 244 virtual void TearDown() { |
240 content::GetContentClient()->set_browser(old_browser_client_); | 245 content::GetContentClient()->set_browser(old_browser_client_); |
241 RenderViewHostTestHarness::TearDown(); | 246 RenderViewHostTestHarness::TearDown(); |
242 } | 247 } |
243 | 248 |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 | 1843 |
1839 // It should have a transient entry. | 1844 // It should have a transient entry. |
1840 EXPECT_TRUE(other_controller.GetTransientEntry()); | 1845 EXPECT_TRUE(other_controller.GetTransientEntry()); |
1841 | 1846 |
1842 // And the interstitial should be showing. | 1847 // And the interstitial should be showing. |
1843 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); | 1848 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); |
1844 | 1849 |
1845 // And the interstitial should do a reload on don't proceed. | 1850 // And the interstitial should do a reload on don't proceed. |
1846 EXPECT_TRUE(other_contents->GetInterstitialPage()->reload_on_dont_proceed()); | 1851 EXPECT_TRUE(other_contents->GetInterstitialPage()->reload_on_dont_proceed()); |
1847 } | 1852 } |
OLD | NEW |