OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 OpenTabs(); | 61 OpenTabs(); |
62 QuitBrowser(); | 62 QuitBrowser(); |
63 | 63 |
64 scoped_ptr<PrefService> local_state(GetLocalState()); | 64 scoped_ptr<PrefService> local_state(GetLocalState()); |
65 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 65 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
66 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 66 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
67 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 67 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
68 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 68 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
69 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 69 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
70 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 70 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
| 71 #if defined(TOUCH_UI) |
| 72 // The keyboard page loads for touchui. |
| 73 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 74 #else |
71 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 75 EXPECT_EQ(3, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 76 #endif |
72 EXPECT_EQ(0, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 77 EXPECT_EQ(0, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
73 } | 78 } |
74 | 79 |
75 TEST_F(MetricsServiceTest, DISABLED_CrashRenderers) { | 80 TEST_F(MetricsServiceTest, DISABLED_CrashRenderers) { |
76 // This doesn't make sense to test in single process mode. | 81 // This doesn't make sense to test in single process mode. |
77 if (ProxyLauncher::in_process_renderer()) | 82 if (ProxyLauncher::in_process_renderer()) |
78 return; | 83 return; |
79 | 84 |
80 OpenTabs(); | 85 OpenTabs(); |
81 | 86 |
(...skipping 22 matching lines...) Expand all Loading... |
104 | 109 |
105 QuitBrowser(); | 110 QuitBrowser(); |
106 | 111 |
107 scoped_ptr<PrefService> local_state(GetLocalState()); | 112 scoped_ptr<PrefService> local_state(GetLocalState()); |
108 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 113 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
109 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 114 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
110 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 115 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
111 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 116 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
112 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 117 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
113 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 118 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
| 119 #if defined(TOUCH_UI) |
| 120 // The keyboard page loads for touchui. |
| 121 EXPECT_EQ(5, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 122 #else |
114 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 123 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
| 124 #endif |
115 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 125 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
116 } | 126 } |
OLD | NEW |