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

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

Issue 2761373002: Move yet more from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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/test_shelf_delegate.cc ('k') | ash/common/wallpaper/wallpaper_view.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 #include "ash/common/test/test_system_tray_delegate.h" 5 #include "ash/common/test/test_system_tray_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/common/login_status.h" 9 #include "ash/common/login_status.h"
10 #include "ash/common/session/session_controller.h" 10 #include "ash/common/session/session_controller.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "ash/shell.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 14
14 namespace ash { 15 namespace ash {
15 namespace test { 16 namespace test {
16 17
17 namespace { 18 namespace {
18 19
19 LoginStatus g_initial_status = LoginStatus::USER; 20 LoginStatus g_initial_status = LoginStatus::USER;
20 21
21 } // namespace 22 } // namespace
22 23
23 TestSystemTrayDelegate::TestSystemTrayDelegate() 24 TestSystemTrayDelegate::TestSystemTrayDelegate()
24 : login_status_(g_initial_status), session_length_limit_set_(false) {} 25 : login_status_(g_initial_status), session_length_limit_set_(false) {}
25 26
26 TestSystemTrayDelegate::~TestSystemTrayDelegate() {} 27 TestSystemTrayDelegate::~TestSystemTrayDelegate() {}
27 28
28 void TestSystemTrayDelegate::SetLoginStatus(LoginStatus login_status) { 29 void TestSystemTrayDelegate::SetLoginStatus(LoginStatus login_status) {
29 login_status_ = login_status; 30 login_status_ = login_status;
30 WmShell::Get()->UpdateAfterLoginStatusChange(login_status); 31 Shell::Get()->UpdateAfterLoginStatusChange(login_status);
31 } 32 }
32 33
33 void TestSystemTrayDelegate::SetSessionLengthLimitForTest( 34 void TestSystemTrayDelegate::SetSessionLengthLimitForTest(
34 const base::TimeDelta& new_limit) { 35 const base::TimeDelta& new_limit) {
35 session_length_limit_ = new_limit; 36 session_length_limit_ = new_limit;
36 session_length_limit_set_ = true; 37 session_length_limit_set_ = true;
37 } 38 }
38 39
39 void TestSystemTrayDelegate::ClearSessionLengthLimit() { 40 void TestSystemTrayDelegate::ClearSessionLengthLimit() {
40 session_length_limit_set_ = false; 41 session_length_limit_set_ = false;
41 } 42 }
42 43
43 void TestSystemTrayDelegate::SetCurrentIME(const IMEInfo& info) { 44 void TestSystemTrayDelegate::SetCurrentIME(const IMEInfo& info) {
44 current_ime_ = info; 45 current_ime_ = info;
45 } 46 }
46 47
47 void TestSystemTrayDelegate::SetAvailableIMEList(const IMEInfoList& list) { 48 void TestSystemTrayDelegate::SetAvailableIMEList(const IMEInfoList& list) {
48 ime_list_ = list; 49 ime_list_ = list;
49 } 50 }
50 51
51 LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const { 52 LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const {
52 // Initial login status has been changed for testing. 53 // Initial login status has been changed for testing.
53 if (g_initial_status != LoginStatus::USER && 54 if (g_initial_status != LoginStatus::USER &&
54 g_initial_status == login_status_) { 55 g_initial_status == login_status_) {
55 return login_status_; 56 return login_status_;
56 } 57 }
57 58
58 // At new user image screen manager->IsUserLoggedIn() would return true 59 // At new user image screen manager->IsUserLoggedIn() would return true
59 // but there's no browser session available yet so use SessionStarted(). 60 // but there's no browser session available yet so use SessionStarted().
60 SessionController* controller = WmShell::Get()->session_controller(); 61 SessionController* controller = Shell::Get()->session_controller();
61 62
62 if (!controller->IsActiveUserSessionStarted()) 63 if (!controller->IsActiveUserSessionStarted())
63 return LoginStatus::NOT_LOGGED_IN; 64 return LoginStatus::NOT_LOGGED_IN;
64 if (controller->IsScreenLocked()) 65 if (controller->IsScreenLocked())
65 return LoginStatus::LOCKED; 66 return LoginStatus::LOCKED;
66 return login_status_; 67 return login_status_;
67 } 68 }
68 69
69 bool TestSystemTrayDelegate::IsUserSupervised() const { 70 bool TestSystemTrayDelegate::IsUserSupervised() const {
70 return login_status_ == LoginStatus::SUPERVISED; 71 return login_status_ == LoginStatus::SUPERVISED;
(...skipping 29 matching lines...) Expand all
100 : old_status_(g_initial_status) { 101 : old_status_(g_initial_status) {
101 g_initial_status = new_status; 102 g_initial_status = new_status;
102 } 103 }
103 104
104 ScopedInitialLoginStatus::~ScopedInitialLoginStatus() { 105 ScopedInitialLoginStatus::~ScopedInitialLoginStatus() {
105 g_initial_status = old_status_; 106 g_initial_status = old_status_;
106 } 107 }
107 108
108 } // namespace test 109 } // namespace test
109 } // namespace ash 110 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/test/test_shelf_delegate.cc ('k') | ash/common/wallpaper/wallpaper_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698