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

Side by Side Diff: chrome/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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/test/ppapi/ppapi_test.h" 5 #include "chrome/test/ppapi/ppapi_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/infobars/infobar_service.h" 13 #include "chrome/browser/infobars/infobar_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 16 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/common/chrome_paths.h" 17 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/test/base/test_switches.h" 19 #include "chrome/test/base/test_switches.h"
20 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
21 #include "components/content_settings/core/browser/host_content_settings_map.h" 21 #include "components/content_settings/core/browser/host_content_settings_map.h"
22 #include "components/infobars/core/confirm_infobar_delegate.h" 22 #include "components/infobars/core/confirm_infobar_delegate.h"
23 #include "components/infobars/core/infobar.h" 23 #include "components/infobars/core/infobar.h"
24 #include "components/nacl/common/nacl_switches.h" 24 #include "components/nacl/common/nacl_switches.h"
25 #include "content/public/browser/dom_operation_notification_details.h" 25 #include "content/public/browser/dom_operation_notification_details.h"
26 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
28 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
29 #include "content/public/test/ppapi_test_utils.h"
29 #include "media/base/media_switches.h" 30 #include "media/base/media_switches.h"
30 #include "net/base/filename_util.h" 31 #include "net/base/filename_util.h"
31 #include "net/base/test_data_directory.h" 32 #include "net/base/test_data_directory.h"
32 #include "ppapi/shared_impl/ppapi_switches.h" 33 #include "ppapi/shared_impl/ppapi_switches.h"
33 #include "ppapi/shared_impl/test_harness_utils.h"
34 #include "ui/gl/gl_switches.h" 34 #include "ui/gl/gl_switches.h"
35 35
36 using content::DomOperationNotificationDetails; 36 using content::DomOperationNotificationDetails;
37 using content::RenderViewHost; 37 using content::RenderViewHost;
38 using content::TestMessageHandler; 38 using content::TestMessageHandler;
39 39
40 namespace { 40 namespace {
41 41
42 void AddPrivateSwitches(base::CommandLine* command_line) { 42 void AddPrivateSwitches(base::CommandLine* command_line) {
43 // For TestRequestOSFileHandle. 43 // For TestRequestOSFileHandle.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 return http_server.GetURL(query); 274 return http_server.GetURL(query);
275 } 275 }
276 276
277 PPAPITest::PPAPITest() : in_process_(true) { 277 PPAPITest::PPAPITest() : in_process_(true) {
278 } 278 }
279 279
280 void PPAPITest::SetUpCommandLine(base::CommandLine* command_line) { 280 void PPAPITest::SetUpCommandLine(base::CommandLine* command_line) {
281 PPAPITestBase::SetUpCommandLine(command_line); 281 PPAPITestBase::SetUpCommandLine(command_line);
282 282
283 base::FilePath plugin_dir;
284 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
285
286 base::FilePath plugin_lib = plugin_dir.Append(ppapi::GetTestLibraryName());
287 EXPECT_TRUE(base::PathExists(plugin_lib));
288
289 // Append the switch to register the pepper plugin.
290 // library path = <out dir>/<test_name>.<library_extension>
291 // library name = "PPAPI Tests" 283 // library name = "PPAPI Tests"
292 // version = "1.2.3" 284 // version = "1.2.3"
293 // MIME type = application/x-ppapi-<test_name> 285 base::FilePath::StringType parameters;
294 base::FilePath::StringType pepper_plugin = plugin_lib.value(); 286 parameters.append(FILE_PATH_LITERAL("#PPAPI Tests"));
295 pepper_plugin.append(FILE_PATH_LITERAL("#PPAPI Tests")); 287 parameters.append(FILE_PATH_LITERAL("#")); // No description.
296 pepper_plugin.append(FILE_PATH_LITERAL("#")); // No description. 288 parameters.append(FILE_PATH_LITERAL("#1.2.3"));
297 pepper_plugin.append(FILE_PATH_LITERAL("#1.2.3")); 289 ppapi::RegisterTestLibraryWithExtraParameters(command_line, parameters);
298 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests"));
299 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
300 pepper_plugin);
301 290
302 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); 291 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1");
303 if (in_process_) 292 if (in_process_)
304 command_line->AppendSwitch(switches::kPpapiInProcess); 293 command_line->AppendSwitch(switches::kPpapiInProcess);
305 } 294 }
306 295
307 std::string PPAPITest::BuildQuery(const std::string& base, 296 std::string PPAPITest::BuildQuery(const std::string& base,
308 const std::string& test_case){ 297 const std::string& test_case){
309 return base::StringPrintf("%stestcase=%s", base.c_str(), test_case.c_str()); 298 return base::StringPrintf("%stestcase=%s", base.c_str(), test_case.c_str());
310 } 299 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 const std::string& base, 460 const std::string& base,
472 const std::string& test_case) { 461 const std::string& test_case) {
473 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), 462 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(),
474 test_case.c_str()); 463 test_case.c_str());
475 } 464 }
476 465
477 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { 466 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() {
478 // The default content setting for the PPAPI broker is ASK. We purposefully 467 // The default content setting for the PPAPI broker is ASK. We purposefully
479 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. 468 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way.
480 } 469 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698