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/ui/ppapi_uitest.h" | 5 #include "chrome/test/ui/ppapi_uitest.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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 OutOfProcessPPAPITest::OutOfProcessPPAPITest() { | 325 OutOfProcessPPAPITest::OutOfProcessPPAPITest() { |
| 326 } | 326 } |
| 327 | 327 |
| 328 void OutOfProcessPPAPITest::SetUpCommandLine(CommandLine* command_line) { | 328 void OutOfProcessPPAPITest::SetUpCommandLine(CommandLine* command_line) { |
| 329 PPAPITest::SetUpCommandLine(command_line); | 329 PPAPITest::SetUpCommandLine(command_line); |
| 330 | 330 |
| 331 // Run PPAPI out-of-process to exercise proxy implementations. | 331 // Run PPAPI out-of-process to exercise proxy implementations. |
| 332 command_line->AppendSwitch(switches::kPpapiOutOfProcess); | 332 command_line->AppendSwitch(switches::kPpapiOutOfProcess); |
| 333 } | 333 } |
| 334 | 334 |
| 335 PPAPINaClTest::PPAPINaClTest() { | 335 PPAPINaClNewlibTest::PPAPINaClNewlibTest() { |
| 336 } | 336 } |
| 337 | 337 |
| 338 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { | 338 void PPAPINaClNewlibTest::SetUpCommandLine(CommandLine* command_line) { |
| 339 PPAPITestBase::SetUpCommandLine(command_line); | 339 PPAPITestBase::SetUpCommandLine(command_line); |
| 340 | 340 |
| 341 FilePath plugin_lib; | 341 FilePath plugin_lib; |
| 342 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 342 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 343 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 343 EXPECT_TRUE(file_util::PathExists(plugin_lib)); |
| 344 | 344 |
| 345 // Enable running NaCl outside of the store. | 345 // Enable running NaCl outside of the store. |
| 346 command_line->AppendSwitch(switches::kEnableNaCl); | 346 command_line->AppendSwitch(switches::kEnableNaCl); |
| 347 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); | 347 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); |
| 348 } | 348 } |
| 349 | 349 |
| 350 // Append the correct mode and testcase string | 350 // Append the correct mode and testcase string |
| 351 std::string PPAPINaClTest::BuildQuery(const std::string& base, | 351 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, |
| 352 const std::string& test_case) { | 352 const std::string& test_case) { |
| 353 return StringPrintf("%smode=nacl&testcase=%s", base.c_str(), | 353 return StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 354 test_case.c_str()); | 354 test_case.c_str()); |
| 355 } | 355 } |
| 356 | 356 |
| 357 PPAPINaClGLibcTest::PPAPINaClGLibcTest() { | |
| 358 } | |
| 359 | |
| 360 void PPAPINaClGLibcTest::SetUpCommandLine(CommandLine* command_line) { | |
| 361 PPAPITestBase::SetUpCommandLine(command_line); | |
| 362 | |
| 363 FilePath plugin_lib; | |
| 364 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | |
| 365 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | |
| 366 | |
| 367 // Enable running NaCl outside of the store. | |
| 368 command_line->AppendSwitch(switches::kEnableNaCl); | |
| 369 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); | |
| 370 } | |
|
dmichael (off chromium)
2012/05/22 00:04:43
Would it make sense to keep PPAPINaClTest with Set
Brad Chen
2012/05/22 18:35:00
Done.
| |
| 371 | |
| 372 // Append the correct mode and testcase string | |
| 373 std::string PPAPINaClGLibcTest::BuildQuery(const std::string& base, | |
| 374 const std::string& test_case) { | |
| 375 return StringPrintf("%smode=nacl_glibc&testcase=%s", base.c_str(), | |
| 376 test_case.c_str()); | |
| 377 } | |
| 378 | |
| 357 PPAPINaClTestDisallowedSockets::PPAPINaClTestDisallowedSockets() { | 379 PPAPINaClTestDisallowedSockets::PPAPINaClTestDisallowedSockets() { |
| 358 } | 380 } |
| 359 | 381 |
| 360 void PPAPINaClTestDisallowedSockets::SetUpCommandLine( | 382 void PPAPINaClTestDisallowedSockets::SetUpCommandLine( |
| 361 CommandLine* command_line) { | 383 CommandLine* command_line) { |
| 362 PPAPITestBase::SetUpCommandLine(command_line); | 384 PPAPITestBase::SetUpCommandLine(command_line); |
| 363 | 385 |
| 364 FilePath plugin_lib; | 386 FilePath plugin_lib; |
| 365 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 387 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 366 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 388 EXPECT_TRUE(file_util::PathExists(plugin_lib)); |
| 367 | 389 |
| 368 // Enable running NaCl outside of the store. | 390 // Enable running NaCl outside of the store. |
| 369 command_line->AppendSwitch(switches::kEnableNaCl); | 391 command_line->AppendSwitch(switches::kEnableNaCl); |
| 370 } | 392 } |
| 371 | 393 |
| 372 // Append the correct mode and testcase string | 394 // Append the correct mode and testcase string |
| 373 std::string PPAPINaClTestDisallowedSockets::BuildQuery( | 395 std::string PPAPINaClTestDisallowedSockets::BuildQuery( |
| 374 const std::string& base, | 396 const std::string& base, |
| 375 const std::string& test_case) { | 397 const std::string& test_case) { |
| 376 return StringPrintf("%smode=nacl&testcase=%s", base.c_str(), | 398 return StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 377 test_case.c_str()); | 399 test_case.c_str()); |
| 378 } | 400 } |
| 379 | 401 |
| 380 // This macro finesses macro expansion to do what we want. | 402 // This macro finesses macro expansion to do what we want. |
| 381 #define STRIP_PREFIXES(test_name) StripPrefixes(#test_name) | 403 #define STRIP_PREFIXES(test_name) StripPrefixes(#test_name) |
| 382 | 404 |
| 383 // Use these macros to run the tests for a specific interface. | 405 // Use these macros to run the tests for a specific interface. |
| 384 // Most interfaces should be tested with both macros. | 406 // Most interfaces should be tested with both macros. |
| 385 #define TEST_PPAPI_IN_PROCESS(test_name) \ | 407 #define TEST_PPAPI_IN_PROCESS(test_name) \ |
| 386 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \ | 408 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 | 455 |
| 434 #if defined(DISABLE_NACL) | 456 #if defined(DISABLE_NACL) |
| 435 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) | 457 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) |
| 436 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) | 458 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) |
| 437 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) | 459 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) |
| 438 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) | 460 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) |
| 439 #else | 461 #else |
| 440 | 462 |
| 441 // NaCl based PPAPI tests | 463 // NaCl based PPAPI tests |
| 442 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) \ | 464 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) \ |
| 443 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 465 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 466 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ | |
| 467 } \ | |
| 468 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ | |
| 444 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ | 469 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ |
| 445 } | 470 } |
| 446 | 471 |
| 447 // NaCl based PPAPI tests with disallowed socket API | 472 // NaCl based PPAPI tests with disallowed socket API |
| 448 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) \ | 473 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) \ |
| 449 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \ | 474 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \ |
| 450 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ | 475 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ |
| 451 } | 476 } |
| 452 | 477 |
| 453 // NaCl based PPAPI tests with SSL server | 478 // NaCl based PPAPI tests with SSL server |
| 454 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \ | 479 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \ |
| 455 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 480 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 481 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ | |
| 482 } \ | |
| 483 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ | |
| 456 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ | 484 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ |
| 457 } | 485 } |
| 458 | 486 |
| 459 // NaCl based PPAPI tests with WebSocket server | 487 // NaCl based PPAPI tests with WebSocket server |
| 460 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) \ | 488 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) \ |
| 461 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 489 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 490 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ | |
| 491 } \ | |
| 492 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ | |
| 462 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ | 493 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ |
| 463 } | 494 } |
| 464 | 495 |
| 465 // NaCl based PPAPI tests requiring an Audio device. | 496 // NaCl based PPAPI tests requiring an Audio device. |
| 466 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) \ | 497 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) \ |
| 467 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 498 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 499 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ | |
| 500 } \ | |
| 501 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ | |
| 468 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ | 502 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ |
| 469 } | 503 } |
| 470 #endif | 504 #endif |
| 471 | 505 |
| 472 | 506 |
| 473 // | 507 // |
| 474 // Interface tests. | 508 // Interface tests. |
| 475 // | 509 // |
| 476 | 510 |
| 477 // Disable tests under ASAN. http://crbug.com/104832. | 511 // Disable tests under ASAN. http://crbug.com/104832. |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1060 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_Basics) | 1094 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_Basics) |
| 1061 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_RunWithoutQuit) | 1095 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_RunWithoutQuit) |
| 1062 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_Basics) | 1096 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_Basics) |
| 1063 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) | 1097 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) |
| 1064 | 1098 |
| 1065 TEST_PPAPI_IN_PROCESS(MouseCursor) | 1099 TEST_PPAPI_IN_PROCESS(MouseCursor) |
| 1066 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) | 1100 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) |
| 1067 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) | 1101 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) |
| 1068 | 1102 |
| 1069 #endif // ADDRESS_SANITIZER | 1103 #endif // ADDRESS_SANITIZER |
| OLD | NEW |