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 #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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #include "webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h" | 55 #include "webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h" |
56 #include "webkit/fileapi/isolated_context.h" | 56 #include "webkit/fileapi/isolated_context.h" |
57 #include "webkit/glue/webkit_constants.h" | 57 #include "webkit/glue/webkit_constants.h" |
58 #include "webkit/glue/webkit_glue.h" | 58 #include "webkit/glue/webkit_glue.h" |
59 #include "webkit/glue/webkitplatformsupport_impl.h" | 59 #include "webkit/glue/webkitplatformsupport_impl.h" |
60 #include "webkit/glue/webthread_impl.h" | 60 #include "webkit/glue/webthread_impl.h" |
61 #include "webkit/glue/weburlrequest_extradata_impl.h" | 61 #include "webkit/glue/weburlrequest_extradata_impl.h" |
62 #include "webkit/gpu/test_context_provider_factory.h" | 62 #include "webkit/gpu/test_context_provider_factory.h" |
63 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 63 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
64 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 64 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
65 #if defined(OS_ANDROID) | |
66 #include "webkit/media/android/media_player_bridge_manager_impl.h" | |
67 #include "webkit/media/android/webmediaplayer_in_process_android.h" | |
68 #include "webkit/media/android/webmediaplayer_manager_android.h" | |
69 #endif | |
70 #include "webkit/media/media_stream_client.h" | 65 #include "webkit/media/media_stream_client.h" |
71 #include "webkit/media/webmediaplayer_impl.h" | 66 #include "webkit/media/webmediaplayer_impl.h" |
72 #include "webkit/media/webmediaplayer_ms.h" | 67 #include "webkit/media/webmediaplayer_ms.h" |
73 #include "webkit/media/webmediaplayer_params.h" | 68 #include "webkit/media/webmediaplayer_params.h" |
74 #include "webkit/plugins/npapi/plugin_list.h" | 69 #include "webkit/plugins/npapi/plugin_list.h" |
75 #include "webkit/plugins/npapi/webplugin_impl.h" | 70 #include "webkit/plugins/npapi/webplugin_impl.h" |
76 #include "webkit/plugins/npapi/webplugin_page_delegate.h" | 71 #include "webkit/plugins/npapi/webplugin_page_delegate.h" |
77 #include "webkit/plugins/webplugininfo.h" | 72 #include "webkit/plugins/webplugininfo.h" |
78 #include "webkit/support/platform_support.h" | 73 #include "webkit/support/platform_support.h" |
79 #include "webkit/support/simple_database_system.h" | 74 #include "webkit/support/simple_database_system.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 171 } |
177 main_message_loop_.reset(new MessageLoopType); | 172 main_message_loop_.reset(new MessageLoopType); |
178 | 173 |
179 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. | 174 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. |
180 webkit_platform_support_.reset( | 175 webkit_platform_support_.reset( |
181 new TestWebKitPlatformSupport(unit_test_mode, | 176 new TestWebKitPlatformSupport(unit_test_mode, |
182 shadow_platform_delegate)); | 177 shadow_platform_delegate)); |
183 | 178 |
184 idb_factory_.reset(new TestWebIDBFactory()); | 179 idb_factory_.reset(new TestWebIDBFactory()); |
185 WebKit::setIDBFactory(idb_factory_.get()); | 180 WebKit::setIDBFactory(idb_factory_.get()); |
186 | |
187 #if defined(OS_ANDROID) | |
188 // Make sure we have enough decoding resources for layout tests. | |
189 // The current maximum number of media elements in a layout test is 8. | |
190 media_bridge_manager_.reset( | |
191 new webkit_media::MediaPlayerBridgeManagerImpl(8)); | |
192 media_player_manager_.reset( | |
193 new webkit_media::WebMediaPlayerManagerAndroid()); | |
194 #endif | |
195 } | 181 } |
196 | 182 |
197 ~TestEnvironment() { | 183 ~TestEnvironment() { |
198 SimpleResourceLoaderBridge::Shutdown(); | 184 SimpleResourceLoaderBridge::Shutdown(); |
199 } | 185 } |
200 | 186 |
201 TestWebKitPlatformSupport* webkit_platform_support() const { | 187 TestWebKitPlatformSupport* webkit_platform_support() const { |
202 return webkit_platform_support_.get(); | 188 return webkit_platform_support_.get(); |
203 } | 189 } |
204 | 190 |
(...skipping 13 matching lines...) Expand all Loading... |
218 // in SetCurrentDirectoryForFileURL() and GetAbsoluteWebStringFromUTF8Path(), | 204 // in SetCurrentDirectoryForFileURL() and GetAbsoluteWebStringFromUTF8Path(), |
219 // as the directory might not exist on the device because we are using | 205 // as the directory might not exist on the device because we are using |
220 // file-over-http bridge. | 206 // file-over-http bridge. |
221 void set_mock_current_directory(const base::FilePath& directory) { | 207 void set_mock_current_directory(const base::FilePath& directory) { |
222 mock_current_directory_ = directory; | 208 mock_current_directory_ = directory; |
223 } | 209 } |
224 | 210 |
225 base::FilePath mock_current_directory() const { | 211 base::FilePath mock_current_directory() const { |
226 return mock_current_directory_; | 212 return mock_current_directory_; |
227 } | 213 } |
228 | |
229 webkit_media::WebMediaPlayerManagerAndroid* media_player_manager() { | |
230 return media_player_manager_.get(); | |
231 } | |
232 | |
233 webkit_media::MediaPlayerBridgeManagerImpl* media_bridge_manager() { | |
234 return media_bridge_manager_.get(); | |
235 } | |
236 #endif | 214 #endif |
237 | 215 |
238 private: | 216 private: |
239 // Data member at_exit_manager_ will take the ownership of the input | 217 // Data member at_exit_manager_ will take the ownership of the input |
240 // AtExitManager and manage its lifecycle. | 218 // AtExitManager and manage its lifecycle. |
241 scoped_ptr<base::AtExitManager> at_exit_manager_; | 219 scoped_ptr<base::AtExitManager> at_exit_manager_; |
242 scoped_ptr<MessageLoopType> main_message_loop_; | 220 scoped_ptr<MessageLoopType> main_message_loop_; |
243 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; | 221 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; |
244 scoped_ptr<TestWebIDBFactory> idb_factory_; | 222 scoped_ptr<TestWebIDBFactory> idb_factory_; |
245 | 223 |
246 #if defined(OS_ANDROID) | 224 #if defined(OS_ANDROID) |
247 base::FilePath mock_current_directory_; | 225 base::FilePath mock_current_directory_; |
248 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_; | |
249 scoped_ptr<webkit_media::MediaPlayerBridgeManagerImpl> media_bridge_manager_; | |
250 #endif | 226 #endif |
251 }; | 227 }; |
252 | 228 |
253 class WebPluginImplWithPageDelegate | 229 class WebPluginImplWithPageDelegate |
254 : public webkit_support::TestWebPluginPageDelegate, | 230 : public webkit_support::TestWebPluginPageDelegate, |
255 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, | 231 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, |
256 public webkit::npapi::WebPluginImpl { | 232 public webkit::npapi::WebPluginImpl { |
257 public: | 233 public: |
258 WebPluginImplWithPageDelegate(WebFrame* frame, | 234 WebPluginImplWithPageDelegate(WebFrame* frame, |
259 const WebPluginParams& params, | 235 const WebPluginParams& params, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 if (media_stream_client && media_stream_client->IsMediaStream(url)) { | 403 if (media_stream_client && media_stream_client->IsMediaStream(url)) { |
428 return new webkit_media::WebMediaPlayerMS( | 404 return new webkit_media::WebMediaPlayerMS( |
429 frame, | 405 frame, |
430 client, | 406 client, |
431 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(), | 407 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(), |
432 media_stream_client, | 408 media_stream_client, |
433 new media::MediaLog()); | 409 new media::MediaLog()); |
434 } | 410 } |
435 | 411 |
436 #if defined(OS_ANDROID) | 412 #if defined(OS_ANDROID) |
437 return new webkit_media::WebMediaPlayerInProcessAndroid( | 413 return NULL; |
438 frame, | |
439 client, | |
440 GetWebKitPlatformSupport()->cookieJar(), | |
441 test_environment->media_player_manager(), | |
442 test_environment->media_bridge_manager(), | |
443 new webkit_support::TestStreamTextureFactory(), | |
444 true); | |
445 #else | 414 #else |
446 webkit_media::WebMediaPlayerParams params( | 415 webkit_media::WebMediaPlayerParams params( |
447 NULL, NULL, new media::MediaLog()); | 416 NULL, NULL, new media::MediaLog()); |
448 return new webkit_media::WebMediaPlayerImpl( | 417 return new webkit_media::WebMediaPlayerImpl( |
449 frame, | 418 frame, |
450 client, | 419 client, |
451 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(), | 420 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(), |
452 params); | 421 params); |
453 #endif | 422 #endif |
454 } | 423 } |
455 | 424 |
456 WebKit::WebMediaPlayer* CreateMediaPlayer( | 425 WebKit::WebMediaPlayer* CreateMediaPlayer( |
457 WebFrame* frame, | 426 WebFrame* frame, |
458 const WebURL& url, | 427 const WebURL& url, |
459 WebMediaPlayerClient* client) { | 428 WebMediaPlayerClient* client) { |
460 return CreateMediaPlayer(frame, url, client, NULL); | 429 return CreateMediaPlayer(frame, url, client, NULL); |
461 } | 430 } |
462 | 431 |
463 #if defined(OS_ANDROID) | |
464 void ReleaseMediaResources() { | |
465 test_environment->media_player_manager()->ReleaseMediaResources(); | |
466 } | |
467 #endif | |
468 | |
469 WebKit::WebApplicationCacheHost* CreateApplicationCacheHost( | 432 WebKit::WebApplicationCacheHost* CreateApplicationCacheHost( |
470 WebFrame*, WebKit::WebApplicationCacheHostClient* client) { | 433 WebFrame*, WebKit::WebApplicationCacheHostClient* client) { |
471 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); | 434 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); |
472 } | 435 } |
473 | 436 |
474 WebKit::WebStorageNamespace* CreateSessionStorageNamespace(unsigned quota) { | 437 WebKit::WebStorageNamespace* CreateSessionStorageNamespace(unsigned quota) { |
475 return SimpleDomStorageSystem::instance().CreateSessionStorageNamespace(); | 438 return SimpleDomStorageSystem::instance().CreateSessionStorageNamespace(); |
476 } | 439 } |
477 | 440 |
478 WebKit::WebString GetWebKitRootDir() { | 441 WebKit::WebString GetWebKitRootDir() { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 // Logging | 858 // Logging |
896 void EnableWebCoreLogChannels(const std::string& channels) { | 859 void EnableWebCoreLogChannels(const std::string& channels) { |
897 webkit_glue::EnableWebCoreLogChannels(channels); | 860 webkit_glue::EnableWebCoreLogChannels(channels); |
898 } | 861 } |
899 | 862 |
900 void SetGamepadData(const WebKit::WebGamepads& pads) { | 863 void SetGamepadData(const WebKit::WebGamepads& pads) { |
901 test_environment->webkit_platform_support()->setGamepadData(pads); | 864 test_environment->webkit_platform_support()->setGamepadData(pads); |
902 } | 865 } |
903 | 866 |
904 } // namespace webkit_support | 867 } // namespace webkit_support |
OLD | NEW |