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

Side by Side Diff: webkit/support/test_webkit_client.cc

Issue 2749020: Adding a way to mock WebURLLoader in webkit_support.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
« no previous file with comments | « webkit/support/test_webkit_client.h ('k') | webkit/support/webkit_support.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "base/stats_counters.h" 8 #include "base/stats_counters.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/cookie_monster.h" 10 #include "net/base/cookie_monster.h"
(...skipping 16 matching lines...) Expand all
27 #include "webkit/appcache/web_application_cache_host_impl.h" 27 #include "webkit/appcache/web_application_cache_host_impl.h"
28 #include "webkit/database/vfs_backend.h" 28 #include "webkit/database/vfs_backend.h"
29 #include "webkit/extensions/v8/gc_extension.h" 29 #include "webkit/extensions/v8/gc_extension.h"
30 #include "webkit/extensions/v8/gears_extension.h" 30 #include "webkit/extensions/v8/gears_extension.h"
31 #include "webkit/extensions/v8/interval_extension.h" 31 #include "webkit/extensions/v8/interval_extension.h"
32 #include "webkit/glue/simple_webmimeregistry_impl.h" 32 #include "webkit/glue/simple_webmimeregistry_impl.h"
33 #include "webkit/glue/webclipboard_impl.h" 33 #include "webkit/glue/webclipboard_impl.h"
34 #include "webkit/glue/webkit_glue.h" 34 #include "webkit/glue/webkit_glue.h"
35 #include "webkit/glue/webkitclient_impl.h" 35 #include "webkit/glue/webkitclient_impl.h"
36 #include "webkit/support/test_webkit_client.h" 36 #include "webkit/support/test_webkit_client.h"
37 #include "webkit/support/weburl_loader_mock_factory.h"
37 #include "webkit/tools/test_shell/mock_webclipboard_impl.h" 38 #include "webkit/tools/test_shell/mock_webclipboard_impl.h"
38 #include "webkit/tools/test_shell/simple_appcache_system.h" 39 #include "webkit/tools/test_shell/simple_appcache_system.h"
39 #include "webkit/tools/test_shell/simple_database_system.h" 40 #include "webkit/tools/test_shell/simple_database_system.h"
40 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" 41 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
41 #include "webkit/tools/test_shell/simple_webcookiejar_impl.h" 42 #include "webkit/tools/test_shell/simple_webcookiejar_impl.h"
42 #include "webkit/tools/test_shell/test_shell_request_context.h" 43 #include "webkit/tools/test_shell/test_shell_request_context.h"
43 #include "v8/include/v8.h" 44 #include "v8/include/v8.h"
44 45
45 #if defined(OS_WIN) 46 #if defined(OS_WIN)
46 #include "webkit/tools/test_shell/test_shell_webthemeengine.h" 47 #include "webkit/tools/test_shell/test_shell_webthemeengine.h"
47 #endif 48 #endif
48 #if defined(OS_MACOSX) 49 #if defined(OS_MACOSX)
49 #include "base/mac_util.h" 50 #include "base/mac_util.h"
50 #endif 51 #endif
51 52
52 using WebKit::WebScriptController; 53 using WebKit::WebScriptController;
53 54
54 TestWebKitClient::TestWebKitClient() : url_loader_factory_(NULL) { 55 TestWebKitClient::TestWebKitClient() {
55 v8::V8::SetCounterFunction(StatsTable::FindLocation); 56 v8::V8::SetCounterFunction(StatsTable::FindLocation);
56 57
57 WebKit::initialize(this); 58 WebKit::initialize(this);
58 WebKit::setLayoutTestMode(true); 59 WebKit::setLayoutTestMode(true);
59 WebKit::WebSecurityPolicy::registerURLSchemeAsLocal( 60 WebKit::WebSecurityPolicy::registerURLSchemeAsLocal(
60 WebKit::WebString::fromUTF8("test-shell-resource")); 61 WebKit::WebString::fromUTF8("test-shell-resource"));
61 WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess( 62 WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess(
62 WebKit::WebString::fromUTF8("test-shell-resource")); 63 WebKit::WebString::fromUTF8("test-shell-resource"));
63 WebScriptController::enableV8SingleThreadMode(); 64 WebScriptController::enableV8SingleThreadMode();
64 WebScriptController::registerExtension( 65 WebScriptController::registerExtension(
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 187 }
187 188
188 WebKit::WebMessagePortChannel* TestWebKitClient::createMessagePortChannel() { 189 WebKit::WebMessagePortChannel* TestWebKitClient::createMessagePortChannel() {
189 return NULL; 190 return NULL;
190 } 191 }
191 192
192 void TestWebKitClient::prefetchHostName(const WebKit::WebString&) { 193 void TestWebKitClient::prefetchHostName(const WebKit::WebString&) {
193 } 194 }
194 195
195 WebKit::WebURLLoader* TestWebKitClient::createURLLoader() { 196 WebKit::WebURLLoader* TestWebKitClient::createURLLoader() {
196 if (url_loader_factory_) 197 return url_loader_factory_.CreateURLLoader(
197 return url_loader_factory_->createURLLoader(); 198 webkit_glue::WebKitClientImpl::createURLLoader());
198 return webkit_glue::WebKitClientImpl::createURLLoader();
199 } 199 }
200 200
201 WebKit::WebData TestWebKitClient::loadResource(const char* name) { 201 WebKit::WebData TestWebKitClient::loadResource(const char* name) {
202 if (!strcmp(name, "deleteButton")) { 202 if (!strcmp(name, "deleteButton")) {
203 // Create a red 30x30 square. 203 // Create a red 30x30 square.
204 const char red_square[] = 204 const char red_square[] =
205 "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" 205 "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52"
206 "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3" 206 "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3"
207 "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00" 207 "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00"
208 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80" 208 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 244 }
245 #endif 245 #endif
246 246
247 WebKit::WebSharedWorkerRepository* TestWebKitClient::sharedWorkerRepository() { 247 WebKit::WebSharedWorkerRepository* TestWebKitClient::sharedWorkerRepository() {
248 return NULL; 248 return NULL;
249 } 249 }
250 250
251 WebKit::WebGraphicsContext3D* TestWebKitClient::createGraphicsContext3D() { 251 WebKit::WebGraphicsContext3D* TestWebKitClient::createGraphicsContext3D() {
252 return WebKit::WebGraphicsContext3D::createDefault(); 252 return WebKit::WebGraphicsContext3D::createDefault();
253 } 253 }
OLDNEW
« no previous file with comments | « webkit/support/test_webkit_client.h ('k') | webkit/support/webkit_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698