| 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() { | |
| 336 } | |
| 337 | |
| 338 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { | 335 void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { |
| 339 PPAPITestBase::SetUpCommandLine(command_line); | 336 PPAPITestBase::SetUpCommandLine(command_line); |
| 340 | 337 |
| 341 FilePath plugin_lib; | 338 FilePath plugin_lib; |
| 342 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 339 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 343 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 340 EXPECT_TRUE(file_util::PathExists(plugin_lib)); |
| 344 | 341 |
| 345 // Enable running NaCl outside of the store. | 342 // Enable running NaCl outside of the store. |
| 346 command_line->AppendSwitch(switches::kEnableNaCl); | 343 command_line->AppendSwitch(switches::kEnableNaCl); |
| 347 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); | 344 command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1"); |
| 348 } | 345 } |
| 349 | 346 |
| 350 // Append the correct mode and testcase string | 347 // Append the correct mode and testcase string |
| 351 std::string PPAPINaClTest::BuildQuery(const std::string& base, | 348 std::string PPAPINaClNewlibTest::BuildQuery(const std::string& base, |
| 352 const std::string& test_case) { | 349 const std::string& test_case) { |
| 353 return StringPrintf("%smode=nacl&testcase=%s", base.c_str(), | 350 return StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 354 test_case.c_str()); | 351 test_case.c_str()); |
| 355 } | 352 } |
| 356 | 353 |
| 357 PPAPINaClTestDisallowedSockets::PPAPINaClTestDisallowedSockets() { | 354 // Append the correct mode and testcase string |
| 355 std::string PPAPINaClGLibcTest::BuildQuery(const std::string& base, |
| 356 const std::string& test_case) { |
| 357 return StringPrintf("%smode=nacl_glibc&testcase=%s", base.c_str(), |
| 358 test_case.c_str()); |
| 358 } | 359 } |
| 359 | 360 |
| 360 void PPAPINaClTestDisallowedSockets::SetUpCommandLine( | 361 void PPAPINaClTestDisallowedSockets::SetUpCommandLine( |
| 361 CommandLine* command_line) { | 362 CommandLine* command_line) { |
| 362 PPAPITestBase::SetUpCommandLine(command_line); | 363 PPAPITestBase::SetUpCommandLine(command_line); |
| 363 | 364 |
| 364 FilePath plugin_lib; | 365 FilePath plugin_lib; |
| 365 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 366 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
| 366 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 367 EXPECT_TRUE(file_util::PathExists(plugin_lib)); |
| 367 | 368 |
| 368 // Enable running NaCl outside of the store. | 369 // Enable running NaCl outside of the store. |
| 369 command_line->AppendSwitch(switches::kEnableNaCl); | 370 command_line->AppendSwitch(switches::kEnableNaCl); |
| 370 } | 371 } |
| 371 | 372 |
| 372 // Append the correct mode and testcase string | 373 // Append the correct mode and testcase string |
| 373 std::string PPAPINaClTestDisallowedSockets::BuildQuery( | 374 std::string PPAPINaClTestDisallowedSockets::BuildQuery( |
| 374 const std::string& base, | 375 const std::string& base, |
| 375 const std::string& test_case) { | 376 const std::string& test_case) { |
| 376 return StringPrintf("%smode=nacl&testcase=%s", base.c_str(), | 377 return StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 377 test_case.c_str()); | 378 test_case.c_str()); |
| 378 } | 379 } |
| 379 | 380 |
| 380 // This macro finesses macro expansion to do what we want. | 381 // This macro finesses macro expansion to do what we want. |
| 381 #define STRIP_PREFIXES(test_name) StripPrefixes(#test_name) | 382 #define STRIP_PREFIXES(test_name) StripPrefixes(#test_name) |
| 382 | 383 |
| 383 // Use these macros to run the tests for a specific interface. | 384 // Use these macros to run the tests for a specific interface. |
| 384 // Most interfaces should be tested with both macros. | 385 // Most interfaces should be tested with both macros. |
| 385 #define TEST_PPAPI_IN_PROCESS(test_name) \ | 386 #define TEST_PPAPI_IN_PROCESS(test_name) \ |
| 386 IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \ | 387 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) | 435 #if defined(DISABLE_NACL) |
| 435 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) | 436 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) |
| 436 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) | 437 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) |
| 437 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) | 438 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) |
| 438 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) | 439 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) |
| 439 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) | 440 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) |
| 440 #else | 441 #else |
| 441 | 442 |
| 442 // NaCl based PPAPI tests | 443 // NaCl based PPAPI tests |
| 443 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) \ | 444 #define TEST_PPAPI_NACL_VIA_HTTP(test_name) \ |
| 444 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 445 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 446 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ |
| 447 } \ |
| 448 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ |
| 445 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ | 449 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ |
| 446 } | 450 } |
| 447 | 451 |
| 448 // NaCl based PPAPI tests with disallowed socket API | 452 // NaCl based PPAPI tests with disallowed socket API |
| 449 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) \ | 453 #define TEST_PPAPI_NACL_VIA_HTTP_DISALLOWED_SOCKETS(test_name) \ |
| 450 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \ | 454 IN_PROC_BROWSER_TEST_F(PPAPINaClTestDisallowedSockets, test_name) { \ |
| 451 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ | 455 RunTestViaHTTP(STRIP_PREFIXES(test_name)); \ |
| 452 } | 456 } |
| 453 | 457 |
| 454 // NaCl based PPAPI tests with SSL server | 458 // NaCl based PPAPI tests with SSL server |
| 455 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \ | 459 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name) \ |
| 456 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 460 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 461 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ |
| 462 } \ |
| 463 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ |
| 457 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ | 464 RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \ |
| 458 } | 465 } |
| 459 | 466 |
| 460 // NaCl based PPAPI tests with WebSocket server | 467 // NaCl based PPAPI tests with WebSocket server |
| 461 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) \ | 468 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) \ |
| 462 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 469 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 470 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ |
| 471 } \ |
| 472 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ |
| 463 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ | 473 RunTestWithWebSocketServer(STRIP_PREFIXES(test_name)); \ |
| 464 } | 474 } |
| 465 | 475 |
| 466 // NaCl based PPAPI tests requiring an Audio device. | 476 // NaCl based PPAPI tests requiring an Audio device. |
| 467 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) \ | 477 #define TEST_PPAPI_NACL_VIA_HTTP_WITH_AUDIO_OUTPUT(test_name) \ |
| 468 IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \ | 478 IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \ |
| 479 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ |
| 480 } \ |
| 481 IN_PROC_BROWSER_TEST_F(PPAPINaClGLibcTest, test_name) { \ |
| 469 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ | 482 RunTestViaHTTPIfAudioOutputAvailable(STRIP_PREFIXES(test_name)); \ |
| 470 } | 483 } |
| 471 #endif | 484 #endif |
| 472 | 485 |
| 473 | 486 |
| 474 // | 487 // |
| 475 // Interface tests. | 488 // Interface tests. |
| 476 // | 489 // |
| 477 | 490 |
| 478 // Disable tests under ASAN. http://crbug.com/104832. | 491 // Disable tests under ASAN. http://crbug.com/104832. |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_Basics) | 1118 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_Basics) |
| 1106 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_RunWithoutQuit) | 1119 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_RunWithoutQuit) |
| 1107 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_Basics) | 1120 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_Basics) |
| 1108 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) | 1121 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) |
| 1109 | 1122 |
| 1110 TEST_PPAPI_IN_PROCESS(MouseCursor) | 1123 TEST_PPAPI_IN_PROCESS(MouseCursor) |
| 1111 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) | 1124 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) |
| 1112 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) | 1125 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) |
| 1113 | 1126 |
| 1114 #endif // ADDRESS_SANITIZER | 1127 #endif // ADDRESS_SANITIZER |
| OLD | NEW |