diff options
-rw-r--r-- | build/all.gyp | 2 | ||||
-rwxr-xr-x | chrome/chrome_tests.gypi | 2 | ||||
-rw-r--r-- | webkit/support/test_webplugin_page_delegate.h | 7 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 23 | ||||
-rw-r--r-- | webkit/support/webkit_support.gyp | 3 | ||||
-rw-r--r-- | webkit/tools/npapi_layout_test_plugin/npapi_layout_test_plugin.gypi | 99 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gypi | 83 |
7 files changed, 131 insertions, 88 deletions
diff --git a/build/all.gyp b/build/all.gyp index 5386c3c..6a4a7e7 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -246,7 +246,7 @@ '../media/media.gyp:media_unittests', '../printing/printing.gyp:printing_unittests', '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests', - '../webkit/webkit.gyp:npapi_layout_test_plugin', + '../webkit/support/webkit_support.gyp:npapi_layout_test_plugin', # TODO(nsylvain) ui_tests.exe depends on test_shell_common. # This should: # 1) not be the case. OR. diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 5f5ba99..a214780 100755 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -288,7 +288,7 @@ '../third_party/libxml/libxml.gyp:libxml', # run time dependencies '../third_party/ppapi/ppapi.gyp:ppapi_tests', - '../webkit/webkit.gyp:npapi_layout_test_plugin', + '../webkit/support/webkit_support.gyp:npapi_layout_test_plugin', '../webkit/default_plugin/default_plugin.gyp:default_plugin', ], 'include_dirs': [ diff --git a/webkit/support/test_webplugin_page_delegate.h b/webkit/support/test_webplugin_page_delegate.h index fe61032..05d4728 100644 --- a/webkit/support/test_webplugin_page_delegate.h +++ b/webkit/support/test_webplugin_page_delegate.h @@ -7,6 +7,7 @@ #include <string> +#include "webkit/glue/plugins/webplugin_delegate_impl.h" #include "webkit/glue/plugins/webplugin_page_delegate.h" namespace webkit_support { @@ -18,7 +19,11 @@ class TestWebPluginPageDelegate : public webkit_glue::WebPluginPageDelegate { virtual webkit_glue::WebPluginDelegate* CreatePluginDelegate( const FilePath& file_path, - const std::string& mime_type) { return NULL; } + const std::string& mime_type) { + // We don't need a valid native window handle in layout tests. + // So just passing 0. + return WebPluginDelegateImpl::Create(file_path, mime_type, 0); + } virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) {} virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) {} virtual void DidMovePlugin(const webkit_glue::WebPluginGeometry& move) {} diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index c594fad..523c0469 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -24,8 +24,10 @@ #include "webkit/glue/media/media_resource_loader_bridge_factory.h" #include "webkit/glue/media/simple_data_source.h" #include "webkit/glue/media/video_renderer_impl.h" +#include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/plugins/webplugin_impl.h" #include "webkit/glue/plugins/webplugin_page_delegate.h" +#include "webkit/glue/plugins/webplugininfo.h" #include "webkit/glue/webkitclient_impl.h" #include "webkit/glue/webmediaplayer_impl.h" #include "webkit/support/platform_support.h" @@ -82,10 +84,12 @@ class WebPluginImplWithPageDelegate public webkit_glue::WebPluginImpl { public: WebPluginImplWithPageDelegate(WebFrame* frame, - const WebPluginParams& params) + const WebPluginParams& params, + const FilePath& path, + const std::string& mime_type) : webkit_support::TestWebPluginPageDelegate(), webkit_glue::WebPluginImpl( - frame, params, FilePath(), params.mimeType.utf8(), AsWeakPtr()) {} + frame, params, path, mime_type, AsWeakPtr()) {} virtual ~WebPluginImplWithPageDelegate() {} private: DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate); @@ -144,7 +148,20 @@ WebKit::WebKitClient* GetWebKitClient() { WebPlugin* CreateWebPlugin(WebFrame* frame, const WebPluginParams& params) { - return new WebPluginImplWithPageDelegate(frame, params); + const bool kAllowWildcard = true; + WebPluginInfo info; + std::string actual_mime_type; + if (!NPAPI::PluginList::Singleton()->GetPluginInfo( + params.url, params.mimeType.utf8(), kAllowWildcard, &info, + &actual_mime_type)) { + return NULL; + } + + if (actual_mime_type.empty()) + actual_mime_type = params.mimeType.utf8(); + + return new WebPluginImplWithPageDelegate( + frame, params, info.path, actual_mime_type); } WebKit::WebMediaPlayer* CreateMediaPlayer(WebFrame* frame, diff --git a/webkit/support/webkit_support.gyp b/webkit/support/webkit_support.gyp index fa9256a..fb6052b 100644 --- a/webkit/support/webkit_support.gyp +++ b/webkit/support/webkit_support.gyp @@ -7,6 +7,9 @@ '../appcache/webkit_appcache.gypi', '../database/webkit_database.gypi', '../glue/webkit_glue.gypi', + # TODO(tkent): Merge npapi_layout_test_plugin into TestNetscapePlugIn + # of WebKit. + '../tools/npapi_layout_test_plugin/npapi_layout_test_plugin.gypi', 'webkit_support.gypi', ], } diff --git a/webkit/tools/npapi_layout_test_plugin/npapi_layout_test_plugin.gypi b/webkit/tools/npapi_layout_test_plugin/npapi_layout_test_plugin.gypi new file mode 100644 index 0000000..b329bed --- /dev/null +++ b/webkit/tools/npapi_layout_test_plugin/npapi_layout_test_plugin.gypi @@ -0,0 +1,99 @@ +# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'npapi_layout_test_plugin', + 'type': 'loadable_module', + 'variables': { + 'chromium_code': 1, + }, + 'mac_bundle': 1, + 'msvs_guid': 'BE6D5659-A8D5-4890-A42C-090DD10EF62C', + 'sources': [ + 'PluginObject.cpp', + 'TestObject.cpp', + 'main.cpp', + 'npapi_layout_test_plugin.def', + 'npapi_layout_test_plugin.rc', + ], + 'include_dirs': [ + '../../..', + ], + 'dependencies': [ + '<(DEPTH)/third_party/npapi/npapi.gyp:npapi', + ], + 'msvs_disabled_warnings': [ 4996 ], + 'mac_bundle_resources': [ + 'Info.r', + ], + 'xcode_settings': { + 'INFOPLIST_FILE': '<(DEPTH)/webkit/tools/npapi_layout_test_plugin/Info.plist', + }, + 'conditions': [ + ['inside_chromium_build==0', { + 'dependencies': ['../../../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf'], + },{ + 'dependencies': ['<(DEPTH)/third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf'], + }], + ['OS!="win"', { + 'sources!': [ + 'npapi_layout_test_plugin.def', + 'npapi_layout_test_plugin.rc', + ], + # TODO(bradnelson): + # This copy should really live here, as a post-build step, + # but it's currently being implemented via + # AdditionalDependencies, which tries to do the copy before + # the file is built... + # + }, { # OS == "win" + # # The old VS build would explicitly copy the .dll into the + # # plugins subdirectory like this. It might be possible to + # # use the 'product_dir' setting to build directly into + # # plugins/ (as is done on Linux), but we'd need to verify + # # that nothing breaks first. + # 'copies': [ + # { + # 'destination': '<(PRODUCT_DIR)/plugins', + # 'files': ['<(PRODUCT_DIR)/npapi_layout_test_plugin.dll'], + # }, + # ], + 'variables': { + # This is not a relative pathname. Avoid pathname relativization + # by sticking it in a variable that isn't recognized as one + # containing pathnames, and by using the >(late) form of variable + # expansion. + 'winmm_lib': 'winmm.lib', + }, + 'link_settings': { + 'libraries': [ + '>(winmm_lib)', + ], + }, + }], + ['OS=="mac"', { + 'product_name': 'TestNetscapePlugIn', + 'product_extension': 'plugin', + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Carbon.framework', + ], + }, + }], + ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and (target_arch=="x64" or target_arch=="arm")', { + # Shared libraries need -fPIC on x86-64 + 'cflags': ['-fPIC'] + }], + ], + }, + ], +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index a8ae765..70ef26a 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -41,10 +41,10 @@ '<(DEPTH)/webkit/support/webkit_support.gyp:appcache', '<(DEPTH)/webkit/support/webkit_support.gyp:database', '<(DEPTH)/webkit/support/webkit_support.gyp:glue', + '<(DEPTH)/webkit/support/webkit_support.gyp:npapi_layout_test_plugin', '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_resources', '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_support', '<(DEPTH)/webkit/webkit.gyp:inspector_resources', - 'npapi_layout_test_plugin', ], 'msvs_guid': '77C32787-1B96-CB84-B905-7F170629F0AC', 'sources': [ @@ -488,87 +488,6 @@ }], ], }, - { - 'target_name': 'npapi_layout_test_plugin', - 'type': 'loadable_module', - 'variables': { - 'chromium_code': 1, - }, - 'mac_bundle': 1, - 'msvs_guid': 'BE6D5659-A8D5-4890-A42C-090DD10EF62C', - 'sources': [ - '../npapi_layout_test_plugin/PluginObject.cpp', - '../npapi_layout_test_plugin/TestObject.cpp', - '../npapi_layout_test_plugin/main.cpp', - '../npapi_layout_test_plugin/npapi_layout_test_plugin.def', - '../npapi_layout_test_plugin/npapi_layout_test_plugin.rc', - ], - 'include_dirs': [ - '../../..', - ], - 'dependencies': [ - '<(DEPTH)/third_party/npapi/npapi.gyp:npapi', - '<(DEPTH)/third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', - ], - 'msvs_disabled_warnings': [ 4996 ], - 'mac_bundle_resources': [ - '../npapi_layout_test_plugin/Info.r', - ], - 'xcode_settings': { - 'INFOPLIST_FILE': '<(DEPTH)/webkit/tools/npapi_layout_test_plugin/Info.plist', - }, - 'conditions': [ - ['OS!="win"', { - 'sources!': [ - '../npapi_layout_test_plugin/npapi_layout_test_plugin.def', - '../npapi_layout_test_plugin/npapi_layout_test_plugin.rc', - ], - # TODO(bradnelson): - # This copy should really live here, as a post-build step, - # but it's currently being implemented via - # AdditionalDependencies, which tries to do the copy before - # the file is built... - # - }, { # OS == "win" - # # The old VS build would explicitly copy the .dll into the - # # plugins subdirectory like this. It might be possible to - # # use the 'product_dir' setting to build directly into - # # plugins/ (as is done on Linux), but we'd need to verify - # # that nothing breaks first. - # 'copies': [ - # { - # 'destination': '<(PRODUCT_DIR)/plugins', - # 'files': ['<(PRODUCT_DIR)/npapi_layout_test_plugin.dll'], - # }, - # ], - 'variables': { - # This is not a relative pathname. Avoid pathname relativization - # by sticking it in a variable that isn't recognized as one - # containing pathnames, and by using the >(late) form of variable - # expansion. - 'winmm_lib': 'winmm.lib', - }, - 'link_settings': { - 'libraries': [ - '>(winmm_lib)', - ], - }, - }], - ['OS=="mac"', { - 'product_name': 'TestNetscapePlugIn', - 'product_extension': 'plugin', - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Carbon.framework', - ], - }, - }], - ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and (target_arch=="x64" or target_arch=="arm")', { - # Shared libraries need -fPIC on x86-64 - 'cflags': ['-fPIC'] - }], - ], - }, ], 'conditions': [ ['target_arch!="x64" and target_arch!="arm"', { |