| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" | 5 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" |
| 6 | 6 |
| 7 #include "base/metrics/statistics_recorder.h" | 7 #include "base/metrics/statistics_recorder.h" |
| 8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
| 9 #include "content/public/test/test_browser_thread_bundle.h" | 9 #include "content/public/test/test_browser_thread_bundle.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 class ErrorScreensHistogramHelperTest : public testing::Test { | 14 class ErrorScreensHistogramHelperTest : public testing::Test { |
| 15 public: | 15 public: |
| 16 virtual void SetUp() override { | 16 void SetUp() override { |
| 17 helper_.reset(new ErrorScreensHistogramHelper("TestScreen")); | 17 helper_.reset(new ErrorScreensHistogramHelper("TestScreen")); |
| 18 second_helper_.reset(new ErrorScreensHistogramHelper("TestScreen2")); | 18 second_helper_.reset(new ErrorScreensHistogramHelper("TestScreen2")); |
| 19 } | 19 } |
| 20 | 20 |
| 21 content::TestBrowserThreadBundle thread_bundle_; | 21 content::TestBrowserThreadBundle thread_bundle_; |
| 22 base::HistogramTester histograms_; | 22 base::HistogramTester histograms_; |
| 23 scoped_ptr<ErrorScreensHistogramHelper> helper_; | 23 scoped_ptr<ErrorScreensHistogramHelper> helper_; |
| 24 scoped_ptr<ErrorScreensHistogramHelper> second_helper_; | 24 scoped_ptr<ErrorScreensHistogramHelper> second_helper_; |
| 25 }; | 25 }; |
| 26 | 26 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 now += base::TimeDelta::FromMilliseconds(1000); | 106 now += base::TimeDelta::FromMilliseconds(1000); |
| 107 helper_->OnErrorShowTime(ErrorScreen::ERROR_STATE_PORTAL, now); | 107 helper_->OnErrorShowTime(ErrorScreen::ERROR_STATE_PORTAL, now); |
| 108 now += base::TimeDelta::FromMilliseconds(1000); | 108 now += base::TimeDelta::FromMilliseconds(1000); |
| 109 helper_->OnErrorHideTime(now); | 109 helper_->OnErrorHideTime(now); |
| 110 helper_.reset(); | 110 helper_.reset(); |
| 111 histograms_.ExpectUniqueSample( | 111 histograms_.ExpectUniqueSample( |
| 112 "OOBE.ErrorScreensTime.TestScreen.Portal", 2000, 1); | 112 "OOBE.ErrorScreensTime.TestScreen.Portal", 2000, 1); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace chromeos | 115 } // namespace chromeos |
| OLD | NEW |