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