OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <atlbase.h> | |
6 #include <atlcom.h> | |
7 | |
8 #include "base/at_exit.h" | |
9 #include "base/command_line.h" | |
10 #include "base/process/kill.h" | |
11 #include "base/process/process.h" | |
12 #include "base/test/launcher/unit_test_launcher.h" | |
13 #include "base/test/test_suite.h" | |
14 #include "chrome_frame/crash_server_init.h" | |
15 #include "chrome_frame/test/chrome_frame_test_utils.h" | |
16 #include "gtest/gtest.h" | |
17 | |
18 class ObligatoryModule: public CAtlExeModuleT<ObligatoryModule> { | |
19 }; | |
20 | |
21 ObligatoryModule g_obligatory_atl_module; | |
22 | |
23 static base::AtExitManager* g_at_exit_manager = NULL; | |
24 | |
25 void DeleteAllSingletons() { | |
26 if (g_at_exit_manager) { | |
27 g_at_exit_manager->ProcessCallbacksNow(); | |
28 } | |
29 } | |
30 | |
31 namespace { | |
32 | |
33 class NoAtExitBaseTestSuite : public base::TestSuite { | |
34 public: | |
35 NoAtExitBaseTestSuite(int argc, char** argv) | |
36 : base::TestSuite(argc, argv, false) { | |
37 } | |
38 }; | |
39 | |
40 int RunTests(int argc, char** argv) { | |
41 base::AtExitManager at_exit_manager; | |
42 g_at_exit_manager = &at_exit_manager; | |
43 NoAtExitBaseTestSuite test_suite(argc, argv); | |
44 int exit_code = test_suite.Run(); | |
45 g_at_exit_manager = NULL; | |
46 return exit_code; | |
47 } | |
48 | |
49 } // namespace | |
50 | |
51 int main(int argc, char** argv) { | |
52 base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); | |
53 | |
54 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad( | |
55 InitializeCrashReporting(HEADLESS)); | |
56 | |
57 int exit_code = base::LaunchUnitTests(argc, | |
58 argv, | |
59 base::Bind(&RunTests, argc, argv)); | |
60 | |
61 if (crash_service) | |
62 base::KillProcess(crash_service, 0, false); | |
63 | |
64 return exit_code; | |
65 } | |
OLD | NEW |