| 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 "components/metrics/metrics_service.h" | 8 #include "components/metrics/metrics_service.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 base::FilePath page2_path = test_directory.AppendASCII("iframe.html"); | 54 base::FilePath page2_path = test_directory.AppendASCII("iframe.html"); |
| 55 ui_test_utils::NavigateToURLWithDisposition( | 55 ui_test_utils::NavigateToURLWithDisposition( |
| 56 browser(), | 56 browser(), |
| 57 net::FilePathToFileURL(page2_path), | 57 net::FilePathToFileURL(page2_path), |
| 58 NEW_FOREGROUND_TAB, | 58 NEW_FOREGROUND_TAB, |
| 59 kBrowserTestFlags); | 59 kBrowserTestFlags); |
| 60 } | 60 } |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // Flaky failing DCHECK on Windows, see crbug.com/636052 | 63 IN_PROC_BROWSER_TEST_F(MetricsServiceBrowserTest, CloseRenderersNormally) { |
| 64 #if defined(OS_WIN) | |
| 65 #define MAYBE_CloseRenderersNormally DISABLED_CloseRenderersNormally | |
| 66 #else | |
| 67 #define MAYBE_CloseRenderersNormally CloseRenderersNormally | |
| 68 #endif | |
| 69 IN_PROC_BROWSER_TEST_F(MetricsServiceBrowserTest, | |
| 70 MAYBE_CloseRenderersNormally) { | |
| 71 OpenTabs(); | 64 OpenTabs(); |
| 72 | 65 |
| 73 // Verify that the expected stability metrics were recorded. | 66 // Verify that the expected stability metrics were recorded. |
| 74 const PrefService* prefs = g_browser_process->local_state(); | 67 const PrefService* prefs = g_browser_process->local_state(); |
| 75 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); | 68 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); |
| 76 EXPECT_EQ(3, prefs->GetInteger(metrics::prefs::kStabilityPageLoadCount)); | 69 EXPECT_EQ(3, prefs->GetInteger(metrics::prefs::kStabilityPageLoadCount)); |
| 77 EXPECT_EQ(0, prefs->GetInteger(metrics::prefs::kStabilityRendererCrashCount)); | 70 EXPECT_EQ(0, prefs->GetInteger(metrics::prefs::kStabilityRendererCrashCount)); |
| 78 // TODO(isherman): We should also verify that | 71 // TODO(isherman): We should also verify that |
| 79 // metrics::prefs::kStabilityExitedCleanly | 72 // metrics::prefs::kStabilityExitedCleanly |
| 80 // is set to true, but this preference isn't set until the browser | 73 // is set to true, but this preference isn't set until the browser |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 106 |
| 114 // Verify that the expected stability metrics were recorded. | 107 // Verify that the expected stability metrics were recorded. |
| 115 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); | 108 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); |
| 116 EXPECT_EQ(4, prefs->GetInteger(metrics::prefs::kStabilityPageLoadCount)); | 109 EXPECT_EQ(4, prefs->GetInteger(metrics::prefs::kStabilityPageLoadCount)); |
| 117 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityRendererCrashCount)); | 110 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityRendererCrashCount)); |
| 118 // TODO(isherman): We should also verify that | 111 // TODO(isherman): We should also verify that |
| 119 // metrics::prefs::kStabilityExitedCleanly | 112 // metrics::prefs::kStabilityExitedCleanly |
| 120 // 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 |
| 121 // exits... it's not clear to me how to test that. | 114 // exits... it's not clear to me how to test that. |
| 122 } | 115 } |
| OLD | NEW |