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 #ifndef CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ | 5 #ifndef CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ |
6 #define CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ | 6 #define CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/scoped_temp_dir.h" | 13 #include "base/scoped_temp_dir.h" |
14 #include "content/public/browser/content_browser_client.h" | 14 #include "content/public/browser/content_browser_client.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // Base for unit tests that need to mock the ContentBrowserClient. | 18 // Base for unit tests that need to mock the ContentBrowserClient. |
19 class MockContentBrowserClient : public ContentBrowserClient { | 19 class MockContentBrowserClient : public ContentBrowserClient { |
20 public: | 20 public: |
21 MockContentBrowserClient(); | 21 MockContentBrowserClient(); |
22 virtual ~MockContentBrowserClient(); | 22 virtual ~MockContentBrowserClient(); |
23 | 23 |
24 virtual BrowserMainParts* CreateBrowserMainParts( | 24 virtual BrowserMainParts* CreateBrowserMainParts( |
25 const content::MainFunctionParams& parameters) OVERRIDE; | 25 const MainFunctionParams& parameters) OVERRIDE; |
26 virtual WebContentsView* CreateWebContentsView( | 26 virtual WebContentsView* CreateWebContentsView( |
27 WebContents* web_contents) OVERRIDE; | 27 WebContents* web_contents) OVERRIDE; |
28 virtual void RenderViewHostCreated( | 28 virtual void RenderViewHostCreated( |
29 RenderViewHost* render_view_host) OVERRIDE; | 29 RenderViewHost* render_view_host) OVERRIDE; |
30 virtual void RenderProcessHostCreated( | 30 virtual void RenderProcessHostCreated( |
31 RenderProcessHost* host) OVERRIDE; | 31 RenderProcessHost* host) OVERRIDE; |
32 virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE; | 32 virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE; |
33 virtual GURL GetEffectiveURL(content::BrowserContext* browser_context, | 33 virtual GURL GetEffectiveURL(BrowserContext* browser_context, |
34 const GURL& url) OVERRIDE; | 34 const GURL& url) OVERRIDE; |
35 virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context, | 35 virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context, |
36 const GURL& effective_url) OVERRIDE; | 36 const GURL& effective_url) OVERRIDE; |
37 virtual bool IsHandledURL(const GURL& url) OVERRIDE; | 37 virtual bool IsHandledURL(const GURL& url) OVERRIDE; |
38 virtual bool IsSuitableHost(RenderProcessHost* process_host, | 38 virtual bool IsSuitableHost(RenderProcessHost* process_host, |
39 const GURL& site_url) OVERRIDE; | 39 const GURL& site_url) OVERRIDE; |
40 virtual bool ShouldTryToUseExistingProcessHost( | 40 virtual bool ShouldTryToUseExistingProcessHost( |
41 BrowserContext* browser_context, const GURL& url) OVERRIDE; | 41 BrowserContext* browser_context, const GURL& url) OVERRIDE; |
42 virtual void SiteInstanceGotProcess(SiteInstance* site_instance) OVERRIDE; | 42 virtual void SiteInstanceGotProcess(SiteInstance* site_instance) OVERRIDE; |
43 virtual void SiteInstanceDeleting(SiteInstance* site_instance) OVERRIDE; | 43 virtual void SiteInstanceDeleting(SiteInstance* site_instance) OVERRIDE; |
44 virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url, | 44 virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url, |
45 const GURL& new_url) OVERRIDE; | 45 const GURL& new_url) OVERRIDE; |
46 virtual std::string GetCanonicalEncodingNameByAliasName( | 46 virtual std::string GetCanonicalEncodingNameByAliasName( |
47 const std::string& alias_name) OVERRIDE; | 47 const std::string& alias_name) OVERRIDE; |
48 virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, | 48 virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, |
49 int child_process_id) OVERRIDE; | 49 int child_process_id) OVERRIDE; |
50 virtual std::string GetApplicationLocale() OVERRIDE; | 50 virtual std::string GetApplicationLocale() OVERRIDE; |
51 virtual std::string GetAcceptLangs( | 51 virtual std::string GetAcceptLangs(BrowserContext* context) OVERRIDE; |
52 content::BrowserContext* context) OVERRIDE; | |
53 virtual SkBitmap* GetDefaultFavicon() OVERRIDE; | 52 virtual SkBitmap* GetDefaultFavicon() OVERRIDE; |
54 virtual bool AllowAppCache(const GURL& manifest_url, | 53 virtual bool AllowAppCache(const GURL& manifest_url, |
55 const GURL& first_party, | 54 const GURL& first_party, |
56 content::ResourceContext* context) OVERRIDE; | 55 ResourceContext* context) OVERRIDE; |
57 virtual bool AllowGetCookie(const GURL& url, | 56 virtual bool AllowGetCookie(const GURL& url, |
58 const GURL& first_party, | 57 const GURL& first_party, |
59 const net::CookieList& cookie_list, | 58 const net::CookieList& cookie_list, |
60 content::ResourceContext* context, | 59 ResourceContext* context, |
61 int render_process_id, | 60 int render_process_id, |
62 int render_view_id) OVERRIDE; | 61 int render_view_id) OVERRIDE; |
63 virtual bool AllowSetCookie(const GURL& url, | 62 virtual bool AllowSetCookie(const GURL& url, |
64 const GURL& first_party, | 63 const GURL& first_party, |
65 const std::string& cookie_line, | 64 const std::string& cookie_line, |
66 content::ResourceContext* context, | 65 ResourceContext* context, |
67 int render_process_id, | 66 int render_process_id, |
68 int render_view_id, | 67 int render_view_id, |
69 net::CookieOptions* options) OVERRIDE; | 68 net::CookieOptions* options) OVERRIDE; |
70 virtual bool AllowSaveLocalState( | 69 virtual bool AllowSaveLocalState(ResourceContext* context) OVERRIDE; |
71 content::ResourceContext* context) OVERRIDE; | |
72 virtual bool AllowWorkerDatabase( | 70 virtual bool AllowWorkerDatabase( |
73 const GURL& url, | 71 const GURL& url, |
74 const string16& name, | 72 const string16& name, |
75 const string16& display_name, | 73 const string16& display_name, |
76 unsigned long estimated_size, | 74 unsigned long estimated_size, |
77 content::ResourceContext* context, | 75 ResourceContext* context, |
78 const std::vector<std::pair<int, int> >& render_views) OVERRIDE; | 76 const std::vector<std::pair<int, int> >& render_views) OVERRIDE; |
79 virtual bool AllowWorkerFileSystem( | 77 virtual bool AllowWorkerFileSystem( |
80 const GURL& url, | 78 const GURL& url, |
81 content::ResourceContext* context, | 79 ResourceContext* context, |
82 const std::vector<std::pair<int, int> >& render_views) OVERRIDE; | 80 const std::vector<std::pair<int, int> >& render_views) OVERRIDE; |
83 virtual net::URLRequestContext* OverrideRequestContextForURL( | 81 virtual net::URLRequestContext* OverrideRequestContextForURL( |
84 const GURL& url, content::ResourceContext* context) OVERRIDE; | 82 const GURL& url, ResourceContext* context) OVERRIDE; |
85 virtual QuotaPermissionContext* CreateQuotaPermissionContext() OVERRIDE; | 83 virtual QuotaPermissionContext* CreateQuotaPermissionContext() OVERRIDE; |
86 virtual void OpenItem(const FilePath& path) OVERRIDE; | 84 virtual void OpenItem(const FilePath& path) OVERRIDE; |
87 virtual void ShowItemInFolder(const FilePath& path) OVERRIDE; | 85 virtual void ShowItemInFolder(const FilePath& path) OVERRIDE; |
88 virtual void AllowCertificateError( | 86 virtual void AllowCertificateError( |
89 int render_process_id, | 87 int render_process_id, |
90 int render_view_id, | 88 int render_view_id, |
91 int cert_error, | 89 int cert_error, |
92 const net::SSLInfo& ssl_info, | 90 const net::SSLInfo& ssl_info, |
93 const GURL& request_url, | 91 const GURL& request_url, |
94 bool overridable, | 92 bool overridable, |
95 const base::Callback<void(bool)>& callback, | 93 const base::Callback<void(bool)>& callback, |
96 bool* cancel_request) OVERRIDE; | 94 bool* cancel_request) OVERRIDE; |
97 virtual void SelectClientCertificate( | 95 virtual void SelectClientCertificate( |
98 int render_process_id, | 96 int render_process_id, |
99 int render_view_id, | 97 int render_view_id, |
100 const net::HttpNetworkSession* network_session, | 98 const net::HttpNetworkSession* network_session, |
101 net::SSLCertRequestInfo* cert_request_info, | 99 net::SSLCertRequestInfo* cert_request_info, |
102 const base::Callback<void(net::X509Certificate*)>& callback) OVERRIDE; | 100 const base::Callback<void(net::X509Certificate*)>& callback) OVERRIDE; |
103 virtual void AddNewCertificate( | 101 virtual void AddNewCertificate( |
104 net::URLRequest* request, | 102 net::URLRequest* request, |
105 net::X509Certificate* cert, | 103 net::X509Certificate* cert, |
106 int render_process_id, | 104 int render_process_id, |
107 int render_view_id) OVERRIDE; | 105 int render_view_id) OVERRIDE; |
108 virtual void RequestMediaAccessPermission( | 106 virtual void RequestMediaAccessPermission( |
109 const content::MediaStreamRequest* request, | 107 const MediaStreamRequest* request, |
110 const content::MediaResponseCallback& callback) OVERRIDE; | 108 const MediaResponseCallback& callback) OVERRIDE; |
111 virtual void RequestDesktopNotificationPermission( | 109 virtual void RequestDesktopNotificationPermission( |
112 const GURL& source_origin, | 110 const GURL& source_origin, |
113 int callback_context, | 111 int callback_context, |
114 int render_process_id, | 112 int render_process_id, |
115 int render_view_id) OVERRIDE; | 113 int render_view_id) OVERRIDE; |
116 virtual WebKit::WebNotificationPresenter::Permission | 114 virtual WebKit::WebNotificationPresenter::Permission |
117 CheckDesktopNotificationPermission( | 115 CheckDesktopNotificationPermission( |
118 const GURL& source_origin, | 116 const GURL& source_origin, |
119 content::ResourceContext* context, | 117 ResourceContext* context, |
120 int render_process_id) OVERRIDE; | 118 int render_process_id) OVERRIDE; |
121 virtual void ShowDesktopNotification( | 119 virtual void ShowDesktopNotification( |
122 const content::ShowDesktopNotificationHostMsgParams& params, | 120 const content::ShowDesktopNotificationHostMsgParams& params, |
123 int render_process_id, | 121 int render_process_id, |
124 int render_view_id, | 122 int render_view_id, |
125 bool worker) OVERRIDE; | 123 bool worker) OVERRIDE; |
126 virtual void CancelDesktopNotification( | 124 virtual void CancelDesktopNotification( |
127 int render_process_id, | 125 int render_process_id, |
128 int render_view_id, | 126 int render_view_id, |
129 int notification_id) OVERRIDE; | 127 int notification_id) OVERRIDE; |
130 virtual bool CanCreateWindow( | 128 virtual bool CanCreateWindow( |
131 const GURL& source_origin, | 129 const GURL& source_origin, |
132 WindowContainerType container_type, | 130 WindowContainerType container_type, |
133 content::ResourceContext* context, | 131 ResourceContext* context, |
134 int render_process_id) OVERRIDE; | 132 int render_process_id) OVERRIDE; |
135 virtual std::string GetWorkerProcessTitle( | 133 virtual std::string GetWorkerProcessTitle(const GURL& url, |
136 const GURL& url, content::ResourceContext* context) OVERRIDE; | 134 ResourceContext* context) OVERRIDE; |
137 virtual void ResourceDispatcherHostCreated() OVERRIDE; | 135 virtual void ResourceDispatcherHostCreated() OVERRIDE; |
138 virtual SpeechInputManagerDelegate* GetSpeechInputManagerDelegate() OVERRIDE; | 136 virtual SpeechInputManagerDelegate* GetSpeechInputManagerDelegate() OVERRIDE; |
139 virtual ui::Clipboard* GetClipboard() OVERRIDE; | 137 virtual ui::Clipboard* GetClipboard() OVERRIDE; |
140 virtual net::NetLog* GetNetLog() OVERRIDE; | 138 virtual net::NetLog* GetNetLog() OVERRIDE; |
141 virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE; | 139 virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE; |
142 virtual bool IsFastShutdownPossible() OVERRIDE; | 140 virtual bool IsFastShutdownPossible() OVERRIDE; |
143 virtual void OverrideWebkitPrefs(RenderViewHost* rvh, | 141 virtual void OverrideWebkitPrefs(RenderViewHost* rvh, |
144 WebPreferences* prefs) OVERRIDE; | 142 WebPreferences* prefs) OVERRIDE; |
145 virtual void UpdateInspectorSetting(RenderViewHost* rvh, | 143 virtual void UpdateInspectorSetting(RenderViewHost* rvh, |
146 const std::string& key, | 144 const std::string& key, |
(...skipping 23 matching lines...) Expand all Loading... |
170 private: | 168 private: |
171 // Temporary directory for GetDefaultDownloadDirectory. | 169 // Temporary directory for GetDefaultDownloadDirectory. |
172 ScopedTempDir download_dir_; | 170 ScopedTempDir download_dir_; |
173 | 171 |
174 DISALLOW_COPY_AND_ASSIGN(MockContentBrowserClient); | 172 DISALLOW_COPY_AND_ASSIGN(MockContentBrowserClient); |
175 }; | 173 }; |
176 | 174 |
177 } // namespace content | 175 } // namespace content |
178 | 176 |
179 #endif // CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ | 177 #endif // CONTENT_BROWSER_MOCK_CONTENT_BROWSER_CLIENT_H_ |
OLD | NEW |