forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_system_tray_delegate.h
71 lines (56 loc) · 2.62 KB
/
test_system_tray_delegate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
#define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
#include "ash/common/system/tray/default_system_tray_delegate.h"
#include "base/macros.h"
#include "base/time/time.h"
namespace ash {
namespace test {
class TestSystemTrayDelegate : public DefaultSystemTrayDelegate {
public:
TestSystemTrayDelegate();
~TestSystemTrayDelegate() override;
// Sets whether a system update is required. Defaults to false. Static so
// tests can set the value before the system tray is constructed. Reset in
// AshTestHelper::TearDown.
static void SetSystemUpdateRequired(bool required);
// Changes the login status when initially the delegate is created. This will
// be called before AshTestBase::SetUp() to test the case when chrome is
// restarted right after the login (such like a flag is set).
// This value will be reset in AshTestHelper::TearDown, most test fixtures
// don't need to care its lifecycle.
static void SetInitialLoginStatus(LoginStatus login_status);
// Changes the current login status in the test. This also invokes
// UpdateAfterLoginStatusChange(). Usually this is called in the test code to
// set up a login status. This will fit to most of the test cases, but this
// cannot be set during the initialization. To test the initialization,
// consider using SetInitialLoginStatus() instead.
void SetLoginStatus(LoginStatus login_status);
void set_should_show_display_notification(bool should_show) {
should_show_display_notification_ = should_show;
}
// Updates the session length limit so that the limit will come from now in
// |new_limit|.
void SetSessionLengthLimitForTest(const base::TimeDelta& new_limit);
// Clears the session length limit.
void ClearSessionLengthLimit();
// Overridden from SystemTrayDelegate:
LoginStatus GetUserLoginStatus() const override;
bool IsUserSupervised() const override;
void GetSystemUpdateInfo(UpdateInfo* info) const override;
bool ShouldShowDisplayNotification() override;
bool GetSessionStartTime(base::TimeTicks* session_start_time) override;
bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) override;
void SignOut() override;
private:
bool should_show_display_notification_;
LoginStatus login_status_;
base::TimeDelta session_length_limit_;
bool session_length_limit_set_;
DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate);
};
} // namespace test
} // namespace ash
#endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_