OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 scoped_refptr<BrowserProxy> window = automation()->GetBrowserWindow(0); | 88 scoped_refptr<BrowserProxy> window = automation()->GetBrowserWindow(0); |
89 ASSERT_TRUE(window.get()); | 89 ASSERT_TRUE(window.get()); |
90 | 90 |
91 // Kill the process for one of the tabs. | 91 // Kill the process for one of the tabs. |
92 scoped_refptr<TabProxy> tab(window->GetTab(1)); | 92 scoped_refptr<TabProxy> tab(window->GetTab(1)); |
93 ASSERT_TRUE(tab.get()); | 93 ASSERT_TRUE(tab.get()); |
94 | 94 |
95 // We can get crash dumps on Windows always, Linux when breakpad is | 95 // We can get crash dumps on Windows always, Linux when breakpad is |
96 // enabled, and all platforms for official Google Chrome builds. | 96 // enabled, and all platforms for official Google Chrome builds. |
97 #if defined(OS_WIN) || defined(USE_LINUX_BREAKPAD) || \ | 97 #if defined(OS_WIN) || defined(USE_POSIX_BREAKPAD) || \ |
98 defined(GOOGLE_CHROME_BUILD) | 98 defined(GOOGLE_CHROME_BUILD) |
99 expected_crashes_ = 1; | 99 expected_crashes_ = 1; |
100 #endif | 100 #endif |
101 ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kChromeUICrashURL))); | 101 ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kChromeUICrashURL))); |
102 } | 102 } |
103 | 103 |
104 // Give the browser a chance to notice the crashed tab. | 104 // Give the browser a chance to notice the crashed tab. |
105 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 105 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); |
106 | 106 |
107 QuitBrowser(); | 107 QuitBrowser(); |
108 | 108 |
109 scoped_ptr<PrefService> local_state(GetLocalState()); | 109 scoped_ptr<PrefService> local_state(GetLocalState()); |
110 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 110 local_state->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
111 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); | 111 local_state->RegisterIntegerPref(prefs::kStabilityLaunchCount, 0); |
112 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); | 112 local_state->RegisterIntegerPref(prefs::kStabilityPageLoadCount, 0); |
113 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 113 local_state->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
114 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); | 114 EXPECT_TRUE(local_state->GetBoolean(prefs::kStabilityExitedCleanly)); |
115 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); | 115 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityLaunchCount)); |
116 #if defined(USE_VIRTUAL_KEYBOARD) | 116 #if defined(USE_VIRTUAL_KEYBOARD) |
117 // The keyboard page loads. | 117 // The keyboard page loads. |
118 EXPECT_EQ(5, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 118 EXPECT_EQ(5, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
119 #else | 119 #else |
120 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); | 120 EXPECT_EQ(4, local_state->GetInteger(prefs::kStabilityPageLoadCount)); |
121 #endif | 121 #endif |
122 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); | 122 EXPECT_EQ(1, local_state->GetInteger(prefs::kStabilityRendererCrashCount)); |
123 } | 123 } |
OLD | NEW |