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

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

Issue 2148943002: mash: Create system tray display and rotation lock items via delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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/test/test_system_tray_delegate.h" 5 #include "ash/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_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 15
16 #if defined(OS_CHROMEOS)
17 #include "ash/system/chromeos/tray_display.h"
18 #include "base/memory/ptr_util.h"
19 #endif
20
16 namespace ash { 21 namespace ash {
17 namespace test { 22 namespace test {
18 23
19 namespace { 24 namespace {
20 25
21 bool g_system_update_required = false; 26 bool g_system_update_required = false;
22 LoginStatus g_initial_status = LoginStatus::USER; 27 LoginStatus g_initial_status = LoginStatus::USER;
23 28
24 } // namespace 29 } // namespace
25 30
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return login_status_ == LoginStatus::SUPERVISED; 82 return login_status_ == LoginStatus::SUPERVISED;
78 } 83 }
79 84
80 void TestSystemTrayDelegate::GetSystemUpdateInfo(UpdateInfo* info) const { 85 void TestSystemTrayDelegate::GetSystemUpdateInfo(UpdateInfo* info) const {
81 DCHECK(info); 86 DCHECK(info);
82 info->severity = UpdateInfo::UPDATE_NORMAL; 87 info->severity = UpdateInfo::UPDATE_NORMAL;
83 info->update_required = g_system_update_required; 88 info->update_required = g_system_update_required;
84 info->factory_reset_required = false; 89 info->factory_reset_required = false;
85 } 90 }
86 91
92 std::unique_ptr<ash::SystemTrayItem>
93 TestSystemTrayDelegate::CreateDisplayTrayItem(SystemTray* tray) {
94 #if defined(OS_CHROMEOS)
95 return base::WrapUnique(new TrayDisplay(tray));
msw 2016/07/13 18:51:49 nit: MakeUnique
James Cook 2016/07/13 21:30:46 Done.
96 #else
97 return nullptr;
98 #endif
99 }
100
87 bool TestSystemTrayDelegate::ShouldShowDisplayNotification() { 101 bool TestSystemTrayDelegate::ShouldShowDisplayNotification() {
88 return should_show_display_notification_; 102 return should_show_display_notification_;
89 } 103 }
90 104
91 bool TestSystemTrayDelegate::GetSessionStartTime( 105 bool TestSystemTrayDelegate::GetSessionStartTime(
92 base::TimeTicks* session_start_time) { 106 base::TimeTicks* session_start_time) {
93 // Just returns TimeTicks::Now(), so the remaining time is always the 107 // Just returns TimeTicks::Now(), so the remaining time is always the
94 // specified limit. This is useful for testing. 108 // specified limit. This is useful for testing.
95 if (session_length_limit_set_) 109 if (session_length_limit_set_)
96 *session_start_time = base::TimeTicks::Now(); 110 *session_start_time = base::TimeTicks::Now();
97 return session_length_limit_set_; 111 return session_length_limit_set_;
98 } 112 }
99 113
100 bool TestSystemTrayDelegate::GetSessionLengthLimit( 114 bool TestSystemTrayDelegate::GetSessionLengthLimit(
101 base::TimeDelta* session_length_limit) { 115 base::TimeDelta* session_length_limit) {
102 if (session_length_limit_set_) 116 if (session_length_limit_set_)
103 *session_length_limit = session_length_limit_; 117 *session_length_limit = session_length_limit_;
104 return session_length_limit_set_; 118 return session_length_limit_set_;
105 } 119 }
106 120
107 void TestSystemTrayDelegate::SignOut() { 121 void TestSystemTrayDelegate::SignOut() {
108 base::MessageLoop::current()->QuitWhenIdle(); 122 base::MessageLoop::current()->QuitWhenIdle();
109 } 123 }
110 124
111 } // namespace test 125 } // namespace test
112 } // namespace ash 126 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698