From 57113eacd955181e1267f3f20b889bc6fbfd07f2 Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Thu, 18 Jun 2009 02:23:16 +0000 Subject: Linux: Enable metrics_service_uitest.cc. Take 2. Relands r18641, original code review: http://codereview.chromium.org/125268 Expect a crash on Windows. The old method of crashing was flawed on posix (KillProcess just does a SIGTERM). On Windows though, it would terminate the process with the desired exit code, in order to make DidProcessCrash() return true. This process termination does not dump crash information though, since it just forcibly terminates the process, like a SIGKILL on posix. When I switched it to navigate to about:crash though, it actually crashes, and dumps crash information, which the UITest in windows (but not linux/mac) detects. Therefore, until those platforms can detect, we just use #if defined(OS_WIN) around the expected_crashes = 1. Review URL: http://codereview.chromium.org/131007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18680 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/metrics/metrics_service_uitest.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'chrome/browser/metrics') diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc index 7245a35..cf453a5 100644 --- a/chrome/browser/metrics/metrics_service_uitest.cc +++ b/chrome/browser/metrics/metrics_service_uitest.cc @@ -90,14 +90,12 @@ TEST_F(MetricsServiceTest, CrashRenderers) { // kill the process for one of the tabs scoped_refptr tab(window_->GetTab(1)); ASSERT_TRUE(tab.get()); - int process_id = 0; - ASSERT_TRUE(tab->GetProcessID(&process_id)); - ASSERT_NE(0, process_id); - base::ProcessHandle process_handle; - ASSERT_TRUE(base::OpenProcessHandle(process_id, &process_handle)); - // Fake Access Violation. - base::KillProcess(process_handle, 0xc0000005, true); - base::CloseProcessHandle(process_handle); + +// Only windows implements the crash service for now. +#if defined(OS_WIN) + expected_crashes_ = 1; +#endif + tab->NavigateToURLAsync(GURL("about:crash")); // Give the browser a chance to notice the crashed tab. PlatformThread::Sleep(1000); @@ -111,6 +109,6 @@ TEST_F(MetricsServiceTest, CrashRenderers) { local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); - EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); + EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); } -- cgit v1.1