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.
5 #include "chrome_frame/test/reliability/reliability_test_suite.h"
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"
14 static const char kRegisterDllFlag
[] = "register";
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
);
22 SetConfigBool(kChromeFrameHeadlessMode
, true);
23 base::ProcessHandle crash_service
= chrome_frame_test::StartCrashService();
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();
31 NOTREACHED() << "CommandLine object not initialized";
34 if (cmd_line
->HasSwitch(kRegisterDllFlag
)) {
35 std::wstring dll_path
= cmd_line
->GetSwitchValueNative(kRegisterDllFlag
);
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();
43 result
= test_suite
.Run();
46 DeleteConfigValue(kChromeFrameHeadlessMode
);
48 base::KillProcess(crash_service
, 0, false);