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 PPAPINaClTest::PPAPINaClTest() { |
|
dmichael (off chromium)
2012/05/22 19:31:01
optional: You can omit these empty default constru
Brad Chen
2012/05/22 20:58:17
Done.
| |
| 336 } | 336 } |
| 337 | 337 |
| 338 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { | 338 void PPAPINaClTest::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 PPAPINaClNewlibTest::PPAPINaClNewlibTest() { | |
| 351 } | |
| 352 | |
| 350 // Append the correct mode and testcase string | 353 // Append the correct mode and testcase string |
| 351 std::string PPAPINaClTest::BuildQuery(const std::string& base, | 354 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, |
| 352 const std::string& test_case) { | 355 const std::string& test_case) { |
| 353 return StringPrintf("%smode=nacl&testcase=%s", base.c_str(), | 356 return StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 354 test_case.c_str()); | 357 test_case.c_str()); |
| 355 } | 358 } |
| 356 | 359 |
| 360 PPAPINaClGLibcTest::PPAPINaClGLibcTest() { | |
| 361 } | |
| 362 | |
| 363 // Append the correct mode and testcase string | |
| 364 std::string PPAPINaClGLibcTest::BuildQuery(const std::string& base, | |
| 365 const std::string& test_case) { | |
| 366 return StringPrintf("%smode=nacl_glibc&testcase=%s", base.c_str(), | |
| 367 test_case.c_str()); | |
| 368 } | |
| 369 | |
| 357 PPAPINaClTestDisallowedSockets::PPAPINaClTestDisallowedSockets() { | 370 PPAPINaClTestDisallowedSockets::PPAPINaClTestDisallowedSockets() { |
| 358 } | 371 } |
| 359 | 372 |
| 360 void PPAPINaClTestDisallowedSockets::SetUpCommandLine( | 373 void PPAPINaClTestDisallowedSockets::SetUpCommandLine( |
| 361 CommandLine* command_line) { | 374 CommandLine* command_line) { |
| 362 PPAPITestBase::SetUpCommandLine(command_line); | 375 PPAPITestBase::SetUpCommandLine(command_line); |
| 363 | 376 |
| 364 FilePath plugin_lib; | 377 FilePath plugin_lib; |
| 365 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 378 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 366 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 379 EXPECT_TRUE(file_util::PathExists(plugin_lib)); |
| 367 | 380 |
| 368 // Enable running NaCl outside of the store. | 381 // Enable running NaCl outside of the store. |
| 369 command_line->AppendSwitch(switches::kEnableNaCl); | 382 command_line->AppendSwitch(switches::kEnableNaCl); |
| 370 } | 383 } |
| 371 | 384 |
| 372 // Append the correct mode and testcase string | 385 // Append the correct mode and testcase string |
| 373 std::string PPAPINaClTestDisallowedSockets::BuildQuery( | 386 std::string PPAPINaClTestDisallowedSockets::BuildQuery( |
| 374 const std::string& base, | 387 const std::string& base, |
| 375 const std::string& test_case) { | 388 const std::string& test_case) { |
| 376 return StringPrintf("%smode=nacl&testcase=%s", base.c_str(), | 389 return StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 377 test_case.c_str()); | 390 test_case.c_str()); |
| 378 } | 391 } |
| 379 | 392 |
| 380 // This macro finesses macro expansion to do what we want. | 393 // This macro finesses macro expansion to do what we want. |
| 381 #define STRIP_PREFIXES(test_name) StripPrefixes(#test_name) | 394 #define STRIP_PREFIXES(test_name) StripPrefixes(#test_name) |
| 382 | 395 |
| 383 // Use these macros to run the tests for a specific interface. | 396 // Use these macros to run the tests for a specific interface. |
| 384 // Most interfaces should be tested with both macros. | 397 // Most interfaces should be tested with both macros. |
| 385 #define TEST_PPAPI_IN_PROCESS(test_name) \ | 398 #define TEST_PPAPI_IN_PROCESS(test_name) \ |
| 386 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \ | 399 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 #if defined(DISABLE_NACL) | 447 #if defined(DISABLE_NACL) |
| 435 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) | 448 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) |
| 436 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) | 449 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) |
| 437 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) | 450 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) |
| 438 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) | 451 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) |
| 439 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) | 452 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) |
| 440 #else | 453 #else |
| 441 | 454 |
| 442 // NaCl based PPAPI tests | 455 // NaCl based PPAPI tests |
| 443 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) \ | 456 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) \ |
| 444 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 457 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 458 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ | |
| 459 } \ | |
| 460 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ | |
| 445 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ | 461 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ |
| 446 } | 462 } |
| 447 | 463 |
| 448 // NaCl based PPAPI tests with disallowed socket API | 464 // NaCl based PPAPI tests with disallowed socket API |
| 449 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) \ | 465 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) \ |
| 450 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \ | 466 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \ |
| 451 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ | 467 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ |
| 452 } | 468 } |
| 453 | 469 |
| 454 // NaCl based PPAPI tests with SSL server | 470 // NaCl based PPAPI tests with SSL server |
| 455 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \ | 471 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \ |
| 456 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 472 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 473 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ | |
| 474 } \ | |
| 475 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ | |
| 457 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ | 476 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ |
| 458 } | 477 } |
| 459 | 478 |
| 460 // NaCl based PPAPI tests with WebSocket server | 479 // NaCl based PPAPI tests with WebSocket server |
| 461 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) \ | 480 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) \ |
| 462 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 481 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 482 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ | |
| 483 } \ | |
| 484 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ | |
| 463 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ | 485 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ |
| 464 } | 486 } |
| 465 | 487 |
| 466 // NaCl based PPAPI tests requiring an Audio device. | 488 // NaCl based PPAPI tests requiring an Audio device. |
| 467 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) \ | 489 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) \ |
| 468 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 490 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 491 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ | |
| 492 } \ | |
| 493 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ | |
| 469 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ | 494 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ |
| 470 } | 495 } |
| 471 #endif | 496 #endif |
| 472 | 497 |
| 473 | 498 |
| 474 // | 499 // |
| 475 // Interface tests. | 500 // Interface tests. |
| 476 // | 501 // |
| 477 | 502 |
| 478 // Disable tests under ASAN. http://crbug.com/104832. | 503 // Disable tests under ASAN. http://crbug.com/104832. |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1067 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_Basics) | 1092 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_Basics) |
| 1068 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_RunWithoutQuit) | 1093 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_RunWithoutQuit) |
| 1069 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_Basics) | 1094 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_Basics) |
| 1070 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) | 1095 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) |
| 1071 | 1096 |
| 1072 TEST_PPAPI_IN_PROCESS(MouseCursor) | 1097 TEST_PPAPI_IN_PROCESS(MouseCursor) |
| 1073 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) | 1098 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) |
| 1074 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) | 1099 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) |
| 1075 | 1100 |
| 1076 #endif // ADDRESS_SANITIZER | 1101 #endif // ADDRESS_SANITIZER |
| OLD | NEW |