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_
10 #include "base/gtest_prod_util.h"
11 #include "base/time/time.h"
12 #include "chrome/browser/chromeos/login/screens/network_error.h"
15 FORWARD_DECLARE_TEST(ErrorScreensHistogramHelperTest
, TestShowHideTime
);
16 FORWARD_DECLARE_TEST(ErrorScreensHistogramHelperTest
, TestShowHideShowHideTime
);
17 FORWARD_DECLARE_TEST(ErrorScreensHistogramHelperTest
, TestShowShowHideTime
);
19 class ErrorScreensHistogramHelper
{
21 explicit ErrorScreensHistogramHelper(const std::string
& screen_name
);
23 void OnErrorShow(NetworkError::ErrorState error
);
25 ~ErrorScreensHistogramHelper();
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_
;
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_