Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: webkit/tools/test_shell/plugin_tests.cc

Issue 102014: Rewrite plugin_tests.cc to use FilePath and file_utils.h instead... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/tools/test_shell/test_shell.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/plugin_tests.cc
===================================================================
--- webkit/tools/test_shell/plugin_tests.cc (revision 14938)
+++ webkit/tools/test_shell/plugin_tests.cc (working copy)
@@ -4,6 +4,7 @@
#include <string>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/string_util.h"
@@ -19,31 +20,39 @@
using WebKit::WebScriptSource;
using WebKit::WebString;
+#if defined(OS_WIN)
+#define TEST_PLUGIN_NAME "npapi_test_plugin.dll"
+#elif defined(OS_MACOSX)
+#define TEST_PLUGIN_NAME "npapi_test_plugin.bundle"
+#elif defined(OS_LINUX)
+#define TEST_PLUGIN_NAME "npapi_test_plugin.so"
+#endif
+
// Provides functionality for creating plugin tests.
class PluginTest : public TestShellTest {
public:
PluginTest() {
- std::wstring current_directory;
- PathService::Get(base::DIR_EXE, &current_directory);
- plugin_src_ = current_directory + L"\\npapi_test_plugin.dll";
+ FilePath executable_directory;
+ PathService::Get(base::DIR_EXE, &executable_directory);
+ plugin_src_ = executable_directory.AppendASCII(TEST_PLUGIN_NAME);
CHECK(file_util::PathExists(plugin_src_));
- plugin_file_path_ = current_directory + L"\\plugins";
- ::CreateDirectory(plugin_file_path_.c_str(), NULL);
+ plugin_file_path_ = executable_directory.AppendASCII("plugins");
+ file_util::CreateDirectory(plugin_file_path_);
- plugin_file_path_ += L"\\npapi_test_plugin.dll";
+ plugin_file_path_ = plugin_file_path_.AppendASCII(TEST_PLUGIN_NAME);
}
void CopyTestPlugin() {
- ASSERT_TRUE(CopyFile(plugin_src_.c_str(), plugin_file_path_.c_str(), FALSE));
+ ASSERT_TRUE(file_util::CopyDirectory(plugin_src_, plugin_file_path_, true));
}
void DeleteTestPlugin() {
- ::DeleteFile(plugin_file_path_.c_str());
+ file_util::Delete(plugin_file_path_, true);
}
- std::wstring plugin_src_;
- std::wstring plugin_file_path_;
+ FilePath plugin_src_;
+ FilePath plugin_file_path_;
};
// Tests navigator.plugins.refresh() works.
@@ -55,7 +64,7 @@
var l = navigator.plugins.length;\
var result = document.getElementById('result');\
for(var i = 0; i < l; i++) {\
- if (navigator.plugins[i].filename == 'npapi_test_plugin.dll') {\
+ if (navigator.plugins[i].filename == '" TEST_PLUGIN_NAME "') {\
result.innerHTML = 'DONE';\
break;\
}\
@@ -98,6 +107,8 @@
DeleteTestPlugin();
}
+#if defined(OS_WIN)
+// TODO(port): Reenable on mac and linux once they have working default plugins.
TEST_F(PluginTest, DefaultPluginLoadTest) {
std::string html = "\
<div id='result'>Test running....</div>\
@@ -125,6 +136,7 @@
ASSERT_EQ(true, StartsWith(text, L"DONE", true));
}
+#endif
// Tests that if a frame is deleted as a result of calling NPP_HandleEvent, we
// don't crash.
« no previous file with comments | « no previous file | webkit/tools/test_shell/test_shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698