| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "ui/gl/gl_surface.h" | 50 #include "ui/gl/gl_surface.h" |
| 51 #include "webkit/appcache/web_application_cache_host_impl.h" | 51 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 52 #include "webkit/fileapi/isolated_context.h" | 52 #include "webkit/fileapi/isolated_context.h" |
| 53 #include "webkit/glue/webkit_constants.h" | 53 #include "webkit/glue/webkit_constants.h" |
| 54 #include "webkit/glue/webkit_glue.h" | 54 #include "webkit/glue/webkit_glue.h" |
| 55 #include "webkit/glue/webkitplatformsupport_impl.h" | 55 #include "webkit/glue/webkitplatformsupport_impl.h" |
| 56 #include "webkit/glue/weburlrequest_extradata_impl.h" | 56 #include "webkit/glue/weburlrequest_extradata_impl.h" |
| 57 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 57 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
| 58 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 58 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
| 59 #if defined(OS_ANDROID) | 59 #if defined(OS_ANDROID) |
| 60 #include "webkit/media/android/webmediaplayer_android.h" | 60 #include "webkit/media/android/media_player_bridge_manager_impl.h" |
| 61 #include "webkit/media/android/webmediaplayer_in_process_android.h" |
| 61 #include "webkit/media/android/webmediaplayer_manager_android.h" | 62 #include "webkit/media/android/webmediaplayer_manager_android.h" |
| 62 #endif | 63 #endif |
| 63 #include "webkit/media/webmediaplayer_impl.h" | 64 #include "webkit/media/webmediaplayer_impl.h" |
| 64 #include "webkit/plugins/npapi/plugin_list.h" | 65 #include "webkit/plugins/npapi/plugin_list.h" |
| 65 #include "webkit/plugins/npapi/webplugin_impl.h" | 66 #include "webkit/plugins/npapi/webplugin_impl.h" |
| 66 #include "webkit/plugins/npapi/webplugin_page_delegate.h" | 67 #include "webkit/plugins/npapi/webplugin_page_delegate.h" |
| 67 #include "webkit/plugins/webplugininfo.h" | 68 #include "webkit/plugins/webplugininfo.h" |
| 68 #include "webkit/support/platform_support.h" | 69 #include "webkit/support/platform_support.h" |
| 69 #include "webkit/support/simple_database_system.h" | 70 #include "webkit/support/simple_database_system.h" |
| 70 #include "webkit/support/test_webkit_platform_support.h" | 71 #include "webkit/support/test_webkit_platform_support.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 InitLogging(); | 161 InitLogging(); |
| 161 } | 162 } |
| 162 main_message_loop_.reset(new MessageLoopType); | 163 main_message_loop_.reset(new MessageLoopType); |
| 163 | 164 |
| 164 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. | 165 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. |
| 165 webkit_platform_support_.reset( | 166 webkit_platform_support_.reset( |
| 166 new TestWebKitPlatformSupport(unit_test_mode, | 167 new TestWebKitPlatformSupport(unit_test_mode, |
| 167 shadow_platform_delegate)); | 168 shadow_platform_delegate)); |
| 168 | 169 |
| 169 #if defined(OS_ANDROID) | 170 #if defined(OS_ANDROID) |
| 171 // Make sure we have enough decoding resources for layout tests. |
| 172 // The current maximum number of media elements in a layout test is 8. |
| 173 media_bridge_manager_.reset( |
| 174 new webkit_media::MediaPlayerBridgeManagerImpl(8)); |
| 170 media_player_manager_.reset( | 175 media_player_manager_.reset( |
| 171 new webkit_media::WebMediaPlayerManagerAndroid()); | 176 new webkit_media::WebMediaPlayerManagerAndroid()); |
| 172 #endif | 177 #endif |
| 173 } | 178 } |
| 174 | 179 |
| 175 ~TestEnvironment() { | 180 ~TestEnvironment() { |
| 176 SimpleResourceLoaderBridge::Shutdown(); | 181 SimpleResourceLoaderBridge::Shutdown(); |
| 177 } | 182 } |
| 178 | 183 |
| 179 TestWebKitPlatformSupport* webkit_platform_support() const { | 184 TestWebKitPlatformSupport* webkit_platform_support() const { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 200 mock_current_directory_ = directory; | 205 mock_current_directory_ = directory; |
| 201 } | 206 } |
| 202 | 207 |
| 203 FilePath mock_current_directory() const { | 208 FilePath mock_current_directory() const { |
| 204 return mock_current_directory_; | 209 return mock_current_directory_; |
| 205 } | 210 } |
| 206 | 211 |
| 207 webkit_media::WebMediaPlayerManagerAndroid* media_player_manager() { | 212 webkit_media::WebMediaPlayerManagerAndroid* media_player_manager() { |
| 208 return media_player_manager_.get(); | 213 return media_player_manager_.get(); |
| 209 } | 214 } |
| 215 |
| 216 webkit_media::MediaPlayerBridgeManagerImpl* media_bridge_manager() { |
| 217 return media_bridge_manager_.get(); |
| 218 } |
| 210 #endif | 219 #endif |
| 211 | 220 |
| 212 private: | 221 private: |
| 213 // Data member at_exit_manager_ will take the ownership of the input | 222 // Data member at_exit_manager_ will take the ownership of the input |
| 214 // AtExitManager and manage its lifecycle. | 223 // AtExitManager and manage its lifecycle. |
| 215 scoped_ptr<base::AtExitManager> at_exit_manager_; | 224 scoped_ptr<base::AtExitManager> at_exit_manager_; |
| 216 scoped_ptr<MessageLoopType> main_message_loop_; | 225 scoped_ptr<MessageLoopType> main_message_loop_; |
| 217 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; | 226 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; |
| 218 | 227 |
| 219 #if defined(OS_ANDROID) | 228 #if defined(OS_ANDROID) |
| 220 FilePath mock_current_directory_; | 229 FilePath mock_current_directory_; |
| 221 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_; | 230 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_; |
| 231 scoped_ptr<webkit_media::MediaPlayerBridgeManagerImpl> media_bridge_manager_; |
| 222 #endif | 232 #endif |
| 223 }; | 233 }; |
| 224 | 234 |
| 225 class WebPluginImplWithPageDelegate | 235 class WebPluginImplWithPageDelegate |
| 226 : public webkit_support::TestWebPluginPageDelegate, | 236 : public webkit_support::TestWebPluginPageDelegate, |
| 227 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, | 237 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, |
| 228 public webkit::npapi::WebPluginImpl { | 238 public webkit::npapi::WebPluginImpl { |
| 229 public: | 239 public: |
| 230 WebPluginImplWithPageDelegate(WebFrame* frame, | 240 WebPluginImplWithPageDelegate(WebFrame* frame, |
| 231 const WebPluginParams& params, | 241 const WebPluginParams& params, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 return new WebPluginImplWithPageDelegate( | 391 return new WebPluginImplWithPageDelegate( |
| 382 frame, new_params, plugins.front().path); | 392 frame, new_params, plugins.front().path); |
| 383 } | 393 } |
| 384 | 394 |
| 385 WebKit::WebMediaPlayer* CreateMediaPlayer( | 395 WebKit::WebMediaPlayer* CreateMediaPlayer( |
| 386 WebFrame* frame, | 396 WebFrame* frame, |
| 387 const WebURL& url, | 397 const WebURL& url, |
| 388 WebMediaPlayerClient* client, | 398 WebMediaPlayerClient* client, |
| 389 webkit_media::MediaStreamClient* media_stream_client) { | 399 webkit_media::MediaStreamClient* media_stream_client) { |
| 390 #if defined(OS_ANDROID) | 400 #if defined(OS_ANDROID) |
| 391 return new webkit_media::WebMediaPlayerAndroid( | 401 return new webkit_media::WebMediaPlayerInProcessAndroid( |
| 392 frame, | 402 frame, |
| 393 client, | 403 client, |
| 394 GetWebKitPlatformSupport()->cookieJar(), | 404 GetWebKitPlatformSupport()->cookieJar(), |
| 395 test_environment->media_player_manager(), | 405 test_environment->media_player_manager(), |
| 396 new webkit_support::TestStreamTextureFactory()); | 406 test_environment->media_bridge_manager(), |
| 407 new webkit_support::TestStreamTextureFactory(), |
| 408 true); |
| 397 #else | 409 #else |
| 398 scoped_ptr<media::MessageLoopFactory> message_loop_factory( | 410 scoped_ptr<media::MessageLoopFactory> message_loop_factory( |
| 399 new media::MessageLoopFactory()); | 411 new media::MessageLoopFactory()); |
| 400 | 412 |
| 401 scoped_ptr<media::FilterCollection> collection( | 413 scoped_ptr<media::FilterCollection> collection( |
| 402 new media::FilterCollection()); | 414 new media::FilterCollection()); |
| 403 | 415 |
| 404 return new webkit_media::WebMediaPlayerImpl( | 416 return new webkit_media::WebMediaPlayerImpl( |
| 405 frame, | 417 frame, |
| 406 client, | 418 client, |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 // Logging | 854 // Logging |
| 843 void EnableWebCoreLogChannels(const std::string& channels) { | 855 void EnableWebCoreLogChannels(const std::string& channels) { |
| 844 webkit_glue::EnableWebCoreLogChannels(channels); | 856 webkit_glue::EnableWebCoreLogChannels(channels); |
| 845 } | 857 } |
| 846 | 858 |
| 847 void SetGamepadData(const WebKit::WebGamepads& pads) { | 859 void SetGamepadData(const WebKit::WebGamepads& pads) { |
| 848 test_environment->webkit_platform_support()->setGamepadData(pads); | 860 test_environment->webkit_platform_support()->setGamepadData(pads); |
| 849 } | 861 } |
| 850 | 862 |
| 851 } // namespace webkit_support | 863 } // namespace webkit_support |
| OLD | NEW |