OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 12 matching lines...) Expand all Loading... |
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 "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
27 #include "webkit/glue/webkit_glue.h" | 27 #include "webkit/glue/webkit_glue.h" |
28 | 28 |
29 using content::BrowserThread; | 29 using content::BrowserThread; |
30 using content::NavigationEntry; | 30 using content::NavigationEntry; |
31 using content::NavigationEntryImpl; | 31 using content::NavigationEntryImpl; |
32 using content::WebContents; | 32 using content::WebContents; |
| 33 using content::WebUIController; |
33 using webkit::forms::PasswordForm; | 34 using webkit::forms::PasswordForm; |
34 | 35 |
35 namespace { | 36 namespace { |
36 | 37 |
37 class TabContentsTestWebUIFactory : public content::EmptyWebUIFactory { | 38 class TabContentsTestWebUIFactory : public content::EmptyWebUIFactory { |
38 public: | 39 public: |
39 virtual WebUI* CreateWebUIForURL(WebContents* source, | 40 virtual WebUIController* CreateWebUIForURL(WebUI* web_ui, |
40 const GURL& url) const OVERRIDE { | 41 const GURL& url) const OVERRIDE { |
41 if (!HasWebUIScheme(url)) | 42 if (!HasWebUIScheme(url)) |
42 return NULL; | 43 return NULL; |
43 | 44 |
44 static content::WebUIController temp_controller; | 45 return new WebUIController(web_ui); |
45 return new WebUI(source, &temp_controller); | |
46 } | 46 } |
47 | 47 |
48 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, | 48 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, |
49 const GURL& url) const OVERRIDE { | 49 const GURL& url) const OVERRIDE { |
50 return HasWebUIScheme(url); | 50 return HasWebUIScheme(url); |
51 } | 51 } |
52 | 52 |
53 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE { | 53 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE { |
54 return url.SchemeIs("tabcontentstest"); | 54 return url.SchemeIs("tabcontentstest"); |
55 } | 55 } |
56 | 56 |
57 virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context, | 57 virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context, |
58 const GURL& url) const { | 58 const GURL& url) const { |
59 return HasWebUIScheme(url); | 59 return HasWebUIScheme(url); |
60 } | 60 } |
61 | |
62 }; | 61 }; |
63 | 62 |
64 class TabContentsTestBrowserClient : public content::MockContentBrowserClient { | 63 class TabContentsTestBrowserClient : public content::MockContentBrowserClient { |
65 public: | 64 public: |
66 TabContentsTestBrowserClient() { | 65 TabContentsTestBrowserClient() { |
67 } | 66 } |
68 | 67 |
69 virtual content::WebUIFactory* GetWebUIFactory() OVERRIDE { | 68 virtual content::WebUIFactory* GetWebUIFactory() OVERRIDE { |
70 return &factory_; | 69 return &factory_; |
71 } | 70 } |
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 | 1823 |
1825 // It should have a transient entry. | 1824 // It should have a transient entry. |
1826 EXPECT_TRUE(other_controller.GetTransientEntry()); | 1825 EXPECT_TRUE(other_controller.GetTransientEntry()); |
1827 | 1826 |
1828 // And the interstitial should be showing. | 1827 // And the interstitial should be showing. |
1829 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); | 1828 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); |
1830 | 1829 |
1831 // And the interstitial should do a reload on don't proceed. | 1830 // And the interstitial should do a reload on don't proceed. |
1832 EXPECT_TRUE(other_contents->GetInterstitialPage()->reload_on_dont_proceed()); | 1831 EXPECT_TRUE(other_contents->GetInterstitialPage()->reload_on_dont_proceed()); |
1833 } | 1832 } |
OLD | NEW |