Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/public/test/ppapi_test_utils.h" | |
| 6 | |
| 7 #include "base/command_line.h" | |
| 8 #include "base/files/file_util.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/path_service.h" | |
| 11 #include "content/public/common/content_switches.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 | |
| 14 namespace ppapi { | |
| 15 | |
| 16 std::string StripTestPrefixes(const std::string& test_name) { | |
| 17 const char* const kTestPrefixes[] = { | |
| 18 "FAILS_", "FLAKY_", "DISABLED_", "SLOW_"}; | |
|
Paweł Hajdan Jr.
2015/04/16 21:36:18
Why is this needed? Only DISABLED_ is a valid pref
tommycli
2015/04/16 22:18:51
Done. In the latest patch, these lines are untouch
tommycli
2015/04/16 23:35:42
This is the same as the file I moved it from.
Paweł Hajdan Jr.
2015/04/17 01:38:01
Even if it's just a move, I'd like to keep content
tommycli
2015/04/17 20:02:14
Done.
| |
| 19 for (size_t i = 0; i < arraysize(kTestPrefixes); ++i) | |
| 20 if (test_name.find(kTestPrefixes[i]) == 0) | |
| 21 return test_name.substr(strlen(kTestPrefixes[i])); | |
| 22 return test_name; | |
| 23 } | |
| 24 | |
| 25 void RegisterTestPlugin(base::CommandLine* command_line) { | |
| 26 RegisterTestPluginWithExtraParameters(command_line, FILE_PATH_LITERAL("")); | |
| 27 } | |
| 28 | |
| 29 void RegisterTestPluginWithExtraParameters( | |
|
Paweł Hajdan Jr.
2015/04/16 21:36:18
Shouldn't this return bool so that callers can bai
tommycli
2015/04/16 22:18:51
Done.
| |
| 30 base::CommandLine* command_line, | |
| 31 const base::FilePath::StringType& extra_registration_parameters) { | |
| 32 base::FilePath plugin_dir; | |
| 33 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); | |
| 34 | |
| 35 #if defined(OS_WIN) | |
| 36 base::FilePath plugin_path = plugin_dir.Append(L"ppapi_tests.dll"); | |
| 37 #elif defined(OS_MACOSX) | |
| 38 base::FilePath plugin_path = plugin_dir.Append("ppapi_tests.plugin"); | |
| 39 #elif defined(OS_POSIX) | |
| 40 base::FilePath plugin_path = plugin_dir.Append("libppapi_tests.so"); | |
| 41 #endif | |
| 42 | |
| 43 // Append the switch to register the pepper plugin. | |
| 44 EXPECT_TRUE(base::PathExists(plugin_path)); | |
| 45 base::FilePath::StringType pepper_plugin = plugin_path.value(); | |
| 46 pepper_plugin.append(extra_registration_parameters); | |
| 47 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); | |
| 48 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | |
| 49 pepper_plugin); | |
| 50 } | |
| 51 | |
| 52 } // namespace ppapi | |
| OLD | NEW |