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) { |
| 94 // Power Saver plugin requires Pepper testing API. |
| 95 command_line->AppendSwitch(switches::kEnablePepperTesting); |
| 96 |
| 97 // The Power Saver plugin ignores the data attribute and just draws a |
| 98 // checkerboard pattern - while providing some Plugin Power Saver diagnostics. |
| 99 // |
| 100 // It was originally designed just for Plugin Power Saver tests, but is |
| 101 // useful for testing as a fake Flash plugin in a variety of tests. |
92 base::FilePath::StringType library_name = | 102 base::FilePath::StringType library_name = |
93 base::FilePath::FromUTF8Unsafe(ppapi::kPowerSaverTestPluginName).value(); | 103 base::FilePath::FromUTF8Unsafe(ppapi::kPowerSaverTestPluginName).value(); |
94 return RegisterPluginWithDefaultMimeType(command_line, library_name, | 104 std::vector<PluginInfo> plugins; |
95 FILE_PATH_LITERAL("")); | 105 // Register a fake Flash with 100.0 version (to avoid outdated checks). |
| 106 base::FilePath::StringType fake_flash_parameter = |
| 107 base::FilePath::FromUTF8Unsafe( |
| 108 std::string("#") + content::kFlashPluginName + "#Description#100.0") |
| 109 .value(); |
| 110 plugins.push_back( |
| 111 PluginInfo(library_name, fake_flash_parameter, |
| 112 FILE_PATH_LITERAL("application/x-shockwave-flash"))); |
| 113 return RegisterPlugins(command_line, plugins); |
96 } | 114 } |
97 | 115 |
98 bool RegisterBlinkTestPlugin(base::CommandLine* command_line) { | 116 bool RegisterBlinkTestPlugin(base::CommandLine* command_line) { |
99 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
100 static const CharType kPluginLibrary[] = L"blink_test_plugin.dll"; | 118 static const CharType kPluginLibrary[] = L"blink_test_plugin.dll"; |
101 static const CharType kDeprecatedPluginLibrary[] = | 119 static const CharType kDeprecatedPluginLibrary[] = |
102 L"blink_deprecated_test_plugin.dll"; | 120 L"blink_deprecated_test_plugin.dll"; |
103 #elif defined(OS_MACOSX) | 121 #elif defined(OS_MACOSX) |
104 static const CharType kPluginLibrary[] = "blink_test_plugin.plugin"; | 122 static const CharType kPluginLibrary[] = "blink_test_plugin.plugin"; |
105 static const CharType kDeprecatedPluginLibrary[] = | 123 static const CharType kDeprecatedPluginLibrary[] = |
(...skipping 14 matching lines...) Expand all Loading... |
120 FILE_PATH_LITERAL("application/x-blink-test-plugin#blinktestplugin"))); | 138 FILE_PATH_LITERAL("application/x-blink-test-plugin#blinktestplugin"))); |
121 plugins.push_back( | 139 plugins.push_back( |
122 PluginInfo(kDeprecatedPluginLibrary, kDeprecatedExtraParameters, | 140 PluginInfo(kDeprecatedPluginLibrary, kDeprecatedExtraParameters, |
123 FILE_PATH_LITERAL("application/" | 141 FILE_PATH_LITERAL("application/" |
124 "x-blink-deprecated-test-plugin#" | 142 "x-blink-deprecated-test-plugin#" |
125 "blinkdeprecatedtestplugin"))); | 143 "blinkdeprecatedtestplugin"))); |
126 return RegisterPlugins(command_line, plugins); | 144 return RegisterPlugins(command_line, plugins); |
127 } | 145 } |
128 | 146 |
129 } // namespace ppapi | 147 } // namespace ppapi |
OLD | NEW |