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 13 matching lines...) Expand all Loading... |
24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
27 #include "net/base/test_data_directory.h" | 27 #include "net/base/test_data_directory.h" |
28 #include "ppapi/shared_impl/ppapi_switches.h" | 28 #include "ppapi/shared_impl/ppapi_switches.h" |
29 #include "ui/gl/gl_switches.h" | 29 #include "ui/gl/gl_switches.h" |
30 | 30 |
31 using content::DomOperationNotificationDetails; | 31 using content::DomOperationNotificationDetails; |
32 using content::RenderViewHost; | 32 using content::RenderViewHost; |
33 | 33 |
| 34 #if defined(DISABLE_NACL) |
| 35 #define RETURN_IF_NO_NACL() do { \ |
| 36 LOG(WARNING) << "This test always passes with disable_nacl=1."; \ |
| 37 return; } while (0) |
| 38 #else |
| 39 #define RETURN_IF_NO_NACL() do { } while (0) |
| 40 #endif |
| 41 |
34 namespace { | 42 namespace { |
35 | 43 |
36 // Platform-specific filename relative to the chrome executable. | 44 // Platform-specific filename relative to the chrome executable. |
37 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
38 const wchar_t library_name[] = L"ppapi_tests.dll"; | 46 const wchar_t library_name[] = L"ppapi_tests.dll"; |
39 #elif defined(OS_MACOSX) | 47 #elif defined(OS_MACOSX) |
40 const char library_name[] = "ppapi_tests.plugin"; | 48 const char library_name[] = "ppapi_tests.plugin"; |
41 #elif defined(OS_POSIX) | 49 #elif defined(OS_POSIX) |
42 const char library_name[] = "libppapi_tests.so"; | 50 const char library_name[] = "libppapi_tests.so"; |
43 #endif | 51 #endif |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 348 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
341 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 349 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
342 } | 350 } |
343 | 351 |
344 void OutOfProcessPPAPIPrivateTest::SetUpCommandLine(CommandLine* command_line) { | 352 void OutOfProcessPPAPIPrivateTest::SetUpCommandLine(CommandLine* command_line) { |
345 OutOfProcessPPAPITest::SetUpCommandLine(command_line); | 353 OutOfProcessPPAPITest::SetUpCommandLine(command_line); |
346 AddPrivateSwitches(command_line); | 354 AddPrivateSwitches(command_line); |
347 } | 355 } |
348 | 356 |
349 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { | 357 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { |
| 358 RETURN_IF_NO_NACL(); |
350 PPAPITestBase::SetUpCommandLine(command_line); | 359 PPAPITestBase::SetUpCommandLine(command_line); |
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::RunTest(const std::string& test_case) { |
| 373 RETURN_IF_NO_NACL(); |
| 374 PPAPITestBase::RunTest(test_case); |
| 375 } |
| 376 |
| 377 void PPAPINaClTest::RunTestAndReload(const std::string& test_case) { |
| 378 RETURN_IF_NO_NACL(); |
| 379 PPAPITestBase::RunTestAndReload(test_case); |
| 380 } |
| 381 |
| 382 void PPAPINaClTest::RunTestViaHTTP(const std::string& test_case) { |
| 383 RETURN_IF_NO_NACL(); |
| 384 PPAPITestBase::RunTestViaHTTP(test_case); |
| 385 } |
| 386 |
| 387 void PPAPINaClTest::RunTestWithSSLServer(const std::string& test_case) { |
| 388 RETURN_IF_NO_NACL(); |
| 389 PPAPITestBase::RunTestWithSSLServer(test_case); |
| 390 } |
| 391 |
| 392 void PPAPINaClTest::RunTestWithWebSocketServer(const std::string& test_case) { |
| 393 RETURN_IF_NO_NACL(); |
| 394 PPAPITestBase::RunTestWithWebSocketServer(test_case); |
| 395 } |
| 396 |
| 397 void PPAPINaClTest::RunTestIfAudioOutputAvailable( |
| 398 const std::string& test_case) { |
| 399 RETURN_IF_NO_NACL(); |
| 400 PPAPITestBase::RunTestIfAudioOutputAvailable(test_case); |
| 401 } |
| 402 |
| 403 void PPAPINaClTest::RunTestViaHTTPIfAudioOutputAvailable( |
| 404 const std::string& test_case) { |
| 405 RETURN_IF_NO_NACL(); |
| 406 PPAPITestBase::RunTestViaHTTPIfAudioOutputAvailable(test_case); |
| 407 } |
| 408 |
363 // Append the correct mode and testcase string | 409 // Append the correct mode and testcase string |
364 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, | 410 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, |
365 const std::string& test_case) { | 411 const std::string& test_case) { |
366 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 412 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
367 test_case.c_str()); | 413 test_case.c_str()); |
368 } | 414 } |
369 | 415 |
370 void PPAPIPrivateNaClNewlibTest::SetUpCommandLine(CommandLine* command_line) { | 416 void PPAPIPrivateNaClNewlibTest::SetUpCommandLine(CommandLine* command_line) { |
371 PPAPINaClNewlibTest::SetUpCommandLine(command_line); | 417 PPAPINaClNewlibTest::SetUpCommandLine(command_line); |
372 AddPrivateSwitches(command_line); | 418 AddPrivateSwitches(command_line); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 const std::string& base, | 459 const std::string& base, |
414 const std::string& test_case) { | 460 const std::string& test_case) { |
415 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 461 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
416 test_case.c_str()); | 462 test_case.c_str()); |
417 } | 463 } |
418 | 464 |
419 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 465 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
420 // The default content setting for the PPAPI broker is ASK. We purposefully | 466 // The default content setting for the PPAPI broker is ASK. We purposefully |
421 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 467 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
422 } | 468 } |
OLD | NEW |