OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Tests the MetricsService stat recording to make sure that the numbers are | 5 // Tests the MetricsService stat recording to make sure that the numbers are |
6 // what we expect. | 6 // what we expect. |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return; | 84 return; |
85 | 85 |
86 OpenTabs(); | 86 OpenTabs(); |
87 | 87 |
88 // kill the process for one of the tabs | 88 // kill the process for one of the tabs |
89 scoped_ptr<TabProxy> tab(window_->GetTab(1)); | 89 scoped_ptr<TabProxy> tab(window_->GetTab(1)); |
90 ASSERT_TRUE(tab.get()); | 90 ASSERT_TRUE(tab.get()); |
91 int process_id = 0; | 91 int process_id = 0; |
92 ASSERT_TRUE(tab->GetProcessID(&process_id)); | 92 ASSERT_TRUE(tab->GetProcessID(&process_id)); |
93 ASSERT_NE(0, process_id); | 93 ASSERT_NE(0, process_id); |
94 base::KillProcess(process_id, 0xc0000005, true); // Fake Access Violation. | 94 // Fake Access Violation. |
| 95 base::KillProcessById(process_id, 0xc0000005, true); |
95 | 96 |
96 // Give the browser a chance to notice the crashed tab. | 97 // Give the browser a chance to notice the crashed tab. |
97 Sleep(1000); | 98 Sleep(1000); |
98 | 99 |
99 QuitBrowser(); | 100 QuitBrowser(); |
100 | 101 |
101 scoped_ptr<PrefService> local_state(GetLocalState()); | 102 scoped_ptr<PrefService> local_state(GetLocalState()); |
102 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 103 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
103 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 104 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
104 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 105 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
105 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 106 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
106 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 107 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
107 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 108 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
108 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 109 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
109 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 110 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
110 } | 111 } |
111 | 112 |
OLD | NEW |