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

Side by Side Diff: content/public/test/ppapi_test_utils.cc

Issue 1088763002: Plugin Power Saver: Add comprehensive browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0260-plugins-overhaul-prerender-tests
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
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 <string> 7 #include <string>
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "ppapi/shared_impl/ppapi_constants.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace ppapi { 16 namespace ppapi {
16 17
17 std::string StripTestPrefixes(const std::string& test_name) { 18 std::string StripTestPrefixes(const std::string& test_name) {
18 const char* const kTestPrefixes[] = { 19 const char* const kTestPrefixes[] = {
19 "FAILS_", "FLAKY_", "DISABLED_", "SLOW_"}; 20 "FAILS_", "FLAKY_", "DISABLED_", "SLOW_"};
20 for (size_t i = 0; i < arraysize(kTestPrefixes); ++i) 21 for (size_t i = 0; i < arraysize(kTestPrefixes); ++i)
21 if (test_name.find(kTestPrefixes[i]) == 0) 22 if (test_name.find(kTestPrefixes[i]) == 0)
22 return test_name.substr(strlen(kTestPrefixes[i])); 23 return test_name.substr(strlen(kTestPrefixes[i]));
23 return test_name; 24 return test_name;
24 } 25 }
25 26
26 void RegisterTestLibrary(base::CommandLine* command_line) { 27 void RegisterTestLibrary(base::CommandLine* command_line) {
27 RegisterTestLibraryWithExtraParameters(command_line, FILE_PATH_LITERAL("")); 28 RegisterTestLibraryWithExtraParameters(command_line, FILE_PATH_LITERAL(""));
28 } 29 }
29 30
30 void RegisterTestLibraryWithExtraParameters( 31 void RegisterTestLibraryWithExtraParameters(
31 base::CommandLine* command_line, 32 base::CommandLine* command_line,
32 const base::FilePath::StringType& extra_registration_parameters) { 33 const base::FilePath::StringType& extra_registration_parameters) {
33 base::FilePath plugin_dir; 34 base::FilePath plugin_dir;
34 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); 35 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
35 36
36 #if defined(OS_WIN) 37 base::FilePath plugin_path =
37 base::FilePath plugin_path = plugin_dir.Append(L"ppapi_tests.dll"); 38 plugin_dir.AppendASCII(ppapi::kPpapiTestLibraryName);
38 #elif defined(OS_MACOSX)
39 base::FilePath plugin_path = plugin_dir.Append("ppapi_tests.plugin");
40 #elif defined(OS_POSIX)
41 base::FilePath plugin_path = plugin_dir.Append("libppapi_tests.so");
42 #endif
43 39
44 // Append the switch to register the pepper plugin. 40 // Append the switch to register the pepper plugin.
45 EXPECT_TRUE(base::PathExists(plugin_path)); 41 EXPECT_TRUE(base::PathExists(plugin_path));
46 base::FilePath::StringType pepper_plugin = plugin_path.value(); 42 base::FilePath::StringType pepper_plugin = plugin_path.value();
47 pepper_plugin.append(extra_registration_parameters); 43 pepper_plugin.append(extra_registration_parameters);
48 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); 44 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests"));
49 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, 45 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
50 pepper_plugin); 46 pepper_plugin);
51 } 47 }
52 48
53 } // namespace ppapi 49 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698