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

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

Issue 9188056: Start splitting out WebUI into an implementation class and an interface that each page implements... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 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"
11 #include "content/browser/site_instance.h" 11 #include "content/browser/site_instance.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/browser/webui/empty_web_ui_factory.h" 15 #include "content/browser/webui/empty_web_ui_factory.h"
16 #include "content/common/view_messages.h" 16 #include "content/common/view_messages.h"
17 #include "content/public/browser/navigation_details.h" 17 #include "content/public/browser/navigation_details.h"
18 #include "content/public/browser/notification_details.h" 18 #include "content/public/browser/notification_details.h"
19 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
20 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
21 #include "content/public/browser/web_ui_controller.h"
21 #include "content/public/common/bindings_policy.h" 22 #include "content/public/common/bindings_policy.h"
22 #include "content/public/common/content_constants.h" 23 #include "content/public/common/content_constants.h"
23 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
24 #include "content/test/test_browser_thread.h" 25 #include "content/test/test_browser_thread.h"
25 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
26 #include "webkit/glue/webkit_glue.h" 27 #include "webkit/glue/webkit_glue.h"
27 28
28 using content::BrowserThread; 29 using content::BrowserThread;
29 using content::NavigationEntry; 30 using content::NavigationEntry;
30 using content::NavigationEntryImpl; 31 using content::NavigationEntryImpl;
31 using content::WebContents; 32 using content::WebContents;
32 using webkit::forms::PasswordForm; 33 using webkit::forms::PasswordForm;
33 34
34 namespace { 35 namespace {
35 36
36 class TabContentsTestWebUIFactory : public content::EmptyWebUIFactory { 37 class TabContentsTestWebUIFactory : public content::EmptyWebUIFactory {
37 public: 38 public:
38 virtual WebUI* CreateWebUIForURL(WebContents* source, 39 virtual WebUI* CreateWebUIForURL(WebContents* source,
39 const GURL& url) const OVERRIDE { 40 const GURL& url) const OVERRIDE {
40 if (!HasWebUIScheme(url)) 41 if (!HasWebUIScheme(url))
41 return NULL; 42 return NULL;
42 43
43 return new WebUI(source); 44 static content::WebUIController temp_controller;
45 return new WebUI(source, &temp_controller);
44 } 46 }
45 47
46 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, 48 virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
47 const GURL& url) const OVERRIDE { 49 const GURL& url) const OVERRIDE {
48 return HasWebUIScheme(url); 50 return HasWebUIScheme(url);
49 } 51 }
50 52
51 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE { 53 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE {
52 return url.SchemeIs("tabcontentstest"); 54 return url.SchemeIs("tabcontentstest");
53 } 55 }
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 1824
1823 // It should have a transient entry. 1825 // It should have a transient entry.
1824 EXPECT_TRUE(other_controller.GetTransientEntry()); 1826 EXPECT_TRUE(other_controller.GetTransientEntry());
1825 1827
1826 // And the interstitial should be showing. 1828 // And the interstitial should be showing.
1827 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); 1829 EXPECT_TRUE(other_contents->ShowingInterstitialPage());
1828 1830
1829 // And the interstitial should do a reload on don't proceed. 1831 // And the interstitial should do a reload on don't proceed.
1830 EXPECT_TRUE(other_contents->GetInterstitialPage()->reload_on_dont_proceed()); 1832 EXPECT_TRUE(other_contents->GetInterstitialPage()->reload_on_dont_proceed());
1831 } 1833 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/render_view_host_manager_unittest.cc ('k') | content/browser/webui/web_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698