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

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

Issue 12230054: Make TestWebIDBFactory allocate a separate WebIDBFactory per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/webkit_support.h ('k') | webkit/support/webkit_support.gypi » ('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) 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/webkit_support.h" 5 #include "webkit/support/webkit_support.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #include "webkit/media/media_stream_client.h" 65 #include "webkit/media/media_stream_client.h"
66 #include "webkit/media/webmediaplayer_impl.h" 66 #include "webkit/media/webmediaplayer_impl.h"
67 #include "webkit/media/webmediaplayer_ms.h" 67 #include "webkit/media/webmediaplayer_ms.h"
68 #include "webkit/media/webmediaplayer_params.h" 68 #include "webkit/media/webmediaplayer_params.h"
69 #include "webkit/plugins/npapi/plugin_list.h" 69 #include "webkit/plugins/npapi/plugin_list.h"
70 #include "webkit/plugins/npapi/webplugin_impl.h" 70 #include "webkit/plugins/npapi/webplugin_impl.h"
71 #include "webkit/plugins/npapi/webplugin_page_delegate.h" 71 #include "webkit/plugins/npapi/webplugin_page_delegate.h"
72 #include "webkit/plugins/webplugininfo.h" 72 #include "webkit/plugins/webplugininfo.h"
73 #include "webkit/support/platform_support.h" 73 #include "webkit/support/platform_support.h"
74 #include "webkit/support/simple_database_system.h" 74 #include "webkit/support/simple_database_system.h"
75 #include "webkit/support/test_webidbfactory.h"
75 #include "webkit/support/test_webkit_platform_support.h" 76 #include "webkit/support/test_webkit_platform_support.h"
76 #include "webkit/support/test_webplugin_page_delegate.h" 77 #include "webkit/support/test_webplugin_page_delegate.h"
77 #include "webkit/tools/test_shell/simple_appcache_system.h" 78 #include "webkit/tools/test_shell/simple_appcache_system.h"
78 #include "webkit/tools/test_shell/simple_dom_storage_system.h" 79 #include "webkit/tools/test_shell/simple_dom_storage_system.h"
79 #include "webkit/tools/test_shell/simple_file_system.h" 80 #include "webkit/tools/test_shell/simple_file_system.h"
80 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" 81 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
81 #include "webkit/user_agent/user_agent.h" 82 #include "webkit/user_agent/user_agent.h"
82 #include "webkit/user_agent/user_agent_util.h" 83 #include "webkit/user_agent/user_agent_util.h"
83 84
84 #if defined(OS_ANDROID) 85 #if defined(OS_ANDROID)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 at_exit_manager_.reset(existing_at_exit_manager); 165 at_exit_manager_.reset(existing_at_exit_manager);
165 InitLogging(); 166 InitLogging();
166 } 167 }
167 main_message_loop_.reset(new MessageLoopType); 168 main_message_loop_.reset(new MessageLoopType);
168 169
169 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. 170 // TestWebKitPlatformSupport must be instantiated after MessageLoopType.
170 webkit_platform_support_.reset( 171 webkit_platform_support_.reset(
171 new TestWebKitPlatformSupport(unit_test_mode, 172 new TestWebKitPlatformSupport(unit_test_mode,
172 shadow_platform_delegate)); 173 shadow_platform_delegate));
173 174
174 // TODO(darin): Uncomment this once DRT calls ResetTestEnvironment(). 175 idb_factory_.reset(new TestWebIDBFactory());
175 //WebKit::setIDBFactory(webkit_platform_support_->idbFactory()); 176 WebKit::setIDBFactory(idb_factory_.get());
176 177
177 #if defined(OS_ANDROID) 178 #if defined(OS_ANDROID)
178 // Make sure we have enough decoding resources for layout tests. 179 // Make sure we have enough decoding resources for layout tests.
179 // The current maximum number of media elements in a layout test is 8. 180 // The current maximum number of media elements in a layout test is 8.
180 media_bridge_manager_.reset( 181 media_bridge_manager_.reset(
181 new webkit_media::MediaPlayerBridgeManagerImpl(8)); 182 new webkit_media::MediaPlayerBridgeManagerImpl(8));
182 media_player_manager_.reset( 183 media_player_manager_.reset(
183 new webkit_media::WebMediaPlayerManagerAndroid()); 184 new webkit_media::WebMediaPlayerManagerAndroid());
184 #endif 185 #endif
185 } 186 }
186 187
187 ~TestEnvironment() { 188 ~TestEnvironment() {
188 SimpleResourceLoaderBridge::Shutdown(); 189 SimpleResourceLoaderBridge::Shutdown();
189 } 190 }
190 191
191 void Reset() {
192 #if defined(OS_ANDROID)
193 media_player_manager_->ReleaseMediaResources();
194 #endif
195 WebKit::setIDBFactory(webkit_platform_support_->idbFactory());
196 }
197
198 TestWebKitPlatformSupport* webkit_platform_support() const { 192 TestWebKitPlatformSupport* webkit_platform_support() const {
199 return webkit_platform_support_.get(); 193 return webkit_platform_support_.get();
200 } 194 }
201 195
202 #if defined(OS_WIN) || defined(OS_MACOSX) 196 #if defined(OS_WIN) || defined(OS_MACOSX)
203 void set_theme_engine(WebKit::WebThemeEngine* engine) { 197 void set_theme_engine(WebKit::WebThemeEngine* engine) {
204 DCHECK(webkit_platform_support_ != 0); 198 DCHECK(webkit_platform_support_ != 0);
205 webkit_platform_support_->SetThemeEngine(engine); 199 webkit_platform_support_->SetThemeEngine(engine);
206 } 200 }
207 201
(...skipping 23 matching lines...) Expand all
231 return media_bridge_manager_.get(); 225 return media_bridge_manager_.get();
232 } 226 }
233 #endif 227 #endif
234 228
235 private: 229 private:
236 // Data member at_exit_manager_ will take the ownership of the input 230 // Data member at_exit_manager_ will take the ownership of the input
237 // AtExitManager and manage its lifecycle. 231 // AtExitManager and manage its lifecycle.
238 scoped_ptr<base::AtExitManager> at_exit_manager_; 232 scoped_ptr<base::AtExitManager> at_exit_manager_;
239 scoped_ptr<MessageLoopType> main_message_loop_; 233 scoped_ptr<MessageLoopType> main_message_loop_;
240 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; 234 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_;
235 scoped_ptr<TestWebIDBFactory> idb_factory_;
241 236
242 #if defined(OS_ANDROID) 237 #if defined(OS_ANDROID)
243 base::FilePath mock_current_directory_; 238 base::FilePath mock_current_directory_;
244 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_; 239 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_;
245 scoped_ptr<webkit_media::MediaPlayerBridgeManagerImpl> media_bridge_manager_; 240 scoped_ptr<webkit_media::MediaPlayerBridgeManagerImpl> media_bridge_manager_;
246 #endif 241 #endif
247 }; 242 };
248 243
249 class WebPluginImplWithPageDelegate 244 class WebPluginImplWithPageDelegate
250 : public webkit_support::TestWebPluginPageDelegate, 245 : public webkit_support::TestWebPluginPageDelegate,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 BeforeShutdown(); 385 BeforeShutdown();
391 if (RunningOnValgrind()) 386 if (RunningOnValgrind())
392 WebKit::WebCache::clear(); 387 WebKit::WebCache::clear();
393 WebKit::shutdown(); 388 WebKit::shutdown();
394 delete test_environment; 389 delete test_environment;
395 test_environment = NULL; 390 test_environment = NULL;
396 AfterShutdown(); 391 AfterShutdown();
397 logging::CloseLogFile(); 392 logging::CloseLogFile();
398 } 393 }
399 394
400 void ResetTestEnvironment() {
401 test_environment->Reset();
402 }
403
404 WebKit::WebKitPlatformSupport* GetWebKitPlatformSupport() { 395 WebKit::WebKitPlatformSupport* GetWebKitPlatformSupport() {
405 DCHECK(test_environment); 396 DCHECK(test_environment);
406 return test_environment->webkit_platform_support(); 397 return test_environment->webkit_platform_support();
407 } 398 }
408 399
409 WebPlugin* CreateWebPlugin(WebFrame* frame, 400 WebPlugin* CreateWebPlugin(WebFrame* frame,
410 const WebPluginParams& params) { 401 const WebPluginParams& params) {
411 const bool kAllowWildcard = true; 402 const bool kAllowWildcard = true;
412 std::vector<webkit::WebPluginInfo> plugins; 403 std::vector<webkit::WebPluginInfo> plugins;
413 std::vector<std::string> mime_types; 404 std::vector<std::string> mime_types;
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 // Logging 882 // Logging
892 void EnableWebCoreLogChannels(const std::string& channels) { 883 void EnableWebCoreLogChannels(const std::string& channels) {
893 webkit_glue::EnableWebCoreLogChannels(channels); 884 webkit_glue::EnableWebCoreLogChannels(channels);
894 } 885 }
895 886
896 void SetGamepadData(const WebKit::WebGamepads& pads) { 887 void SetGamepadData(const WebKit::WebGamepads& pads) {
897 test_environment->webkit_platform_support()->setGamepadData(pads); 888 test_environment->webkit_platform_support()->setGamepadData(pads);
898 } 889 }
899 890
900 } // namespace webkit_support 891 } // namespace webkit_support
OLDNEW
« no previous file with comments | « webkit/support/webkit_support.h ('k') | webkit/support/webkit_support.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698