Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / chromeos / login / error_screens_histogram_helper.h
blob36ce337eae99fd8922541be739a0b0505fdbf952
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ERROR_SCREENS_HISTOGRAM_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ERROR_SCREENS_HISTOGRAM_HELPER_H_
8 #include <string>
10 #include "base/gtest_prod_util.h"
11 #include "base/time/time.h"
12 #include "chrome/browser/chromeos/login/screens/network_error.h"
14 namespace chromeos {
15 FORWARD_DECLARE_TEST(ErrorScreensHistogramHelperTest, TestShowHideTime);
16 FORWARD_DECLARE_TEST(ErrorScreensHistogramHelperTest, TestShowHideShowHideTime);
17 FORWARD_DECLARE_TEST(ErrorScreensHistogramHelperTest, TestShowShowHideTime);
19 class ErrorScreensHistogramHelper {
20 public:
21 explicit ErrorScreensHistogramHelper(const std::string& screen_name);
22 void OnScreenShow();
23 void OnErrorShow(NetworkError::ErrorState error);
24 void OnErrorHide();
25 ~ErrorScreensHistogramHelper();
27 private:
28 FRIEND_TEST_ALL_PREFIXES(ErrorScreensHistogramHelperTest, TestShowHideTime);
29 FRIEND_TEST_ALL_PREFIXES(ErrorScreensHistogramHelperTest,
30 TestShowHideShowHideTime);
31 FRIEND_TEST_ALL_PREFIXES(ErrorScreensHistogramHelperTest,
32 TestShowShowHideTime);
33 // functions for testing.
34 void OnErrorShowTime(NetworkError::ErrorState error, base::Time now);
35 void OnErrorHideTime(base::Time now);
37 std::string screen_name_;
38 bool was_shown_;
39 NetworkError::ErrorState last_error_shown_;
40 base::Time error_screen_start_time_;
41 base::TimeDelta time_on_error_screens_;
44 } // namespace chromeos
46 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ERROR_SCREENS_HISTOGRAM_HELPER_H_