Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/file_util.h" | 8 #include "base/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" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 PPAPITest::SetUpCommandLine(command_line); | 339 PPAPITest::SetUpCommandLine(command_line); |
| 340 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 340 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 341 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 341 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void OutOfProcessPPAPIPrivateTest::SetUpCommandLine(CommandLine* command_line) { | 344 void OutOfProcessPPAPIPrivateTest::SetUpCommandLine(CommandLine* command_line) { |
| 345 OutOfProcessPPAPITest::SetUpCommandLine(command_line); | 345 OutOfProcessPPAPITest::SetUpCommandLine(command_line); |
| 346 AddPrivateSwitches(command_line); | 346 AddPrivateSwitches(command_line); |
| 347 } | 347 } |
| 348 | 348 |
| 349 #if defined(DISABLE_NACL) | |
|
raymes
2014/02/18 23:20:08
Consider putting this right at the top of the file
Alexander Potapenko
2014/02/19 13:47:02
Done.
| |
| 350 #define RETURN_IF_NO_NACL() do { \ | |
| 351 LOG(WARNING) << "This test always passes with disable_nacl=1."; \ | |
| 352 return; } while (0) | |
| 353 #else | |
| 354 #define RETURN_IF_NO_NACL() do { } while (0) | |
| 355 #endif | |
| 356 | |
| 349 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { | 357 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { |
| 350 PPAPITestBase::SetUpCommandLine(command_line); | 358 PPAPITestBase::SetUpCommandLine(command_line); |
| 359 RETURN_IF_NO_NACL(); | |
|
raymes
2014/02/18 23:20:08
Should this just go right at the top of the functi
Alexander Potapenko
2014/02/19 13:47:02
Done.
| |
| 351 | 360 |
| 352 base::FilePath plugin_lib; | 361 base::FilePath plugin_lib; |
| 353 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 362 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 354 EXPECT_TRUE(base::PathExists(plugin_lib)); | 363 EXPECT_TRUE(base::PathExists(plugin_lib)); |
| 355 | 364 |
| 356 // Enable running (non-portable) NaCl outside of the Chrome web store. | 365 // Enable running (non-portable) NaCl outside of the Chrome web store. |
| 357 command_line->AppendSwitch(switches::kEnableNaCl); | 366 command_line->AppendSwitch(switches::kEnableNaCl); |
| 358 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); | 367 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); |
| 359 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 368 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 360 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 369 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
| 361 } | 370 } |
| 362 | 371 |
| 372 void PPAPINaClTest::RunTestAndReload(const std::string& test_case) { | |
| 373 RETURN_IF_NO_NACL(); | |
| 374 PPAPITestBase::RunTestAndReload(test_case); | |
| 375 } | |
| 376 | |
| 377 void PPAPINaClTest::RunTestViaHTTP(const std::string& test_case) { | |
| 378 RETURN_IF_NO_NACL(); | |
| 379 PPAPITestBase::RunTestViaHTTP(test_case); | |
| 380 } | |
| 381 | |
| 382 void PPAPINaClTest::RunTestWithSSLServer(const std::string& test_case) { | |
| 383 RETURN_IF_NO_NACL(); | |
| 384 PPAPITestBase::RunTestWithSSLServer(test_case); | |
| 385 } | |
| 386 | |
| 387 void PPAPINaClTest::RunTestWithWebSocketServer(const std::string& test_case) { | |
| 388 RETURN_IF_NO_NACL(); | |
| 389 PPAPITestBase::RunTestWithWebSocketServer(test_case); | |
| 390 } | |
| 391 | |
| 392 void PPAPINaClTest::RunTestIfAudioOutputAvailable( | |
| 393 const std::string& test_case) { | |
| 394 RETURN_IF_NO_NACL(); | |
| 395 PPAPITestBase::RunTestIfAudioOutputAvailable(test_case); | |
| 396 } | |
| 397 | |
| 398 void PPAPINaClTest::RunTestViaHTTPIfAudioOutputAvailable( | |
| 399 const std::string& test_case) { | |
|
raymes
2014/02/18 23:20:08
indentation is slightly off - 2 spaces too many I
Alexander Potapenko
2014/02/19 13:47:02
Done.
| |
| 400 RETURN_IF_NO_NACL(); | |
| 401 PPAPITestBase::RunTestViaHTTPIfAudioOutputAvailable(test_case); | |
| 402 } | |
| 403 | |
| 363 // Append the correct mode and testcase string | 404 // Append the correct mode and testcase string |
| 364 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, | 405 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, |
| 365 const std::string& test_case) { | 406 const std::string& test_case) { |
| 366 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 407 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 367 test_case.c_str()); | 408 test_case.c_str()); |
| 368 } | 409 } |
| 369 | 410 |
| 370 void PPAPIPrivateNaClNewlibTest::SetUpCommandLine(CommandLine* command_line) { | 411 void PPAPIPrivateNaClNewlibTest::SetUpCommandLine(CommandLine* command_line) { |
| 371 PPAPINaClNewlibTest::SetUpCommandLine(command_line); | 412 PPAPINaClNewlibTest::SetUpCommandLine(command_line); |
| 372 AddPrivateSwitches(command_line); | 413 AddPrivateSwitches(command_line); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 const std::string& base, | 454 const std::string& base, |
| 414 const std::string& test_case) { | 455 const std::string& test_case) { |
| 415 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 456 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 416 test_case.c_str()); | 457 test_case.c_str()); |
| 417 } | 458 } |
| 418 | 459 |
| 419 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 460 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
| 420 // The default content setting for the PPAPI broker is ASK. We purposefully | 461 // The default content setting for the PPAPI broker is ASK. We purposefully |
| 421 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 462 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
| 422 } | 463 } |
| OLD | NEW |