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 | |
42 namespace { | 34 namespace { |
43 | 35 |
44 // Platform-specific filename relative to the chrome executable. | 36 // Platform-specific filename relative to the chrome executable. |
45 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
46 const wchar_t library_name[] = L"ppapi_tests.dll"; | 38 const wchar_t library_name[] = L"ppapi_tests.dll"; |
47 #elif defined(OS_MACOSX) | 39 #elif defined(OS_MACOSX) |
48 const char library_name[] = "ppapi_tests.plugin"; | 40 const char library_name[] = "ppapi_tests.plugin"; |
49 #elif defined(OS_POSIX) | 41 #elif defined(OS_POSIX) |
50 const char library_name[] = "libppapi_tests.so"; | 42 const char library_name[] = "libppapi_tests.so"; |
51 #endif | 43 #endif |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 342 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
351 } | 343 } |
352 | 344 |
353 void OutOfProcessPPAPIPrivateTest::SetUpCommandLine( | 345 void OutOfProcessPPAPIPrivateTest::SetUpCommandLine( |
354 base::CommandLine* command_line) { | 346 base::CommandLine* command_line) { |
355 OutOfProcessPPAPITest::SetUpCommandLine(command_line); | 347 OutOfProcessPPAPITest::SetUpCommandLine(command_line); |
356 AddPrivateSwitches(command_line); | 348 AddPrivateSwitches(command_line); |
357 } | 349 } |
358 | 350 |
359 void PPAPINaClTest::SetUpCommandLine(base::CommandLine* command_line) { | 351 void PPAPINaClTest::SetUpCommandLine(base::CommandLine* command_line) { |
360 RETURN_IF_NO_NACL(); | 352 #if !defined(DISABLE_NACL) |
361 PPAPITestBase::SetUpCommandLine(command_line); | 353 PPAPITestBase::SetUpCommandLine(command_line); |
362 | 354 |
363 // Enable running (non-portable) NaCl outside of the Chrome web store. | 355 // Enable running (non-portable) NaCl outside of the Chrome web store. |
364 command_line->AppendSwitch(switches::kEnableNaCl); | 356 command_line->AppendSwitch(switches::kEnableNaCl); |
365 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); | 357 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); |
366 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 358 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
367 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 359 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
| 360 #endif |
368 } | 361 } |
369 | 362 |
370 void PPAPINaClTest::SetUpOnMainThread() { | 363 void PPAPINaClTest::SetUpOnMainThread() { |
371 base::FilePath plugin_lib; | 364 base::FilePath plugin_lib; |
372 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 365 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
373 EXPECT_TRUE(base::PathExists(plugin_lib)); | 366 EXPECT_TRUE(base::PathExists(plugin_lib)); |
374 } | 367 } |
375 | 368 |
376 void PPAPINaClTest::RunTest(const std::string& test_case) { | 369 void PPAPINaClTest::RunTest(const std::string& test_case) { |
377 RETURN_IF_NO_NACL(); | 370 #if !defined(DISABLE_NACL) |
378 PPAPITestBase::RunTest(test_case); | 371 PPAPITestBase::RunTest(test_case); |
| 372 #endif |
379 } | 373 } |
380 | 374 |
381 void PPAPINaClTest::RunTestAndReload(const std::string& test_case) { | 375 void PPAPINaClTest::RunTestAndReload(const std::string& test_case) { |
382 RETURN_IF_NO_NACL(); | 376 #if !defined(DISABLE_NACL) |
383 PPAPITestBase::RunTestAndReload(test_case); | 377 PPAPITestBase::RunTestAndReload(test_case); |
| 378 #endif |
384 } | 379 } |
385 | 380 |
386 void PPAPINaClTest::RunTestViaHTTP(const std::string& test_case) { | 381 void PPAPINaClTest::RunTestViaHTTP(const std::string& test_case) { |
387 RETURN_IF_NO_NACL(); | 382 #if !defined(DISABLE_NACL) |
388 PPAPITestBase::RunTestViaHTTP(test_case); | 383 PPAPITestBase::RunTestViaHTTP(test_case); |
| 384 #endif |
389 } | 385 } |
390 | 386 |
391 void PPAPINaClTest::RunTestWithSSLServer(const std::string& test_case) { | 387 void PPAPINaClTest::RunTestWithSSLServer(const std::string& test_case) { |
392 RETURN_IF_NO_NACL(); | 388 #if !defined(DISABLE_NACL) |
393 PPAPITestBase::RunTestWithSSLServer(test_case); | 389 PPAPITestBase::RunTestWithSSLServer(test_case); |
| 390 #endif |
394 } | 391 } |
395 | 392 |
396 void PPAPINaClTest::RunTestWithWebSocketServer(const std::string& test_case) { | 393 void PPAPINaClTest::RunTestWithWebSocketServer(const std::string& test_case) { |
397 RETURN_IF_NO_NACL(); | 394 #if !defined(DISABLE_NACL) |
398 PPAPITestBase::RunTestWithWebSocketServer(test_case); | 395 PPAPITestBase::RunTestWithWebSocketServer(test_case); |
| 396 #endif |
399 } | 397 } |
400 | 398 |
401 void PPAPINaClTest::RunTestIfAudioOutputAvailable( | 399 void PPAPINaClTest::RunTestIfAudioOutputAvailable( |
402 const std::string& test_case) { | 400 const std::string& test_case) { |
403 RETURN_IF_NO_NACL(); | 401 #if !defined(DISABLE_NACL) |
404 PPAPITestBase::RunTestIfAudioOutputAvailable(test_case); | 402 PPAPITestBase::RunTestIfAudioOutputAvailable(test_case); |
| 403 #endif |
405 } | 404 } |
406 | 405 |
407 void PPAPINaClTest::RunTestViaHTTPIfAudioOutputAvailable( | 406 void PPAPINaClTest::RunTestViaHTTPIfAudioOutputAvailable( |
408 const std::string& test_case) { | 407 const std::string& test_case) { |
409 RETURN_IF_NO_NACL(); | 408 #if !defined(DISABLE_NACL) |
410 PPAPITestBase::RunTestViaHTTPIfAudioOutputAvailable(test_case); | 409 PPAPITestBase::RunTestViaHTTPIfAudioOutputAvailable(test_case); |
| 410 #endif |
411 } | 411 } |
412 | 412 |
413 // Append the correct mode and testcase string | 413 // Append the correct mode and testcase string |
414 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, | 414 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, |
415 const std::string& test_case) { | 415 const std::string& test_case) { |
416 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 416 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
417 test_case.c_str()); | 417 test_case.c_str()); |
418 } | 418 } |
419 | 419 |
420 void PPAPIPrivateNaClNewlibTest::SetUpCommandLine( | 420 void PPAPIPrivateNaClNewlibTest::SetUpCommandLine( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 466 } |
467 | 467 |
468 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 468 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
469 // The default content setting for the PPAPI broker is ASK. We purposefully | 469 // The default content setting for the PPAPI broker is ASK. We purposefully |
470 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 470 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
471 | 471 |
472 base::FilePath plugin_lib; | 472 base::FilePath plugin_lib; |
473 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 473 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
474 EXPECT_TRUE(base::PathExists(plugin_lib)); | 474 EXPECT_TRUE(base::PathExists(plugin_lib)); |
475 } | 475 } |
OLD | NEW |