diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 16:52:12 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 16:52:12 +0000 |
commit | c9b3fb0bd845b8911fa3aa2400717dff34713e24 (patch) | |
tree | 551e9e38bd5fc49fccef99ae046be540eb1bd330 | |
parent | b3db1e412fac9c9ae91e718b17da6f55a05a766c (diff) | |
download | chromium_src-c9b3fb0bd845b8911fa3aa2400717dff34713e24.zip chromium_src-c9b3fb0bd845b8911fa3aa2400717dff34713e24.tar.gz chromium_src-c9b3fb0bd845b8911fa3aa2400717dff34713e24.tar.bz2 |
Copy the npapi pepper test plugin during the build so we don't
have to do it when running the test.
Remove all the code in the test for copying files since it's no longer needed.
Review URL: http://codereview.chromium.org/3048048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55235 0039d316-1c4b-4281-b951-d872f2087c98
-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, 90 insertions, 84 deletions
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index e57f88c..a4f3b99 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:npapi_test_plugin', - '../webkit/webkit.gyp:npapi_pepper_test_plugin', + '../webkit/webkit.gyp:copy_npapi_test_plugin', + '../webkit/webkit.gyp:copy_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:npapi_test_plugin', + '../webkit/webkit.gyp:copy_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:npapi_test_plugin', + '../webkit/webkit.gyp:copy_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 c1ffb6f..8df91c2 100644 --- a/chrome/test/ui/layout_plugin_uitest.cc +++ b/chrome/test/ui/layout_plugin_uitest.cc @@ -19,17 +19,9 @@ 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(kTestPluginName) {} + LayoutPluginTester() : NPAPITesterBase() {} }; // 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 ee3903a0..87c1ba1 100644 --- a/chrome/test/ui/npapi_test_helper.cc +++ b/chrome/test/ui/npapi_test_helper.cc @@ -16,46 +16,20 @@ #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(const std::string& test_plugin_name) - : test_plugin_name_(test_plugin_name) { +NPAPITesterBase::NPAPITesterBase() { } 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, - plugins_directory); + GetPluginsDirectory()); #endif UITest::SetUp(); @@ -66,9 +40,6 @@ 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 23435a1..eb42508 100644 --- a/chrome/test/ui/npapi_test_helper.h +++ b/chrome/test/ui/npapi_test_helper.h @@ -14,39 +14,24 @@ extern const char kTestCompleteSuccess[]; } // namespace npapi_test. // Base class for NPAPI tests. It provides common functionality between -// 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. +// regular NPAPI plugins and pepper NPAPI plugins. class NPAPITesterBase : public UITest { protected: - explicit NPAPITesterBase(const std::string& test_plugin_name); + explicit NPAPITesterBase(); 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 NPAPITester { +class NPAPIVisiblePluginTester : public NPAPITesterBase { protected: virtual void SetUp(); }; // Helper class for NPAPI plugin UI tests which use incognito mode. -class NPAPIIncognitoTester : public NPAPITester { +class NPAPIIncognitoTester : public NPAPITesterBase { protected: virtual void SetUp(); }; diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index 1a7ee68..5739b05 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(NPAPITester, Arguments) { +TEST_F(NPAPITesterBase, 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(NPAPITester, Arguments) { // Test invoking many plugins within a single page. // Test still flaky under valgrind // http://crbug.com/28372, http://crbug.com/45561 -TEST_F(NPAPITester, FLAKY_ManyPlugins) { +TEST_F(NPAPITesterBase, 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(NPAPITester, FLAKY_ManyPlugins) { } // Test various calls to GetURL from a plugin. -TEST_F(NPAPITester, GetURL) { +TEST_F(NPAPITesterBase, 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(NPAPITester, GetURL) { // Test various calls to GetURL for javascript URLs with // non NULL targets from a plugin. -TEST_F(NPAPITester, GetJavaScriptURL) { +TEST_F(NPAPITesterBase, 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(NPAPITester, 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(NPAPITester, FLAKY_GetJavaScriptURL2) { +TEST_F(NPAPITesterBase, 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(NPAPITester, 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(NPAPITester, NPObjectProxy) { +TEST_F(NPAPITesterBase, 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(NPAPITester, PrivateDisabled) { +TEST_F(NPAPITesterBase, PrivateDisabled) { if (UITest::in_process_renderer()) return; @@ -244,7 +244,7 @@ TEST_F(NPAPITester, PrivateDisabled) { kTestCompleteSuccess, action_max_timeout_ms()); } -TEST_F(NPAPITester, ScheduleTimer) { +TEST_F(NPAPITesterBase, 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(NPAPITester, ScheduleTimer) { kTestCompleteSuccess, action_max_timeout_ms()); } -TEST_F(NPAPITester, PluginThreadAsyncCall) { +TEST_F(NPAPITesterBase, 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(NPAPITester, EnsureScriptingWorksInDestroy) { +TEST_F(NPAPITesterBase, EnsureScriptingWorksInDestroy) { if (UITest::in_process_renderer()) return; @@ -319,7 +319,7 @@ TEST_F(NPAPITester, 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(NPAPITester, FLAKY_NoHangIfInitCrashes) { +TEST_F(NPAPITesterBase, 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 8a8c0025..590b5f3 100644 --- a/chrome/test/ui/pepper_uitest.cc +++ b/chrome/test/ui/pepper_uitest.cc @@ -9,21 +9,13 @@ #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(kPepperTestPluginName) {} + PepperTester() : NPAPITesterBase() {} 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 5bbb1fa..52d68bc 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': [ - 'npapi_test_plugin', + 'copy_npapi_test_plugin', ], }], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { @@ -583,6 +583,39 @@ ], }, { + '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, @@ -616,6 +649,39 @@ '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"', { |