| 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 "content/public/test/test_launcher.h" | 5 #include "content/public/test/test_launcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "base/time/time.h" | 33 #include "base/time/time.h" |
| 34 #include "build/build_config.h" | 34 #include "build/build_config.h" |
| 35 #include "content/public/app/content_main.h" | 35 #include "content/public/app/content_main.h" |
| 36 #include "content/public/app/content_main_delegate.h" | 36 #include "content/public/app/content_main_delegate.h" |
| 37 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 38 #include "content/public/common/sandbox_init.h" | 38 #include "content/public/common/sandbox_init.h" |
| 39 #include "content/public/test/browser_test.h" | 39 #include "content/public/test/browser_test.h" |
| 40 #include "net/base/escape.h" | 40 #include "net/base/escape.h" |
| 41 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
| 42 | 42 |
| 43 #if defined(OS_POSIX) |
| 44 #include "base/files/file_descriptor_watcher_posix.h" |
| 45 #endif |
| 46 |
| 43 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
| 44 #include "base/base_switches.h" | 48 #include "base/base_switches.h" |
| 45 #include "content/common/sandbox_win.h" | 49 #include "content/common/sandbox_win.h" |
| 46 #include "content/public/app/sandbox_helper_win.h" | 50 #include "content/public/app/sandbox_helper_win.h" |
| 47 #include "sandbox/win/src/sandbox_factory.h" | 51 #include "sandbox/win/src/sandbox_factory.h" |
| 48 #include "sandbox/win/src/sandbox_types.h" | 52 #include "sandbox/win/src/sandbox_types.h" |
| 49 #elif defined(OS_MACOSX) | 53 #elif defined(OS_MACOSX) |
| 50 #include "base/mac/scoped_nsautorelease_pool.h" | 54 #include "base/mac/scoped_nsautorelease_pool.h" |
| 51 #endif | 55 #endif |
| 52 | 56 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 534 |
| 531 fprintf(stdout, | 535 fprintf(stdout, |
| 532 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" | 536 "IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n" |
| 533 "For debugging a test inside a debugger, use the\n" | 537 "For debugging a test inside a debugger, use the\n" |
| 534 "--gtest_filter=<your_test_name> flag along with either\n" | 538 "--gtest_filter=<your_test_name> flag along with either\n" |
| 535 "--single_process (to run the test in one launcher/browser process) or\n" | 539 "--single_process (to run the test in one launcher/browser process) or\n" |
| 536 "--single-process (to do the above, and also run Chrome in single-" | 540 "--single-process (to do the above, and also run Chrome in single-" |
| 537 "process mode).\n"); | 541 "process mode).\n"); |
| 538 | 542 |
| 539 base::MessageLoopForIO message_loop; | 543 base::MessageLoopForIO message_loop; |
| 544 #if defined(OS_POSIX) |
| 545 base::FileDescriptorWatcher file_descriptor_watcher(&message_loop); |
| 546 #endif |
| 540 | 547 |
| 541 // Allow the |launcher_delegate| to modify |default_jobs|. | 548 // Allow the |launcher_delegate| to modify |default_jobs|. |
| 542 launcher_delegate->AdjustDefaultParallelJobs(&default_jobs); | 549 launcher_delegate->AdjustDefaultParallelJobs(&default_jobs); |
| 543 | 550 |
| 544 WrapperTestLauncherDelegate delegate(launcher_delegate); | 551 WrapperTestLauncherDelegate delegate(launcher_delegate); |
| 545 base::TestLauncher launcher(&delegate, default_jobs); | 552 base::TestLauncher launcher(&delegate, default_jobs); |
| 546 const int result = launcher.Run() ? 0 : 1; | 553 const int result = launcher.Run() ? 0 : 1; |
| 547 launcher_delegate->OnDoneRunningTests(); | 554 launcher_delegate->OnDoneRunningTests(); |
| 548 return result; | 555 return result; |
| 549 } | 556 } |
| 550 | 557 |
| 551 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { | 558 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { |
| 552 return g_launcher_delegate; | 559 return g_launcher_delegate; |
| 553 } | 560 } |
| 554 | 561 |
| 555 ContentMainParams* GetContentMainParams() { | 562 ContentMainParams* GetContentMainParams() { |
| 556 return g_params; | 563 return g_params; |
| 557 } | 564 } |
| 558 | 565 |
| 559 } // namespace content | 566 } // namespace content |
| OLD | NEW |