| 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 IN_PROC_BROWSER_TEST_F(MetricsServiceBrowserTest, CloseRenderersNormally) { | 63 // Flaky failing DCHECK on Windows, see crbug.com/636052 |
| 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) { |
| 64 OpenTabs(); | 71 OpenTabs(); |
| 65 | 72 |
| 66 // Verify that the expected stability metrics were recorded. | 73 // Verify that the expected stability metrics were recorded. |
| 67 const PrefService* prefs = g_browser_process->local_state(); | 74 const PrefService* prefs = g_browser_process->local_state(); |
| 68 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); | 75 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); |
| 69 EXPECT_EQ(3, prefs->GetInteger(metrics::prefs::kStabilityPageLoadCount)); | 76 EXPECT_EQ(3, prefs->GetInteger(metrics::prefs::kStabilityPageLoadCount)); |
| 70 EXPECT_EQ(0, prefs->GetInteger(metrics::prefs::kStabilityRendererCrashCount)); | 77 EXPECT_EQ(0, prefs->GetInteger(metrics::prefs::kStabilityRendererCrashCount)); |
| 71 // TODO(isherman): We should also verify that | 78 // TODO(isherman): We should also verify that |
| 72 // metrics::prefs::kStabilityExitedCleanly | 79 // metrics::prefs::kStabilityExitedCleanly |
| 73 // is set to true, but this preference isn't set until the browser | 80 // 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... |
| 106 | 113 |
| 107 // Verify that the expected stability metrics were recorded. | 114 // Verify that the expected stability metrics were recorded. |
| 108 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); | 115 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); |
| 109 EXPECT_EQ(4, prefs->GetInteger(metrics::prefs::kStabilityPageLoadCount)); | 116 EXPECT_EQ(4, prefs->GetInteger(metrics::prefs::kStabilityPageLoadCount)); |
| 110 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityRendererCrashCount)); | 117 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityRendererCrashCount)); |
| 111 // TODO(isherman): We should also verify that | 118 // TODO(isherman): We should also verify that |
| 112 // metrics::prefs::kStabilityExitedCleanly | 119 // metrics::prefs::kStabilityExitedCleanly |
| 113 // is set to true, but this preference isn't set until the browser | 120 // 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. | 121 // exits... it's not clear to me how to test that. |
| 115 } | 122 } |
| OLD | NEW |