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

Side by Side Diff: content/test/ppapi/ppapi_test.cc

Issue 1062163004: Plugins: Move Prerender tests to PPAPI and some refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « content/test/ppapi/ppapi_browsertest.cc ('k') | ppapi/ppapi_shared.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/ppapi/ppapi_test.h" 5 #include "content/test/ppapi/ppapi_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/public/test/ppapi_test_utils.h"
15 #include "content/shell/browser/shell.h" 16 #include "content/shell/browser/shell.h"
16 #include "net/base/filename_util.h" 17 #include "net/base/filename_util.h"
17 #include "ppapi/shared_impl/ppapi_switches.h" 18 #include "ppapi/shared_impl/ppapi_switches.h"
18 #include "ppapi/shared_impl/test_harness_utils.h"
19 19
20 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
21 #include "chromeos/audio/cras_audio_handler.h" 21 #include "chromeos/audio/cras_audio_handler.h"
22 #endif 22 #endif
23 23
24 namespace content { 24 namespace content {
25 25
26 PPAPITestMessageHandler::PPAPITestMessageHandler() { 26 PPAPITestMessageHandler::PPAPITestMessageHandler() {
27 } 27 }
28 28
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 ASSERT_TRUE(observer.Run()) << handler.error_message(); 97 ASSERT_TRUE(observer.Run()) << handler.error_message();
98 EXPECT_STREQ("PASS", handler.message().c_str()); 98 EXPECT_STREQ("PASS", handler.message().c_str());
99 } 99 }
100 100
101 PPAPITest::PPAPITest() : in_process_(true) { 101 PPAPITest::PPAPITest() : in_process_(true) {
102 } 102 }
103 103
104 void PPAPITest::SetUpCommandLine(base::CommandLine* command_line) { 104 void PPAPITest::SetUpCommandLine(base::CommandLine* command_line) {
105 PPAPITestBase::SetUpCommandLine(command_line); 105 PPAPITestBase::SetUpCommandLine(command_line);
106 106 ASSERT_TRUE(ppapi::RegisterTestPlugin(command_line));
107 // Append the switch to register the pepper plugin.
108 // library name = <out dir>/<test_name>.<library_extension>
109 // MIME type = application/x-ppapi-<test_name>
110 base::FilePath plugin_dir;
111 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
112
113 base::FilePath plugin_lib = plugin_dir.Append(ppapi::GetTestLibraryName());
114 EXPECT_TRUE(base::PathExists(plugin_lib));
115 base::FilePath::StringType pepper_plugin = plugin_lib.value();
116 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests"));
117 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
118 pepper_plugin);
119 107
120 if (in_process_) 108 if (in_process_)
121 command_line->AppendSwitch(switches::kPpapiInProcess); 109 command_line->AppendSwitch(switches::kPpapiInProcess);
122 } 110 }
123 111
124 std::string PPAPITest::BuildQuery(const std::string& base, 112 std::string PPAPITest::BuildQuery(const std::string& base,
125 const std::string& test_case){ 113 const std::string& test_case){
126 return base::StringPrintf("%stestcase=%s", base.c_str(), test_case.c_str()); 114 return base::StringPrintf("%stestcase=%s", base.c_str(), test_case.c_str());
127 } 115 }
128 116
129 OutOfProcessPPAPITest::OutOfProcessPPAPITest() { 117 OutOfProcessPPAPITest::OutOfProcessPPAPITest() {
130 in_process_ = false; 118 in_process_ = false;
131 } 119 }
132 120
133 void OutOfProcessPPAPITest::SetUp() { 121 void OutOfProcessPPAPITest::SetUp() {
134 #if defined(OS_CHROMEOS) 122 #if defined(OS_CHROMEOS)
135 chromeos::CrasAudioHandler::InitializeForTesting(); 123 chromeos::CrasAudioHandler::InitializeForTesting();
136 #endif 124 #endif
137 ContentBrowserTest::SetUp(); 125 ContentBrowserTest::SetUp();
138 } 126 }
139 127
140 void OutOfProcessPPAPITest::TearDown() { 128 void OutOfProcessPPAPITest::TearDown() {
141 ContentBrowserTest::TearDown(); 129 ContentBrowserTest::TearDown();
142 #if defined(OS_CHROMEOS) 130 #if defined(OS_CHROMEOS)
143 chromeos::CrasAudioHandler::Shutdown(); 131 chromeos::CrasAudioHandler::Shutdown();
144 #endif 132 #endif
145 } 133 }
146 134
147 } // namespace content 135 } // namespace content
OLDNEW
« no previous file with comments | « content/test/ppapi/ppapi_browsertest.cc ('k') | ppapi/ppapi_shared.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698