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

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

Issue 17476002: delete webkit/support/simple_xxx's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
OLDNEW
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 "webkit/support/test_webkit_platform_support.h" 5 #include "webkit/support/test_webkit_platform_support.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/metrics/stats_counters.h" 10 #include "base/metrics/stats_counters.h"
(...skipping 26 matching lines...) Expand all
37 #include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h" 37 #include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h"
38 #include "webkit/glue/simple_webmimeregistry_impl.h" 38 #include "webkit/glue/simple_webmimeregistry_impl.h"
39 #include "webkit/glue/webclipboard_impl.h" 39 #include "webkit/glue/webclipboard_impl.h"
40 #include "webkit/glue/webkit_glue.h" 40 #include "webkit/glue/webkit_glue.h"
41 #include "webkit/glue/webkitplatformsupport_impl.h" 41 #include "webkit/glue/webkitplatformsupport_impl.h"
42 #include "webkit/plugins/npapi/plugin_list.h" 42 #include "webkit/plugins/npapi/plugin_list.h"
43 #include "webkit/renderer/appcache/web_application_cache_host_impl.h" 43 #include "webkit/renderer/appcache/web_application_cache_host_impl.h"
44 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" 44 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h"
45 #include "webkit/support/gc_extension.h" 45 #include "webkit/support/gc_extension.h"
46 #include "webkit/support/mock_webclipboard_impl.h" 46 #include "webkit/support/mock_webclipboard_impl.h"
47 #include "webkit/support/simple_appcache_system.h"
48 #include "webkit/support/simple_database_system.h" 47 #include "webkit/support/simple_database_system.h"
49 #include "webkit/support/simple_file_system.h"
50 #include "webkit/support/simple_resource_loader_bridge.h"
51 #include "webkit/support/simple_socket_stream_bridge.h" 48 #include "webkit/support/simple_socket_stream_bridge.h"
52 #include "webkit/support/simple_webcookiejar_impl.h"
53 #include "webkit/support/test_shell_request_context.h"
54 #include "webkit/support/test_shell_webblobregistry_impl.h" 49 #include "webkit/support/test_shell_webblobregistry_impl.h"
55 #include "webkit/support/test_webmessageportchannel.h" 50 #include "webkit/support/test_webmessageportchannel.h"
56 #include "webkit/support/web_audio_device_mock.h" 51 #include "webkit/support/web_audio_device_mock.h"
57 #include "webkit/support/web_gesture_curve_mock.h" 52 #include "webkit/support/web_gesture_curve_mock.h"
58 #include "webkit/support/web_layer_tree_view_impl_for_testing.h" 53 #include "webkit/support/web_layer_tree_view_impl_for_testing.h"
59 #include "webkit/support/webkit_support.h" 54 #include "webkit/support/webkit_support.h"
60 #include "webkit/support/weburl_loader_mock_factory.h" 55 #include "webkit/support/weburl_loader_mock_factory.h"
61 56
62 #if defined(OS_WIN) 57 #if defined(OS_WIN)
63 #include "third_party/WebKit/public/platform/win/WebThemeEngine.h" 58 #include "third_party/WebKit/public/platform/win/WebThemeEngine.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 107
113 // Construct and initialize an appcache system for this scope. 108 // Construct and initialize an appcache system for this scope.
114 // A new empty temp directory is created to house any cached 109 // A new empty temp directory is created to house any cached
115 // content during the run. Upon exit that directory is deleted. 110 // content during the run. Upon exit that directory is deleted.
116 // If we can't create a tempdir, we'll use in-memory storage. 111 // If we can't create a tempdir, we'll use in-memory storage.
117 if (!appcache_dir_.CreateUniqueTempDir()) { 112 if (!appcache_dir_.CreateUniqueTempDir()) {
118 LOG(WARNING) << "Failed to create a temp dir for the appcache, " 113 LOG(WARNING) << "Failed to create a temp dir for the appcache, "
119 "using in-memory storage."; 114 "using in-memory storage.";
120 DCHECK(appcache_dir_.path().empty()); 115 DCHECK(appcache_dir_.path().empty());
121 } 116 }
122 SimpleAppCacheSystem::InitializeOnUIThread(appcache_dir_.path());
123 117
124 WebKit::WebDatabase::setObserver(&database_system_); 118 WebKit::WebDatabase::setObserver(&database_system_);
125 119
126 blob_registry_ = new TestShellWebBlobRegistryImpl(); 120 blob_registry_ = new TestShellWebBlobRegistryImpl();
127 121
128 file_utilities_.set_sandbox_enabled(false); 122 file_utilities_.set_sandbox_enabled(false);
129 123
130 if (!file_system_root_.CreateUniqueTempDir()) { 124 if (!file_system_root_.CreateUniqueTempDir()) {
131 LOG(WARNING) << "Failed to create a temp dir for the filesystem." 125 LOG(WARNING) << "Failed to create a temp dir for the filesystem."
132 "FileSystem feature will be disabled."; 126 "FileSystem feature will be disabled.";
(...skipping 12 matching lines...) Expand all
145 } 139 }
146 140
147 #if defined(OS_WIN) 141 #if defined(OS_WIN)
148 // Ensure we pick up the default theme engine. 142 // Ensure we pick up the default theme engine.
149 SetThemeEngine(NULL); 143 SetThemeEngine(NULL);
150 #endif 144 #endif
151 145
152 net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL; 146 net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL;
153 net::CookieMonster::EnableFileScheme(); 147 net::CookieMonster::EnableFileScheme();
154 148
155 // Initializing with a default context, which means no on-disk cookie DB,
156 // and no support for directory listings.
157 SimpleResourceLoaderBridge::Init(base::FilePath(), cache_mode, true);
158
159 // Test shell always exposes the GC. 149 // Test shell always exposes the GC.
160 webkit_glue::SetJavaScriptFlags(" --expose-gc"); 150 webkit_glue::SetJavaScriptFlags(" --expose-gc");
161 // Expose GCController to JavaScript. 151 // Expose GCController to JavaScript.
162 WebScriptController::registerExtension(extensions_v8::GCExtension::Get()); 152 WebScriptController::registerExtension(extensions_v8::GCExtension::Get());
163 } 153 }
164 154
165 TestWebKitPlatformSupport::~TestWebKitPlatformSupport() { 155 TestWebKitPlatformSupport::~TestWebKitPlatformSupport() {
166 } 156 }
167 157
168 WebKit::WebMimeRegistry* TestWebKitPlatformSupport::mimeRegistry() { 158 WebKit::WebMimeRegistry* TestWebKitPlatformSupport::mimeRegistry() {
169 return &mime_registry_; 159 return &mime_registry_;
170 } 160 }
171 161
172 WebKit::WebClipboard* TestWebKitPlatformSupport::clipboard() { 162 WebKit::WebClipboard* TestWebKitPlatformSupport::clipboard() {
173 // Mock out clipboard calls so that tests don't mess 163 // Mock out clipboard calls so that tests don't mess
174 // with each other's copies/pastes when running in parallel. 164 // with each other's copies/pastes when running in parallel.
175 return &mock_clipboard_; 165 return &mock_clipboard_;
176 } 166 }
177 167
178 WebKit::WebFileUtilities* TestWebKitPlatformSupport::fileUtilities() { 168 WebKit::WebFileUtilities* TestWebKitPlatformSupport::fileUtilities() {
179 return &file_utilities_; 169 return &file_utilities_;
180 } 170 }
181 171
182 WebKit::WebSandboxSupport* TestWebKitPlatformSupport::sandboxSupport() { 172 WebKit::WebSandboxSupport* TestWebKitPlatformSupport::sandboxSupport() {
183 return NULL; 173 return NULL;
184 } 174 }
185 175
186 WebKit::WebCookieJar* TestWebKitPlatformSupport::cookieJar() {
187 return &cookie_jar_;
188 }
189
190 WebKit::WebBlobRegistry* TestWebKitPlatformSupport::blobRegistry() { 176 WebKit::WebBlobRegistry* TestWebKitPlatformSupport::blobRegistry() {
191 return blob_registry_.get(); 177 return blob_registry_.get();
192 } 178 }
193 179
194 WebKit::WebFileSystem* TestWebKitPlatformSupport::fileSystem() {
195 return &file_system_;
196 }
197
198 WebKit::WebHyphenator* TestWebKitPlatformSupport::hyphenator() { 180 WebKit::WebHyphenator* TestWebKitPlatformSupport::hyphenator() {
199 return &hyphenator_; 181 return &hyphenator_;
200 } 182 }
201 183
202 WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() { 184 WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() {
203 NOTREACHED() << 185 NOTREACHED() <<
204 "IndexedDB cannot be tested with in-process harnesses."; 186 "IndexedDB cannot be tested with in-process harnesses.";
205 return NULL; 187 return NULL;
206 } 188 }
207 189
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 void TestWebKitPlatformSupport::GetPlugins( 408 void TestWebKitPlatformSupport::GetPlugins(
427 bool refresh, std::vector<webkit::WebPluginInfo>* plugins) { 409 bool refresh, std::vector<webkit::WebPluginInfo>* plugins) {
428 if (refresh) 410 if (refresh)
429 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 411 webkit::npapi::PluginList::Singleton()->RefreshPlugins();
430 webkit::npapi::PluginList::Singleton()->GetPlugins(plugins); 412 webkit::npapi::PluginList::Singleton()->GetPlugins(plugins);
431 } 413 }
432 414
433 webkit_glue::ResourceLoaderBridge* 415 webkit_glue::ResourceLoaderBridge*
434 TestWebKitPlatformSupport::CreateResourceLoader( 416 TestWebKitPlatformSupport::CreateResourceLoader(
435 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { 417 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
436 return SimpleResourceLoaderBridge::Create(request_info); 418 NOTREACHED();
419 return NULL;
437 } 420 }
438 421
439 webkit_glue::WebSocketStreamHandleBridge* 422 webkit_glue::WebSocketStreamHandleBridge*
440 TestWebKitPlatformSupport::CreateWebSocketBridge( 423 TestWebKitPlatformSupport::CreateWebSocketBridge(
441 WebKit::WebSocketStreamHandle* handle, 424 WebKit::WebSocketStreamHandle* handle,
442 webkit_glue::WebSocketStreamHandleDelegate* delegate) { 425 webkit_glue::WebSocketStreamHandleDelegate* delegate) {
443 return SimpleSocketStreamBridge::Create(handle, delegate); 426 return SimpleSocketStreamBridge::Create(handle, delegate);
444 } 427 }
445 428
446 WebKit::WebMediaStreamCenter* 429 WebKit::WebMediaStreamCenter*
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 return view.release(); 500 return view.release();
518 } 501 }
519 502
520 WebKit::WebLayerTreeView* 503 WebKit::WebLayerTreeView*
521 TestWebKitPlatformSupport::createLayerTreeViewForTesting( 504 TestWebKitPlatformSupport::createLayerTreeViewForTesting(
522 TestViewType type) { 505 TestViewType type) {
523 DCHECK_EQ(TestViewTypeUnitTest, type); 506 DCHECK_EQ(TestViewTypeUnitTest, type);
524 return createLayerTreeViewForTesting(); 507 return createLayerTreeViewForTesting();
525 } 508 }
526 509
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698