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

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

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 2 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 command_line->AppendSwitch(switches::kEnableMetricsReportingForTesting); 64 command_line->AppendSwitch(switches::kEnableMetricsReportingForTesting);
65 } 65 }
66 }; 66 };
67 67
68 IN_PROC_BROWSER_TEST_F(MetricsServiceBrowserTest, CloseRenderersNormally) { 68 IN_PROC_BROWSER_TEST_F(MetricsServiceBrowserTest, CloseRenderersNormally) {
69 OpenTabs(); 69 OpenTabs();
70 70
71 // Verify that the expected stability metrics were recorded. 71 // Verify that the expected stability metrics were recorded.
72 const PrefService* prefs = g_browser_process->local_state(); 72 const PrefService* prefs = g_browser_process->local_state();
73 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityLaunchCount)); 73 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityLaunchCount));
74 EXPECT_EQ(3, prefs->GetInteger(prefs::kStabilityPageLoadCount)); 74 EXPECT_EQ(5, prefs->GetInteger(prefs::kStabilityPageLoadCount));
75 EXPECT_EQ(0, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); 75 EXPECT_EQ(0, prefs->GetInteger(prefs::kStabilityRendererCrashCount));
76 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly 76 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly
77 // is set to true, but this preference isn't set until the browser 77 // is set to true, but this preference isn't set until the browser
78 // exits... it's not clear to me how to test that. 78 // exits... it's not clear to me how to test that.
79 } 79 }
80 80
81 // Flaky on Linux. See http://crbug.com/131094 81 // Flaky on Linux. See http://crbug.com/131094
82 #if defined(OS_LINUX) 82 #if defined(OS_LINUX)
83 #define MAYBE_CrashRenderers DISABLED_CrashRenderers 83 #define MAYBE_CrashRenderers DISABLED_CrashRenderers
84 #else 84 #else
(...skipping 15 matching lines...) Expand all
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)) {
105 content::RunAllPendingInMessageLoop(); 105 content::RunAllPendingInMessageLoop();
106 } 106 }
107 107
108 // Verify that the expected stability metrics were recorded. 108 // Verify that the expected stability metrics were recorded.
109 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityLaunchCount)); 109 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityLaunchCount));
110 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount)); 110 EXPECT_EQ(5, prefs->GetInteger(prefs::kStabilityPageLoadCount));
111 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); 111 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityRendererCrashCount));
112 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly 112 // TODO(isherman): We should also verify that prefs::kStabilityExitedCleanly
113 // is set to true, but this preference isn't set until the browser 113 // is set to true, but this preference isn't set until the browser
114 // exits... it's not clear to me how to test that. 114 // exits... it's not clear to me how to test that.
115 } 115 }
116 116
117 IN_PROC_BROWSER_TEST_F(MetricsServiceBrowserTest, CheckLowEntropySourceUsed) { 117 IN_PROC_BROWSER_TEST_F(MetricsServiceBrowserTest, CheckLowEntropySourceUsed) {
118 // Since MetricsService is only in recording mode, and is not reporting, 118 // Since MetricsService is only in recording mode, and is not reporting,
119 // check that the low entropy source is returned at some point. 119 // check that the low entropy source is returned at some point.
120 ASSERT_TRUE(g_browser_process->metrics_service()); 120 ASSERT_TRUE(g_browser_process->metrics_service());
121 EXPECT_EQ(MetricsService::LAST_ENTROPY_LOW, 121 EXPECT_EQ(MetricsService::LAST_ENTROPY_LOW,
122 g_browser_process->metrics_service()->entropy_source_returned()); 122 g_browser_process->metrics_service()->entropy_source_returned());
123 } 123 }
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698