diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 14:51:32 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 14:51:32 +0000 |
commit | d9f9219691294710fface354ad0c99b32adf2300 (patch) | |
tree | d3514bc9be228415693381013d19c4b3ba5b9e74 /chrome_frame/test | |
parent | 27ebf26a77cd8e69c7216331ad690d9bed06c720 (diff) | |
download | chromium_src-d9f9219691294710fface354ad0c99b32adf2300.zip chromium_src-d9f9219691294710fface354ad0c99b32adf2300.tar.gz chromium_src-d9f9219691294710fface354ad0c99b32adf2300.tar.bz2 |
Ensure that the ChromeFrame reliability and perf tests startup in headless mode and also start crash_service.exe, which
would serve as the crash handler for the duration of the test runs. This ensures that the tests don't hang for 60 seconds
while unloading the chrome frame dll which waits for the exception handler code to uninitialize which blocks on machines
which don't have the official crash server running.
Review URL: http://codereview.chromium.org/2810024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50594 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.cc | 25 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.h | 4 | ||||
-rw-r--r-- | chrome_frame/test/perf/run_all.cc | 18 | ||||
-rw-r--r-- | chrome_frame/test/reliability/run_all_unittests.cc | 11 | ||||
-rw-r--r-- | chrome_frame/test/run_all_unittests.cc | 27 |
5 files changed, 56 insertions, 29 deletions
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index 62be84e..e50d665 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -13,6 +13,8 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "base/path_service.h" +#include "base/platform_thread.h" +#include "base/process_util.h" #include "base/registry.h" // to find IE and firefox #include "base/scoped_bstr_win.h" #include "base/scoped_handle.h" @@ -905,4 +907,27 @@ void DelaySendExtendedKeysEnter(TimedMsgLoop* loop, int delay, char c, simulate_input::SendCharA, VK_RETURN, simulate_input::NONE), next_delay); } +base::ProcessHandle StartCrashService() { + FilePath exe_dir; + if (!PathService::Get(base::DIR_EXE, &exe_dir)) { + DCHECK(false); + return NULL; + } + + base::ProcessHandle crash_service = NULL; + + FilePath crash_service_path = exe_dir.AppendASCII("crash_service.exe"); + if (!base::LaunchApp(crash_service_path.value(), false, false, + &crash_service)) { + DLOG(ERROR) << "Couldn't start crash_service.exe"; + return NULL; + } + + DLOG(INFO) << "Started crash_service.exe so you know if a test crashes!"; + // This sleep is to ensure that the crash service is done initializing, i.e + // the pipe creation, etc. + Sleep(500); + return crash_service; +} + } // namespace chrome_frame_test diff --git a/chrome_frame/test/chrome_frame_test_utils.h b/chrome_frame/test/chrome_frame_test_utils.h index cdec8d6..fb553dd 100644 --- a/chrome_frame/test/chrome_frame_test_utils.h +++ b/chrome_frame/test/chrome_frame_test_utils.h @@ -383,6 +383,10 @@ class ComStackObjectWithUninitialize : public CComObjectStackEx<Base> { } }; +// Starts the Chrome crash service which enables us to gather crash dumps +// during test runs. +base::ProcessHandle StartCrashService(); + } // namespace chrome_frame_test #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ diff --git a/chrome_frame/test/perf/run_all.cc b/chrome_frame/test/perf/run_all.cc index d7db258..25ffcd3 100644 --- a/chrome_frame/test/perf/run_all.cc +++ b/chrome_frame/test/perf/run_all.cc @@ -1,17 +1,29 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/platform_thread.h" #include "base/test/perf_test_suite.h" #include "base/scoped_ptr.h" #include "chrome/common/chrome_paths.h" +#include "chrome_frame/test/chrome_frame_test_utils.h" #include "chrome_frame/test_utils.h" +#include "chrome_frame/utils.h" int main(int argc, char **argv) { PerfTestSuite perf_suite(argc, argv); chrome::RegisterPathProvider(); PlatformThread::SetName("ChromeFrame perf tests"); + + SetConfigBool(kChromeFrameHeadlessMode, true); + base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); + // Use ctor/raii to register the local Chrome Frame dll. - scoped_ptr<ScopedChromeFrameRegistrar> registrar(new ScopedChromeFrameRegistrar); - return perf_suite.Run(); + scoped_ptr<ScopedChromeFrameRegistrar> registrar( + new ScopedChromeFrameRegistrar); + int ret = perf_suite.Run(); + + DeleteConfigValue(kChromeFrameHeadlessMode); + if (crash_service) + base::KillProcess(crash_service, 0, false); + return ret; } diff --git a/chrome_frame/test/reliability/run_all_unittests.cc b/chrome_frame/test/reliability/run_all_unittests.cc index 3b23a8a..3b2604d 100644 --- a/chrome_frame/test/reliability/run_all_unittests.cc +++ b/chrome_frame/test/reliability/run_all_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,9 @@ #include "base/command_line.h" #include "chrome/common/chrome_paths.h" +#include "chrome_frame/test/chrome_frame_test_utils.h" #include "chrome_frame/test_utils.h" +#include "chrome_frame/utils.h" const wchar_t kRegisterDllFlag[] = L"register"; @@ -22,6 +24,9 @@ int main(int argc, char **argv) { // AtExitManager which some of the other stuff below relies on. ReliabilityTestSuite test_suite(argc, argv); + SetConfigBool(kChromeFrameHeadlessMode, true); + base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); + int result = -1; if (cmd_line->HasSwitch(kRegisterDllFlag)) { std::wstring dll_path = cmd_line->GetSwitchValue(kRegisterDllFlag); @@ -34,6 +39,10 @@ int main(int argc, char **argv) { result = test_suite.Run(); } + DeleteConfigValue(kChromeFrameHeadlessMode); + if (crash_service) + base::KillProcess(crash_service, 0, false); + return result; } diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc index fccdd5e..427fd84 100644 --- a/chrome_frame/test/run_all_unittests.cc +++ b/chrome_frame/test/run_all_unittests.cc @@ -15,6 +15,7 @@ #include "base/command_line.h" #include "chrome/common/chrome_paths.h" +#include "chrome_frame/test/chrome_frame_test_utils.h" #include "chrome_frame/test/http_server.h" #include "chrome_frame/test_utils.h" #include "chrome_frame/utils.h" @@ -36,30 +37,6 @@ const wchar_t kNoRegistrationSwitch[] = L"no-registration"; // server is killed. Useful for debugging tests. const wchar_t kRunAsServer[] = L"server"; -base::ProcessHandle LoadCrashService() { - FilePath exe_dir; - if (!PathService::Get(base::DIR_EXE, &exe_dir)) { - DCHECK(false); - return NULL; - } - - base::ProcessHandle crash_service = NULL; - - FilePath crash_service_path = exe_dir.AppendASCII("crash_service.exe"); - if (!base::LaunchApp(crash_service_path.value(), false, false, - &crash_service)) { - printf("Couldn't start crash_service.exe, so this test run won't tell " \ - "you if any test crashes!\n"); - return NULL; - } - - printf("Started crash_service.exe so you know if a test crashes!\n"); - // This sleep is to ensure that the crash service is done initializing, i.e - // the pipe creation, etc. - Sleep(500); - return crash_service; -} - void PureCall() { __debugbreak(); } @@ -93,7 +70,7 @@ int main(int argc, char **argv) { SetConfigBool(kChromeFrameHeadlessMode, true); - base::ProcessHandle crash_service = LoadCrashService(); + base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); int ret = -1; // If mini_installer is used to register CF, we use the switch // --no-registration to avoid repetitive registration. |