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

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

Issue 2420783002: mustash: Convert TraySupervisedUserTest to AshTest (Closed)
Patch Set: typo Created 4 years, 2 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/common/test/ash_test.cc ('k') | ash/common/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_COMMON_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ 5 #ifndef ASH_COMMON_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
6 #define ASH_COMMON_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ 6 #define ASH_COMMON_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
7 7
8 #include "ash/common/system/tray/default_system_tray_delegate.h" 8 #include "ash/common/system/tray/default_system_tray_delegate.h"
9 #include "ash/common/system/tray/ime_info.h" 9 #include "ash/common/system/tray/ime_info.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 DefaultSystemTrayDelegate { 16 class TestSystemTrayDelegate : public DefaultSystemTrayDelegate {
17 public: 17 public:
18 TestSystemTrayDelegate(); 18 TestSystemTrayDelegate();
19 ~TestSystemTrayDelegate() override; 19 ~TestSystemTrayDelegate() override;
20 20
21 // Sets whether a system update is required. Defaults to false. Static so 21 // Sets whether a system update is required. Defaults to false. Static so
22 // tests can set the value before the system tray is constructed. Reset in 22 // tests can set the value before the system tray is constructed. Reset in
23 // AshTestHelper::TearDown. 23 // AshTestHelper::TearDown.
24 static void SetSystemUpdateRequired(bool required); 24 static void SetSystemUpdateRequired(bool required);
25 25
26 // Changes the login status when initially the delegate is created. This will
27 // be called before AshTestBase::SetUp() to test the case when chrome is
28 // restarted right after the login (such like a flag is set).
29 // This value will be reset in AshTestHelper::TearDown, most test fixtures
30 // don't need to care its lifecycle.
31 static void SetInitialLoginStatus(LoginStatus login_status);
32
33 // Changes the current login status in the test. This also invokes 26 // Changes the current login status in the test. This also invokes
34 // UpdateAfterLoginStatusChange(). Usually this is called in the test code to 27 // UpdateAfterLoginStatusChange(). Usually this is called in the test code to
35 // set up a login status. This will fit to most of the test cases, but this 28 // set up a login status. This will fit to most of the test cases, but this
36 // cannot be set during the initialization. To test the initialization, 29 // cannot be set during the initialization. To test the initialization,
37 // consider using SetInitialLoginStatus() instead. 30 // consider using SetInitialLoginStatus() instead.
38 void SetLoginStatus(LoginStatus login_status); 31 void SetLoginStatus(LoginStatus login_status);
39 32
40 // Updates the session length limit so that the limit will come from now in 33 // Updates the session length limit so that the limit will come from now in
41 // |new_limit|. 34 // |new_limit|.
42 void SetSessionLengthLimitForTest(const base::TimeDelta& new_limit); 35 void SetSessionLengthLimitForTest(const base::TimeDelta& new_limit);
(...skipping 20 matching lines...) Expand all
63 private: 56 private:
64 LoginStatus login_status_; 57 LoginStatus login_status_;
65 base::TimeDelta session_length_limit_; 58 base::TimeDelta session_length_limit_;
66 bool session_length_limit_set_; 59 bool session_length_limit_set_;
67 IMEInfo current_ime_; 60 IMEInfo current_ime_;
68 IMEInfoList ime_list_; 61 IMEInfoList ime_list_;
69 62
70 DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate); 63 DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate);
71 }; 64 };
72 65
66 // Changes the initial login status before TestSystemTrayDelegate is created.
67 // Allows testing the case when chrome is restarted right after login (such as a
msw 2016/10/14 16:10:29 nit: "such as when a flag is set" or some better w
James Cook 2016/10/14 16:32:53 Done.
68 // flag is set).
69 class ScopedInitialLoginStatus {
70 public:
71 explicit ScopedInitialLoginStatus(LoginStatus status);
72 ~ScopedInitialLoginStatus();
73
74 private:
75 LoginStatus old_status_;
76
77 DISALLOW_COPY_AND_ASSIGN(ScopedInitialLoginStatus);
78 };
79
73 } // namespace test 80 } // namespace test
74 } // namespace ash 81 } // namespace ash
75 82
76 #endif // ASH_COMMON_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_ 83 #endif // ASH_COMMON_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
OLDNEW
« no previous file with comments | « ash/common/test/ash_test.cc ('k') | ash/common/test/test_system_tray_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698