| 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 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 23 #include "chrome/test/base/in_process_browser_test.h" | 23 #include "chrome/test/base/in_process_browser_test.h" |
| 24 #include "chrome/test/base/ui_test_utils.h" | 24 #include "chrome/test/base/ui_test_utils.h" |
| 25 #include "content/public/test/browser_test_utils.h" | 25 #include "content/public/test/browser_test_utils.h" |
| 26 #include "net/base/filename_util.h" | 26 #include "net/base/filename_util.h" |
| 27 #include "ui/base/window_open_disposition.h" | 27 #include "ui/base/window_open_disposition.h" |
| 28 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 29 | 29 |
| 30 class MetricsServiceBrowserTest : public InProcessBrowserTest { | 30 class MetricsServiceBrowserTest : public InProcessBrowserTest { |
| 31 public: | 31 public: |
| 32 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 32 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 33 // Enable the metrics service for testing (in recording-only mode). | 33 // Enable the metrics service for testing (in recording-only mode). |
| 34 command_line->AppendSwitch(switches::kMetricsRecordingOnly); | 34 command_line->AppendSwitch(switches::kMetricsRecordingOnly); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Open a couple of tabs of random content. | 37 // Open a couple of tabs of random content. |
| 38 void OpenTabs() { | 38 void OpenTabs() { |
| 39 const int kBrowserTestFlags = | 39 const int kBrowserTestFlags = |
| 40 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | | 40 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | |
| 41 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION; | 41 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION; |
| 42 | 42 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // Verify that the expected stability metrics were recorded. | 103 // Verify that the expected stability metrics were recorded. |
| 104 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); | 104 EXPECT_EQ(1, prefs->GetInteger(metrics::prefs::kStabilityLaunchCount)); |
| 105 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount)); | 105 EXPECT_EQ(4, prefs->GetInteger(prefs::kStabilityPageLoadCount)); |
| 106 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); | 106 EXPECT_EQ(1, prefs->GetInteger(prefs::kStabilityRendererCrashCount)); |
| 107 // TODO(isherman): We should also verify that | 107 // TODO(isherman): We should also verify that |
| 108 // metrics::prefs::kStabilityExitedCleanly | 108 // metrics::prefs::kStabilityExitedCleanly |
| 109 // is set to true, but this preference isn't set until the browser | 109 // is set to true, but this preference isn't set until the browser |
| 110 // exits... it's not clear to me how to test that. | 110 // exits... it's not clear to me how to test that. |
| 111 } | 111 } |
| 112 | 112 |
| OLD | NEW |