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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 343 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
336 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 344 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
337 } | 345 } |
338 | 346 |
339 void OutOfProcessPPAPIPrivateTest::SetUpCommandLine(CommandLine* command_line) { | 347 void OutOfProcessPPAPIPrivateTest::SetUpCommandLine(CommandLine* command_line) { |
340 OutOfProcessPPAPITest::SetUpCommandLine(command_line); | 348 OutOfProcessPPAPITest::SetUpCommandLine(command_line); |
341 AddPrivateSwitches(command_line); | 349 AddPrivateSwitches(command_line); |
342 } | 350 } |
343 | 351 |
344 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { | 352 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { |
| 353 RETURN_IF_NO_NACL(); |
345 PPAPITestBase::SetUpCommandLine(command_line); | 354 PPAPITestBase::SetUpCommandLine(command_line); |
346 | 355 |
347 base::FilePath plugin_lib; | 356 base::FilePath plugin_lib; |
348 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 357 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
349 EXPECT_TRUE(base::PathExists(plugin_lib)); | 358 EXPECT_TRUE(base::PathExists(plugin_lib)); |
350 | 359 |
351 // Enable running (non-portable) NaCl outside of the Chrome web store. | 360 // Enable running (non-portable) NaCl outside of the Chrome web store. |
352 command_line->AppendSwitch(switches::kEnableNaCl); | 361 command_line->AppendSwitch(switches::kEnableNaCl); |
353 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); | 362 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); |
354 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 363 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
355 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 364 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
356 } | 365 } |
357 | 366 |
| 367 void PPAPINaClTest::RunTest(const std::string& test_case) { |
| 368 RETURN_IF_NO_NACL(); |
| 369 PPAPITestBase::RunTest(test_case); |
| 370 } |
| 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) { |
| 400 RETURN_IF_NO_NACL(); |
| 401 PPAPITestBase::RunTestViaHTTPIfAudioOutputAvailable(test_case); |
| 402 } |
| 403 |
358 // Append the correct mode and testcase string | 404 // Append the correct mode and testcase string |
359 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, | 405 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, |
360 const std::string& test_case) { | 406 const std::string& test_case) { |
361 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 407 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
362 test_case.c_str()); | 408 test_case.c_str()); |
363 } | 409 } |
364 | 410 |
365 void PPAPIPrivateNaClNewlibTest::SetUpCommandLine(CommandLine* command_line) { | 411 void PPAPIPrivateNaClNewlibTest::SetUpCommandLine(CommandLine* command_line) { |
366 PPAPINaClNewlibTest::SetUpCommandLine(command_line); | 412 PPAPINaClNewlibTest::SetUpCommandLine(command_line); |
367 AddPrivateSwitches(command_line); | 413 AddPrivateSwitches(command_line); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 const std::string& base, | 454 const std::string& base, |
409 const std::string& test_case) { | 455 const std::string& test_case) { |
410 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 456 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
411 test_case.c_str()); | 457 test_case.c_str()); |
412 } | 458 } |
413 | 459 |
414 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 460 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
415 // 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 |
416 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 462 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
417 } | 463 } |
OLD | NEW |