Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: ash/test/test_system_tray_delegate.h

Issue 2829813002: cros: Move IsUserSupervised and IsUserChild off SystemTrayDelegate (Closed)
Patch Set: review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/test/test_session_controller_client.cc ('k') | ash/test/test_system_tray_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ 5 #ifndef ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
6 #define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ 6 #define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
7 7
8 #include "ash/system/tray/ime_info.h" 8 #include "ash/system/tray/ime_info.h"
9 #include "ash/system/tray/system_tray_delegate.h" 9 #include "ash/system/tray/system_tray_delegate.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 12
13 namespace ash { 13 namespace ash {
14 namespace test { 14 namespace test {
15 15
16 class TestSystemTrayDelegate : public SystemTrayDelegate { 16 class TestSystemTrayDelegate : public SystemTrayDelegate {
17 public: 17 public:
18 TestSystemTrayDelegate(); 18 TestSystemTrayDelegate();
19 ~TestSystemTrayDelegate() override; 19 ~TestSystemTrayDelegate() override;
20 20
21 // Changes the current login status in the test. This also invokes 21 // Changes the current login status in the test. This also invokes
22 // UpdateAfterLoginStatusChange(). Usually this is called in the test code to 22 // UpdateAfterLoginStatusChange(). Usually this is called in the test code to
23 // set up a login status. This will fit to most of the test cases, but this 23 // set up a login status. This will fit to most of the test cases, but this
24 // cannot be set during the initialization. To test the initialization, 24 // cannot be set during the initialization. To test the initialization,
25 // consider using SetInitialLoginStatus() instead. 25 // consider using SetInitialLoginStatus() instead.
26 // TODO(jamescook): Eliminate this method and |login_status_|.
26 void SetLoginStatus(LoginStatus login_status); 27 void SetLoginStatus(LoginStatus login_status);
27 28
28 // Updates the session length limit so that the limit will come from now in 29 // Updates the session length limit so that the limit will come from now in
29 // |new_limit|. 30 // |new_limit|.
30 void SetSessionLengthLimitForTest(const base::TimeDelta& new_limit); 31 void SetSessionLengthLimitForTest(const base::TimeDelta& new_limit);
31 32
32 // Clears the session length limit. 33 // Clears the session length limit.
33 void ClearSessionLengthLimit(); 34 void ClearSessionLengthLimit();
34 35
35 // Sets the IME info. 36 // Sets the IME info.
36 void SetCurrentIME(const IMEInfo& info); 37 void SetCurrentIME(const IMEInfo& info);
37 38
38 // Sets the list of available IMEs. 39 // Sets the list of available IMEs.
39 void SetAvailableIMEList(const IMEInfoList& list); 40 void SetAvailableIMEList(const IMEInfoList& list);
40 41
41 // SystemTrayDelegate: 42 // SystemTrayDelegate:
42 LoginStatus GetUserLoginStatus() const override; 43 LoginStatus GetUserLoginStatus() const override;
43 std::string GetSupervisedUserManager() const override; 44 std::string GetSupervisedUserManager() const override;
44 bool IsUserSupervised() const override;
45 bool GetSessionStartTime(base::TimeTicks* session_start_time) override; 45 bool GetSessionStartTime(base::TimeTicks* session_start_time) override;
46 bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) override; 46 bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) override;
47 void GetCurrentIME(IMEInfo* info) override; 47 void GetCurrentIME(IMEInfo* info) override;
48 void GetAvailableIMEList(IMEInfoList* list) override; 48 void GetAvailableIMEList(IMEInfoList* list) override;
49 49
50 private: 50 private:
51 LoginStatus login_status_; 51 LoginStatus login_status_;
52 base::TimeDelta session_length_limit_; 52 base::TimeDelta session_length_limit_;
53 bool session_length_limit_set_; 53 bool session_length_limit_set_;
54 IMEInfo current_ime_; 54 IMEInfo current_ime_;
55 IMEInfoList ime_list_; 55 IMEInfoList ime_list_;
56 56
57 DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate); 57 DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate);
58 }; 58 };
59 59
60 // Changes the initial login status before TestSystemTrayDelegate is created.
61 // Allows testing the case when chrome is restarted right after login (such as
62 // when a flag is set).
63 class ScopedInitialLoginStatus {
64 public:
65 explicit ScopedInitialLoginStatus(LoginStatus status);
66 ~ScopedInitialLoginStatus();
67
68 private:
69 LoginStatus old_status_;
70
71 DISALLOW_COPY_AND_ASSIGN(ScopedInitialLoginStatus);
72 };
73
74 } // namespace test 60 } // namespace test
75 } // namespace ash 61 } // namespace ash
76 62
77 #endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ 63 #endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
OLDNEW
« no previous file with comments | « ash/test/test_session_controller_client.cc ('k') | ash/test/test_system_tray_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698