OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome_frame/test/reliability/reliability_test_suite.h" | |
6 | |
7 #include "base/command_line.h" | |
8 #include "base/process/kill.h" | |
9 #include "chrome/common/chrome_paths.h" | |
10 #include "chrome_frame/test/chrome_frame_test_utils.h" | |
11 #include "chrome_frame/test_utils.h" | |
12 #include "chrome_frame/utils.h" | |
13 | |
14 static const char kRegisterDllFlag[] = "register"; | |
15 | |
16 int main(int argc, char **argv) { | |
17 ScopedChromeFrameRegistrar::RegisterAndExitProcessIfDirected(); | |
18 // We create this slightly early as it is the one who instantiates THE | |
19 // AtExitManager which some of the other stuff below relies on. | |
20 ReliabilityTestSuite test_suite(argc, argv); | |
21 | |
22 SetConfigBool(kChromeFrameHeadlessMode, true); | |
23 base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); | |
24 | |
25 int result = -1; | |
26 // If --register is passed, then we need to ensure that Chrome Frame is | |
27 // registered before starting up the reliability tests. | |
28 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | |
29 DCHECK(cmd_line); | |
30 if (!cmd_line) { | |
31 NOTREACHED() << "CommandLine object not initialized"; | |
32 return result; | |
33 } | |
34 if (cmd_line->HasSwitch(kRegisterDllFlag)) { | |
35 std::wstring dll_path = cmd_line->GetSwitchValueNative(kRegisterDllFlag); | |
36 | |
37 // Run() must be called within the scope of the ScopedChromeFrameRegistrar | |
38 // to ensure that the correct DLL remains registered during the tests. | |
39 ScopedChromeFrameRegistrar scoped_chrome_frame_registrar( | |
40 dll_path, ScopedChromeFrameRegistrar::SYSTEM_LEVEL); | |
41 result = test_suite.Run(); | |
42 } else { | |
43 result = test_suite.Run(); | |
44 } | |
45 | |
46 DeleteConfigValue(kChromeFrameHeadlessMode); | |
47 if (crash_service) | |
48 base::KillProcess(crash_service, 0, false); | |
49 | |
50 return result; | |
51 } | |
52 | |
OLD | NEW |