- add sources.
[platform/framework/web/crosswalk.git] / src / chrome_frame / chrome_frame_unittest_main.cc
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 "chrome_frame/crash_server_init.h"
13 #include "chrome_frame/test/chrome_frame_test_utils.h"
14 #include "gtest/gtest.h"
15
16 class ObligatoryModule: public CAtlExeModuleT<ObligatoryModule> {
17 };
18
19 ObligatoryModule g_obligatory_atl_module;
20
21 static base::AtExitManager* g_at_exit_manager = NULL;
22
23 void DeleteAllSingletons() {
24   if (g_at_exit_manager) {
25     g_at_exit_manager->ProcessCallbacksNow();
26   }
27 }
28
29 int main(int argc, char** argv) {
30   testing::InitGoogleTest(&argc, argv);
31
32   base::AtExitManager at_exit_manager;
33   g_at_exit_manager = &at_exit_manager;
34
35   base::ProcessHandle crash_service = chrome_frame_test::StartCrashService();
36
37   google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad(
38       InitializeCrashReporting(HEADLESS));
39
40   CommandLine::Init(argc, argv);
41
42   RUN_ALL_TESTS();
43
44   g_at_exit_manager = NULL;
45
46   if (crash_service)
47     base::KillProcess(crash_service, 0, false);
48 }