Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: chrome/browser/metrics/metrics_service_browsertest.cc

Issue 10825085: Move RunAllPendingInMessageLoop from ui_test_utils.h to test_utils.h, so that it can be reused by c… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 observer.Wait(); 86 observer.Wait();
87 87
88 // The MetricsService listens for the same notification, so the |observer| 88 // The MetricsService listens for the same notification, so the |observer|
89 // might finish waiting before the MetricsService has a chance to process the 89 // might finish waiting before the MetricsService has a chance to process the
90 // notification. To avoid racing here, we repeatedly run the message loop 90 // notification. To avoid racing here, we repeatedly run the message loop
91 // until the MetricsService catches up. This should happen "real soon now", 91 // until the MetricsService catches up. This should happen "real soon now",
92 // since the notification is posted to all observers essentially 92 // since the notification is posted to all observers essentially
93 // simultaneously... so busy waiting here shouldn't be too bad. 93 // simultaneously... so busy waiting here shouldn't be too bad.
94 const PrefService* prefs = g_browser_process->local_state(); 94 const PrefService* prefs = g_browser_process->local_state();
95 while (!prefs->GetInteger(prefs::kStabilityRendererCrashCount)) { 95 while (!prefs->GetInteger(prefs::kStabilityRendererCrashCount)) {
96 ui_test_utils::RunAllPendingInMessageLoop(); 96 content::RunAllPendingInMessageLoop();
97 } 97 }
98 98
99 // Verify that the expected stability metrics were recorded. 99 // Verify that the expected stability metrics were recorded.
100 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityLaunchCount)); 100 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityLaunchCount));
101 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount)); 101 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount));
102 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); 102 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityRendererCrashCount));
103 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly 103 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly
104 // is set to true, but this preference isn't set until the browser 104 // is set to true, but this preference isn't set until the browser
105 // exits... it's not clear to me how to test that. 105 // exits... it's not clear to me how to test that.
106 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698