Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/test/ppapi_test_utils.h" | 5 #include "content/public/test/ppapi_test_utils.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "content/public/common/content_constants.h" | |
| 14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 15 #include "ppapi/shared_impl/ppapi_constants.h" | 16 #include "ppapi/shared_impl/ppapi_constants.h" |
| 17 #include "ppapi/shared_impl/ppapi_switches.h" | |
| 16 | 18 |
| 17 using CharType = base::FilePath::CharType; | 19 using CharType = base::FilePath::CharType; |
| 18 using StringType = base::FilePath::StringType; | 20 using StringType = base::FilePath::StringType; |
| 19 | 21 |
| 20 namespace ppapi { | 22 namespace ppapi { |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| 24 struct PluginInfo { | 26 struct PluginInfo { |
| 25 PluginInfo(const StringType& library_name, | 27 PluginInfo(const StringType& library_name, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 base::FilePath::StringType plugin_library = L"ppapi_tests.dll"; | 83 base::FilePath::StringType plugin_library = L"ppapi_tests.dll"; |
| 82 #elif defined(OS_MACOSX) | 84 #elif defined(OS_MACOSX) |
| 83 base::FilePath::StringType plugin_library = "ppapi_tests.plugin"; | 85 base::FilePath::StringType plugin_library = "ppapi_tests.plugin"; |
| 84 #elif defined(OS_POSIX) | 86 #elif defined(OS_POSIX) |
| 85 base::FilePath::StringType plugin_library = "libppapi_tests.so"; | 87 base::FilePath::StringType plugin_library = "libppapi_tests.so"; |
| 86 #endif | 88 #endif |
| 87 return RegisterPluginWithDefaultMimeType(command_line, plugin_library, | 89 return RegisterPluginWithDefaultMimeType(command_line, plugin_library, |
| 88 extra_registration_parameters); | 90 extra_registration_parameters); |
| 89 } | 91 } |
| 90 | 92 |
| 91 bool RegisterPowerSaverTestPlugin(base::CommandLine* command_line) { | 93 bool RegisterFlashTestPlugin(base::CommandLine* command_line) { |
|
xhwang
2016/09/27 20:35:26
Please add some more comments. It's very confusing
tommycli
2016/09/27 20:45:38
Done.
| |
| 94 // Power Saver plugin requires Pepper testing API. | |
| 95 command_line->AppendSwitch(switches::kEnablePepperTesting); | |
| 96 | |
| 92 base::FilePath::StringType library_name = | 97 base::FilePath::StringType library_name = |
| 93 base::FilePath::FromUTF8Unsafe(ppapi::kPowerSaverTestPluginName).value(); | 98 base::FilePath::FromUTF8Unsafe(ppapi::kPowerSaverTestPluginName).value(); |
| 94 return RegisterPluginWithDefaultMimeType(command_line, library_name, | 99 std::vector<PluginInfo> plugins; |
| 95 FILE_PATH_LITERAL("")); | 100 // Register a fake Flash with 100.0 version (to avoid outdated checks). |
| 101 base::FilePath::StringType fake_flash_parameter = | |
| 102 base::FilePath::FromUTF8Unsafe( | |
| 103 std::string("#") + content::kFlashPluginName + "#Description#100.0") | |
| 104 .value(); | |
| 105 plugins.push_back( | |
| 106 PluginInfo(library_name, fake_flash_parameter, | |
| 107 FILE_PATH_LITERAL("application/x-shockwave-flash"))); | |
| 108 return RegisterPlugins(command_line, plugins); | |
| 96 } | 109 } |
| 97 | 110 |
| 98 bool RegisterBlinkTestPlugin(base::CommandLine* command_line) { | 111 bool RegisterBlinkTestPlugin(base::CommandLine* command_line) { |
| 99 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
| 100 static const CharType kPluginLibrary[] = L"blink_test_plugin.dll"; | 113 static const CharType kPluginLibrary[] = L"blink_test_plugin.dll"; |
| 101 static const CharType kDeprecatedPluginLibrary[] = | 114 static const CharType kDeprecatedPluginLibrary[] = |
| 102 L"blink_deprecated_test_plugin.dll"; | 115 L"blink_deprecated_test_plugin.dll"; |
| 103 #elif defined(OS_MACOSX) | 116 #elif defined(OS_MACOSX) |
| 104 static const CharType kPluginLibrary[] = "blink_test_plugin.plugin"; | 117 static const CharType kPluginLibrary[] = "blink_test_plugin.plugin"; |
| 105 static const CharType kDeprecatedPluginLibrary[] = | 118 static const CharType kDeprecatedPluginLibrary[] = |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 120 FILE_PATH_LITERAL("application/x-blink-test-plugin#blinktestplugin"))); | 133 FILE_PATH_LITERAL("application/x-blink-test-plugin#blinktestplugin"))); |
| 121 plugins.push_back( | 134 plugins.push_back( |
| 122 PluginInfo(kDeprecatedPluginLibrary, kDeprecatedExtraParameters, | 135 PluginInfo(kDeprecatedPluginLibrary, kDeprecatedExtraParameters, |
| 123 FILE_PATH_LITERAL("application/" | 136 FILE_PATH_LITERAL("application/" |
| 124 "x-blink-deprecated-test-plugin#" | 137 "x-blink-deprecated-test-plugin#" |
| 125 "blinkdeprecatedtestplugin"))); | 138 "blinkdeprecatedtestplugin"))); |
| 126 return RegisterPlugins(command_line, plugins); | 139 return RegisterPlugins(command_line, plugins); |
| 127 } | 140 } |
| 128 | 141 |
| 129 } // namespace ppapi | 142 } // namespace ppapi |
| OLD | NEW |