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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #else | 84 #else |
85 #define MAYBE_CrashRenderers CrashRenderers | 85 #define MAYBE_CrashRenderers CrashRenderers |
86 #endif | 86 #endif |
87 IN_PROC_BROWSER_TEST_F(MetricsServiceTest, MAYBE_CrashRenderers) { | 87 IN_PROC_BROWSER_TEST_F(MetricsServiceTest, MAYBE_CrashRenderers) { |
88 OpenTabs(); | 88 OpenTabs(); |
89 | 89 |
90 // Kill the process for one of the tabs. | 90 // Kill the process for one of the tabs. |
91 content::WindowedNotificationObserver observer( | 91 content::WindowedNotificationObserver observer( |
92 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 92 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
93 content::NotificationService::AllSources()); | 93 content::NotificationService::AllSources()); |
94 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); | 94 ui_test_utils::NavigateToURL(browser(), GURL(content::kChromeUICrashURL)); |
95 observer.Wait(); | 95 observer.Wait(); |
96 | 96 |
97 // The MetricsService listens for the same notification, so the |observer| | 97 // The MetricsService listens for the same notification, so the |observer| |
98 // might finish waiting before the MetricsService has a chance to process the | 98 // might finish waiting before the MetricsService has a chance to process the |
99 // notification. To avoid racing here, we repeatedly run the message loop | 99 // notification. To avoid racing here, we repeatedly run the message loop |
100 // until the MetricsService catches up. This should happen "real soon now", | 100 // until the MetricsService catches up. This should happen "real soon now", |
101 // since the notification is posted to all observers essentially | 101 // since the notification is posted to all observers essentially |
102 // simultaneously... so busy waiting here shouldn't be too bad. | 102 // simultaneously... so busy waiting here shouldn't be too bad. |
103 const PrefService* prefs = g_browser_process->local_state(); | 103 const PrefService* prefs = g_browser_process->local_state(); |
104 while (!prefs->GetInteger(prefs::kStabilityRendererCrashCount)) { | 104 while (!prefs->GetInteger(prefs::kStabilityRendererCrashCount)) { |
(...skipping 19 matching lines...) Expand all Loading... |
124 | 124 |
125 IN_PROC_BROWSER_TEST_F(MetricsServiceReportingTest, | 125 IN_PROC_BROWSER_TEST_F(MetricsServiceReportingTest, |
126 CheckHighEntropySourceUsed) { | 126 CheckHighEntropySourceUsed) { |
127 // Since the full metrics service runs in this test, we expect that | 127 // Since the full metrics service runs in this test, we expect that |
128 // MetricsService returns the full entropy source at some point during | 128 // MetricsService returns the full entropy source at some point during |
129 // BrowserMain startup. | 129 // BrowserMain startup. |
130 ASSERT_TRUE(g_browser_process->metrics_service()); | 130 ASSERT_TRUE(g_browser_process->metrics_service()); |
131 EXPECT_EQ(MetricsService::LAST_ENTROPY_HIGH, | 131 EXPECT_EQ(MetricsService::LAST_ENTROPY_HIGH, |
132 g_browser_process->metrics_service()->entropy_source_returned()); | 132 g_browser_process->metrics_service()->entropy_source_returned()); |
133 } | 133 } |
OLD | NEW |