Chromium Code Reviews| Index: content/public/test/ppapi_test_utils.cc |
| diff --git a/content/public/test/ppapi_test_utils.cc b/content/public/test/ppapi_test_utils.cc |
| index 0c9e5455c26ebe65a8d84fe06b01dc17634e51c4..2ae3279eb457e6b8f432cf73922b7980c51e9b01 100644 |
| --- a/content/public/test/ppapi_test_utils.cc |
| +++ b/content/public/test/ppapi_test_utils.cc |
| @@ -18,24 +18,40 @@ namespace { |
| bool RegisterPlugin( |
| base::CommandLine* command_line, |
| const base::FilePath::StringType& library_name, |
| - const base::FilePath::StringType& extra_registration_parameters) { |
| + const base::FilePath::StringType& extra_registration_parameters, |
| + const base::FilePath::StringType& mime_type) { |
| base::FilePath plugin_dir; |
| - if (!PathService::Get(base::DIR_MODULE, &plugin_dir)) |
| + if (!PathService::Get(base::DIR_MODULE, &plugin_dir)) { |
| + printf("Couldn't look up module path!\n"); |
|
Avi (use Gerrit)
2015/12/01 15:01:14
Why doesn't LOG(ERROR) or LOG(FATAL) work here?
dcheng
2015/12/01 19:52:02
It does, but these are temporary debugging lines.
Avi (use Gerrit)
2015/12/01 20:51:54
No ideas offhand, but don't commit debugging code.
|
| return false; |
| + } |
| base::FilePath plugin_path = plugin_dir.Append(library_name); |
| + printf("Looking for plugin in %s\n", plugin_path.value().c_str()); |
|
Avi (use Gerrit)
2015/12/01 15:01:14
Is this needed?
|
| // Append the switch to register the pepper plugin. |
| - if (!base::PathExists(plugin_path)) |
| + if (!base::PathExists(plugin_path)) { |
| + printf("File doesn't exist!\n"); |
|
Avi (use Gerrit)
2015/12/01 15:01:14
LOG(FATAL)?
|
| return false; |
| + } |
| base::FilePath::StringType pepper_plugin = plugin_path.value(); |
| pepper_plugin.append(extra_registration_parameters); |
| - pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); |
| + pepper_plugin.append(FILE_PATH_LITERAL(";")); |
| + pepper_plugin.append(mime_type); |
| command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| pepper_plugin); |
| return true; |
| } |
| +bool RegisterPluginWithDefaultMimeType( |
| + base::CommandLine* command_line, |
| + const base::FilePath::StringType& library_name, |
| + const base::FilePath::StringType& extra_registration_parameters) { |
| + return RegisterPlugin(command_line, library_name, |
| + extra_registration_parameters, |
| + FILE_PATH_LITERAL("application/x-ppapi-tests")); |
| +} |
| + |
| } // namespace |
| bool RegisterTestPlugin(base::CommandLine* command_line) { |
| @@ -53,14 +69,32 @@ bool RegisterTestPluginWithExtraParameters( |
| #elif defined(OS_POSIX) |
| base::FilePath::StringType plugin_library = "libppapi_tests.so"; |
| #endif |
| - return RegisterPlugin(command_line, plugin_library, |
| - extra_registration_parameters); |
| + return RegisterPluginWithDefaultMimeType(command_line, plugin_library, |
| + extra_registration_parameters); |
| } |
| bool RegisterPowerSaverTestPlugin(base::CommandLine* command_line) { |
| base::FilePath::StringType library_name = |
| base::FilePath::FromUTF8Unsafe(ppapi::kPowerSaverTestPluginName).value(); |
| - return RegisterPlugin(command_line, library_name, FILE_PATH_LITERAL("")); |
| + return RegisterPluginWithDefaultMimeType(command_line, library_name, |
| + FILE_PATH_LITERAL("")); |
| } |
| +bool RegisterBlinkTestPlugin(base::CommandLine* command_line) { |
| +#if defined(OS_WIN) |
| + static const base::FilePath::CharType kPluginLibrary[] = |
| + L"blink_test_plugin.dll"; |
| +#elif defined(OS_MACOSX) |
| + static const base::FilePath::CharType kPluginLibrary[] = |
| + "blink_test_plugin.plugin"; |
| +#elif defined(OS_POSIX) |
| + static const base::FilePath::CharType kPluginLibrary[] = |
| + "libblink_test_plugin.so"; |
| +#endif |
| + // #name#description#version |
| + static const base::FilePath::CharType kExtraParameters[] = |
| + FILE_PATH_LITERAL("#Blink Test Plugin#Interesting description.#0.8"); |
| + return RegisterPlugin(command_line, kPluginLibrary, kExtraParameters, |
| + FILE_PATH_LITERAL("application/x-blink-test-plugin")); |
| +} |
| } // namespace ppapi |