OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // 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_path.h" | 10 #include "base/file_path.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 66 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
67 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 67 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
68 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 68 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
69 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 69 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
70 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 70 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
71 EXPECT_EQ(0, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 71 EXPECT_EQ(0, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
72 } | 72 } |
73 | 73 |
74 TEST_F(MetricsServiceTest, CrashRenderers) { | 74 TEST_F(MetricsServiceTest, CrashRenderers) { |
75 // This doesn't make sense to test in single process mode. | 75 // This doesn't make sense to test in single process mode. |
76 if (in_process_renderer_) | 76 if (ProxyLauncher::in_process_renderer()) |
77 return; | 77 return; |
78 | 78 |
79 OpenTabs(); | 79 OpenTabs(); |
80 | 80 |
81 { | 81 { |
82 // Limit the lifetime of various automation proxies used here. We must | 82 // Limit the lifetime of various automation proxies used here. We must |
83 // destroy them before calling QuitBrowser. | 83 // destroy them before calling QuitBrowser. |
84 | 84 |
85 scoped_refptr<BrowserProxy> window = automation()->GetBrowserWindow(0); | 85 scoped_refptr<BrowserProxy> window = automation()->GetBrowserWindow(0); |
86 ASSERT_TRUE(window.get()); | 86 ASSERT_TRUE(window.get()); |
(...skipping 19 matching lines...) Expand all Loading... |
106 scoped_ptr<PrefService> local_state(GetLocalState()); | 106 scoped_ptr<PrefService> local_state(GetLocalState()); |
107 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 107 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
108 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 108 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
109 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 109 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
110 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 110 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
111 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 111 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
112 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 112 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
113 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 113 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
114 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 114 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
115 } | 115 } |
OLD | NEW |