Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/public/test/test_launcher.cc

Issue 59623015: GTTF: Flip test launcher defaults (developer mode is now default) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/public/test/test_launcher.h" 5 #include "content/public/test/test_launcher.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 LOG(WARNING) << "Failed to delete " 392 LOG(WARNING) << "Failed to delete "
393 << user_data_dir_map_[test_name_no_pre].value(); 393 << user_data_dir_map_[test_name_no_pre].value();
394 } 394 }
395 user_data_dir_map_.erase(test_name_no_pre); 395 user_data_dir_map_.erase(test_name_no_pre);
396 } 396 }
397 } 397 }
398 398
399 test_launcher->OnTestFinished(result); 399 test_launcher->OnTestFinished(result);
400 } 400 }
401 401
402 bool GetSwitchValueAsInt(const std::string& switch_name, int* result) {
403 if (!CommandLine::ForCurrentProcess()->HasSwitch(switch_name))
404 return true;
405
406 std::string switch_value =
407 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switch_name);
408 if (!base::StringToInt(switch_value, result) || *result < 1) {
409 LOG(ERROR) << "Invalid value for " << switch_name << ": " << switch_value;
410 return false;
411 }
412
413 return true;
414 }
415
416 } // namespace 402 } // namespace
417 403
418 const char kHelpFlag[] = "help"; 404 const char kHelpFlag[] = "help";
419 405
420 const char kLaunchAsBrowser[] = "as-browser"; 406 const char kLaunchAsBrowser[] = "as-browser";
421 407
422 // See kManualTestPrefix above. 408 // See kManualTestPrefix above.
423 const char kRunManualTestsFlag[] = "run-manual"; 409 const char kRunManualTestsFlag[] = "run-manual";
424 410
425 const char kSingleProcessTestsFlag[] = "single_process"; 411 const char kSingleProcessTestsFlag[] = "single_process";
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 return launcher_delegate->RunTestSuite(argc, argv); 474 return launcher_delegate->RunTestSuite(argc, argv);
489 } 475 }
490 476
491 if (ShouldRunContentMain()) 477 if (ShouldRunContentMain())
492 return RunContentMain(argc, argv, launcher_delegate); 478 return RunContentMain(argc, argv, launcher_delegate);
493 479
494 base::AtExitManager at_exit; 480 base::AtExitManager at_exit;
495 testing::InitGoogleTest(&argc, argv); 481 testing::InitGoogleTest(&argc, argv);
496 TestTimeouts::Initialize(); 482 TestTimeouts::Initialize();
497 483
498 int jobs = default_jobs;
499 if (!GetSwitchValueAsInt(switches::kTestLauncherJobs, &jobs))
500 return 1;
501
502 fprintf(stdout, 484 fprintf(stdout,
503 "Starting tests (using %d parallel jobs)...\n"
504 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" 485 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n"
505 "For debugging a test inside a debugger, use the\n" 486 "For debugging a test inside a debugger, use the\n"
506 "--gtest_filter=<your_test_name> flag along with either\n" 487 "--gtest_filter=<your_test_name> flag along with either\n"
507 "--single_process (to run the test in one launcher/browser process) or\n" 488 "--single_process (to run the test in one launcher/browser process) or\n"
508 "--single-process (to do the above, and also run Chrome in single-" 489 "--single-process (to do the above, and also run Chrome in single-"
509 "process mode).\n", jobs); 490 "process mode).\n");
510 491
511 base::MessageLoopForIO message_loop; 492 base::MessageLoopForIO message_loop;
512 493
513 WrapperTestLauncherDelegate delegate(launcher_delegate); 494 WrapperTestLauncherDelegate delegate(launcher_delegate);
514 base::TestLauncher launcher(&delegate, jobs); 495 base::TestLauncher launcher(&delegate, default_jobs);
515 bool success = launcher.Run(argc, argv); 496 bool success = launcher.Run(argc, argv);
516 return (success ? 0 : 1); 497 return (success ? 0 : 1);
517 } 498 }
518 499
519 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { 500 TestLauncherDelegate* GetCurrentTestLauncherDelegate() {
520 return g_launcher_delegate; 501 return g_launcher_delegate;
521 } 502 }
522 503
523 } // namespace content 504 } // namespace content
OLDNEW
« no previous file with comments | « content/content_browsertests.isolate ('k') | third_party/cacheinvalidation/cacheinvalidation_unittests.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698