diff options
-rw-r--r-- | chrome/chrome_tests.gypi | 8 | ||||
-rw-r--r-- | chrome/test/ui/layout_plugin_uitest.cc | 10 | ||||
-rw-r--r-- | chrome/test/ui/npapi_test_helper.cc | 33 | ||||
-rw-r--r-- | chrome/test/ui/npapi_test_helper.h | 23 | ||||
-rw-r--r-- | chrome/test/ui/npapi_uitest.cc | 22 | ||||
-rw-r--r-- | chrome/test/ui/pepper_uitest.cc | 10 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gypi | 68 |
7 files changed, 84 insertions, 90 deletions
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index a4f3b99..e57f88c 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -343,8 +343,8 @@ # http://code.google.com/p/chromium/issues/detail?id=18337 ['target_arch!="x64" and target_arch!="arm"', { 'dependencies': [ - '../webkit/webkit.gyp:copy_npapi_test_plugin', - '../webkit/webkit.gyp:copy_npapi_pepper_test_plugin', + '../webkit/webkit.gyp:npapi_test_plugin', + '../webkit/webkit.gyp:npapi_pepper_test_plugin', '../third_party/mesa/mesa.gyp:osmesa', ], }], @@ -518,7 +518,7 @@ '../google_update/google_update.gyp:google_update', '../views/views.gyp:views', # run time dependency - '../webkit/webkit.gyp:copy_npapi_test_plugin', + '../webkit/webkit.gyp:npapi_test_plugin', ], 'conditions': [ ['win_use_allocator_shim==1', { @@ -585,7 +585,7 @@ 'test_support_common', '../google_update/google_update.gyp:google_update', # run time dependency - '../webkit/webkit.gyp:copy_npapi_test_plugin', + '../webkit/webkit.gyp:npapi_test_plugin', ], 'conditions': [ ['win_use_allocator_shim==1', { diff --git a/chrome/test/ui/layout_plugin_uitest.cc b/chrome/test/ui/layout_plugin_uitest.cc index 8df91c2..c1ffb6f 100644 --- a/chrome/test/ui/layout_plugin_uitest.cc +++ b/chrome/test/ui/layout_plugin_uitest.cc @@ -19,9 +19,17 @@ using npapi_test::kTestCompleteSuccess; static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi"); +#if defined(OS_WIN) +static const char kTestPluginName[] = "npapi_layout_test_plugin.dll"; +#elif defined(OS_MACOSX) +static const char kTestPluginName[] = "TestNetscapePlugIn.plugin"; +#elif defined(OS_LINUX) +static const char kTestPluginName[] = "libnpapi_layout_test_plugin.so"; +#endif + class LayoutPluginTester : public NPAPITesterBase { protected: - LayoutPluginTester() : NPAPITesterBase() {} + LayoutPluginTester() : NPAPITesterBase(kTestPluginName) {} }; // Make sure that navigating away from a plugin referenced by JS doesn't diff --git a/chrome/test/ui/npapi_test_helper.cc b/chrome/test/ui/npapi_test_helper.cc index 87c1ba1..ee3903a0 100644 --- a/chrome/test/ui/npapi_test_helper.cc +++ b/chrome/test/ui/npapi_test_helper.cc @@ -16,20 +16,46 @@ #include "chrome/common/chrome_switches.h" #include "webkit/glue/plugins/plugin_list.h" +#if defined(OS_WIN) +static const char kNpapiTestPluginName[] = "npapi_test_plugin.dll"; +#elif defined(OS_MACOSX) +static const char kNpapiTestPluginName[] = "npapi_test_plugin.plugin"; +#elif defined(OS_LINUX) +static const char kNpapiTestPluginName[] = "libnpapi_test_plugin.so"; +#endif + namespace npapi_test { const char kTestCompleteCookie[] = "status"; const char kTestCompleteSuccess[] = "OK"; } // namespace npapi_test. -NPAPITesterBase::NPAPITesterBase() { +NPAPITesterBase::NPAPITesterBase(const std::string& test_plugin_name) + : test_plugin_name_(test_plugin_name) { } void NPAPITesterBase::SetUp() { + // We need to copy our test-plugin into the plugins directory so that + // the browser can load it. + // TODO(tc): We should copy the plugins as a build step, not during + // the tests. Then we don't have to clean up after the copy in the test. + FilePath plugins_directory = GetPluginsDirectory(); + FilePath plugin_src = browser_directory_.AppendASCII(test_plugin_name_); + ASSERT_TRUE(file_util::PathExists(plugin_src)); + test_plugin_path_ = plugins_directory.AppendASCII(test_plugin_name_); + + file_util::CreateDirectory(plugins_directory); +#if defined(OS_WIN) + file_util::DieFileDie(test_plugin_path_, false); +#endif + ASSERT_TRUE(file_util::CopyDirectory(plugin_src, test_plugin_path_, true)) + << "Copy failed from " << plugin_src.value() + << " to " << test_plugin_path_.value(); + #if defined(OS_MACOSX) // The plugins directory isn't read by default on the Mac, so it needs to be // explicitly registered. launch_arguments_.AppendSwitchPath(switches::kExtraPluginDir, - GetPluginsDirectory()); + plugins_directory); #endif UITest::SetUp(); @@ -40,6 +66,9 @@ FilePath NPAPITesterBase::GetPluginsDirectory() { return plugins_directory; } +NPAPITester::NPAPITester() : NPAPITesterBase(kNpapiTestPluginName) { +} + // NPAPIVisiblePluginTester members. void NPAPIVisiblePluginTester::SetUp() { show_window_ = true; diff --git a/chrome/test/ui/npapi_test_helper.h b/chrome/test/ui/npapi_test_helper.h index eb42508..23435a1 100644 --- a/chrome/test/ui/npapi_test_helper.h +++ b/chrome/test/ui/npapi_test_helper.h @@ -14,24 +14,39 @@ extern const char kTestCompleteSuccess[]; } // namespace npapi_test. // Base class for NPAPI tests. It provides common functionality between -// regular NPAPI plugins and pepper NPAPI plugins. +// regular NPAPI plugins and pepper NPAPI plugins. The base classes provide the +// name of the plugin they need test in the constructor. This base class will +// copy the plugin (assuming it has been built) to the plugins directory +// so it is loaded when chromium is launched. class NPAPITesterBase : public UITest { protected: - explicit NPAPITesterBase(); + explicit NPAPITesterBase(const std::string& test_plugin_name); virtual void SetUp(); FilePath GetPluginsDirectory(); + + private: + std::string test_plugin_name_; + FilePath test_plugin_path_; +}; + +// Helper class for NPAPI plugin UI tests. +class NPAPITester : public NPAPITesterBase { + protected: + NPAPITester(); + + private: }; // Helper class for NPAPI plugin UI tests, which need the browser window // to be visible. -class NPAPIVisiblePluginTester : public NPAPITesterBase { +class NPAPIVisiblePluginTester : public NPAPITester { protected: virtual void SetUp(); }; // Helper class for NPAPI plugin UI tests which use incognito mode. -class NPAPIIncognitoTester : public NPAPITesterBase { +class NPAPIIncognitoTester : public NPAPITester { protected: virtual void SetUp(); }; diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index 5739b05..1a7ee68 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -36,7 +36,7 @@ using npapi_test::kTestCompleteSuccess; static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi"); // Test passing arguments to a plugin. -TEST_F(NPAPITesterBase, Arguments) { +TEST_F(NPAPITester, Arguments) { const FilePath test_case(FILE_PATH_LITERAL("arguments.html")); GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); @@ -47,7 +47,7 @@ TEST_F(NPAPITesterBase, Arguments) { // Test invoking many plugins within a single page. // Test still flaky under valgrind // http://crbug.com/28372, http://crbug.com/45561 -TEST_F(NPAPITesterBase, FLAKY_ManyPlugins) { +TEST_F(NPAPITester, FLAKY_ManyPlugins) { const FilePath test_case(FILE_PATH_LITERAL("many_plugins.html")); GURL url(ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case)); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); @@ -62,7 +62,7 @@ TEST_F(NPAPITesterBase, FLAKY_ManyPlugins) { } // Test various calls to GetURL from a plugin. -TEST_F(NPAPITesterBase, GetURL) { +TEST_F(NPAPITester, GetURL) { const FilePath test_case(FILE_PATH_LITERAL("geturl.html")); GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); @@ -72,7 +72,7 @@ TEST_F(NPAPITesterBase, GetURL) { // Test various calls to GetURL for javascript URLs with // non NULL targets from a plugin. -TEST_F(NPAPITesterBase, GetJavaScriptURL) { +TEST_F(NPAPITester, GetJavaScriptURL) { const FilePath test_case(FILE_PATH_LITERAL("get_javascript_url.html")); GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); @@ -83,7 +83,7 @@ TEST_F(NPAPITesterBase, GetJavaScriptURL) { // Flaky test: http://crbug.com/29020 // Test that calling GetURL with a javascript URL and target=_self // works properly when the plugin is embedded in a subframe. -TEST_F(NPAPITesterBase, FLAKY_GetJavaScriptURL2) { +TEST_F(NPAPITester, FLAKY_GetJavaScriptURL2) { const FilePath test_case(FILE_PATH_LITERAL("get_javascript_url2.html")); GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); @@ -94,7 +94,7 @@ TEST_F(NPAPITesterBase, FLAKY_GetJavaScriptURL2) { // Tests that if an NPObject is proxies back to its original process, the // original pointer is returned and not a proxy. If this fails the plugin // will crash. -TEST_F(NPAPITesterBase, NPObjectProxy) { +TEST_F(NPAPITester, NPObjectProxy) { const FilePath test_case(FILE_PATH_LITERAL("npobject_proxy.html")); GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); @@ -233,7 +233,7 @@ TEST_F(NPAPIVisiblePluginTester, DISABLED_OpenPopupWindowWithPlugin) { } // Test checking the privacy mode is off. -TEST_F(NPAPITesterBase, PrivateDisabled) { +TEST_F(NPAPITester, PrivateDisabled) { if (UITest::in_process_renderer()) return; @@ -244,7 +244,7 @@ TEST_F(NPAPITesterBase, PrivateDisabled) { kTestCompleteSuccess, action_max_timeout_ms()); } -TEST_F(NPAPITesterBase, ScheduleTimer) { +TEST_F(NPAPITester, ScheduleTimer) { const FilePath test_case(FILE_PATH_LITERAL("schedule_timer.html")); GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); @@ -252,7 +252,7 @@ TEST_F(NPAPITesterBase, ScheduleTimer) { kTestCompleteSuccess, action_max_timeout_ms()); } -TEST_F(NPAPITesterBase, PluginThreadAsyncCall) { +TEST_F(NPAPITester, PluginThreadAsyncCall) { const FilePath test_case(FILE_PATH_LITERAL("plugin_thread_async_call.html")); GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); @@ -303,7 +303,7 @@ TEST_F(NPAPIVisiblePluginTester, GetURLRequestFailWrite) { } #if defined(OS_WIN) -TEST_F(NPAPITesterBase, EnsureScriptingWorksInDestroy) { +TEST_F(NPAPITester, EnsureScriptingWorksInDestroy) { if (UITest::in_process_renderer()) return; @@ -319,7 +319,7 @@ TEST_F(NPAPITesterBase, EnsureScriptingWorksInDestroy) { // This test uses a Windows Event to signal to the plugin that it should crash // on NP_Initialize. // This is flaky. http://crbug.com/32048 -TEST_F(NPAPITesterBase, FLAKY_NoHangIfInitCrashes) { +TEST_F(NPAPITester, FLAKY_NoHangIfInitCrashes) { if (UITest::in_process_renderer()) return; diff --git a/chrome/test/ui/pepper_uitest.cc b/chrome/test/ui/pepper_uitest.cc index 590b5f3..8a8c0025 100644 --- a/chrome/test/ui/pepper_uitest.cc +++ b/chrome/test/ui/pepper_uitest.cc @@ -9,13 +9,21 @@ #include "chrome/test/ui/npapi_test_helper.h" #include "chrome/test/ui_test_utils.h" +#if defined(OS_WIN) +static const char kPepperTestPluginName[] = "npapi_pepper_test_plugin.dll"; +#elif defined(OS_MACOSX) +static const char kPepperTestPluginName[] = "npapi_pepper_test_plugin.plugin"; +#elif defined(OS_LINUX) +static const char kPepperTestPluginName[] = "libnpapi_pepper_test_plugin.so"; +#endif + using npapi_test::kTestCompleteCookie; using npapi_test::kTestCompleteSuccess; // Helper class pepper NPAPI tests. class PepperTester : public NPAPITesterBase { protected: - PepperTester() : NPAPITesterBase() {} + PepperTester() : NPAPITesterBase(kPepperTestPluginName) {} virtual void SetUp() { // TODO(alokp): Remove no-sandbox flag once gpu plugin can run in sandbox. diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index 52d68bc..5bbb1fa 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -124,7 +124,7 @@ # http://code.google.com/p/chromium/issues/detail?id=18337 ['target_arch!="x64" and target_arch!="arm"', { 'dependencies': [ - 'copy_npapi_test_plugin', + 'npapi_test_plugin', ], }], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { @@ -583,39 +583,6 @@ ], }, { - 'target_name': 'copy_npapi_test_plugin', - 'type': 'none', - 'dependencies': [ - 'npapi_test_plugin', - ], - 'conditions': [ - ['OS=="win"', { - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/npapi_test_plugin.dll'], - }, - ], - }], - ['OS=="mac"', { - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/plugins/', - 'files': ['<(PRODUCT_DIR)/npapi_test_plugin.plugin'], - }, - ] - }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/libnpapi_test_plugin.so'], - }, - ], - }], - ], - }, - { 'target_name': 'npapi_pepper_test_plugin', 'type': 'loadable_module', 'mac_bundle': 1, @@ -649,39 +616,6 @@ 'INFOPLIST_FILE': '<(DEPTH)/webkit/tools/npapi_pepper_test_plugin/Info.plist', }, }, - { - 'target_name': 'copy_npapi_pepper_test_plugin', - 'type': 'none', - 'dependencies': [ - 'npapi_pepper_test_plugin', - ], - 'conditions': [ - ['OS=="win"', { - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/npapi_pepper_test_plugin.dll'], - }, - ], - }], - ['OS=="mac"', { - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/plugins/', - 'files': ['<(PRODUCT_DIR)/npapi_pepper_test_plugin.plugin/'], - }, - ] - }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/libnpapi_pepper_test_plugin.so'], - }, - ], - }], - ], - }, ], }], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { |