Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ash / system / tray / test_system_tray_delegate.cc
blobbeef434485ed485ee1ba533332ea4baffa6f8d75
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/system/tray/test_system_tray_delegate.h"
7 #include <string>
9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h"
11 #include "ash/volume_control_delegate.h"
12 #include "base/utf_string_conversions.h"
13 #include "base/message_loop.h"
14 #include "base/string16.h"
15 #include "base/time.h"
17 namespace ash {
18 namespace test {
20 namespace {
22 class TestVolumeControlDelegate : public VolumeControlDelegate {
23 public:
24 TestVolumeControlDelegate() {}
25 virtual ~TestVolumeControlDelegate() {}
27 virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE {
28 return true;
30 virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE {
31 return true;
33 virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE {
34 return true;
36 virtual void SetVolumePercent(double percent) OVERRIDE {
38 virtual bool IsAudioMuted() const OVERRIDE {
39 return true;
41 virtual void SetAudioMuted(bool muted) OVERRIDE {
43 virtual float GetVolumeLevel() const OVERRIDE {
44 return 0.0;
46 virtual void SetVolumeLevel(float level) OVERRIDE {
49 private:
50 DISALLOW_COPY_AND_ASSIGN(TestVolumeControlDelegate);
53 } // namespace
55 TestSystemTrayDelegate::TestSystemTrayDelegate()
56 : wifi_enabled_(true),
57 cellular_enabled_(true),
58 bluetooth_enabled_(true),
59 caps_lock_enabled_(false),
60 volume_control_delegate_(
61 ALLOW_THIS_IN_INITIALIZER_LIST(new TestVolumeControlDelegate)) {
64 TestSystemTrayDelegate::~TestSystemTrayDelegate() {
67 void TestSystemTrayDelegate::Initialize() {
70 void TestSystemTrayDelegate::Shutdown() {
73 bool TestSystemTrayDelegate::GetTrayVisibilityOnStartup() {
74 return true;
77 // Overridden from SystemTrayDelegate:
78 const string16 TestSystemTrayDelegate::GetUserDisplayName() const {
79 return UTF8ToUTF16("Über tray Über tray Über tray Über tray");
82 const std::string TestSystemTrayDelegate::GetUserEmail() const {
83 return "über@tray";
86 const gfx::ImageSkia& TestSystemTrayDelegate::GetUserImage() const {
87 return null_image_;
90 user::LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const {
91 // At new user image screen manager->IsUserLoggedIn() would return true
92 // but there's no browser session available yet so use SessionStarted().
93 if (!Shell::GetInstance()->delegate()->IsSessionStarted())
94 return ash::user::LOGGED_IN_NONE;
95 if (Shell::GetInstance()->IsScreenLocked())
96 return user::LOGGED_IN_LOCKED;
97 // TODO(nkostylev): Support LOGGED_IN_OWNER, LOGGED_IN_GUEST, LOGGED_IN_KIOSK,
98 // LOGGED_IN_PUBLIC.
99 return user::LOGGED_IN_USER;
102 bool TestSystemTrayDelegate::IsOobeCompleted() const {
103 return true;
106 void TestSystemTrayDelegate::ChangeProfilePicture() {
109 const std::string TestSystemTrayDelegate::GetEnterpriseDomain() const {
110 return std::string();
113 const string16 TestSystemTrayDelegate::GetEnterpriseMessage() const {
114 return string16();
117 bool TestSystemTrayDelegate::SystemShouldUpgrade() const {
118 return true;
121 base::HourClockType TestSystemTrayDelegate::GetHourClockType() const {
122 return base::k24HourClock;
125 PowerSupplyStatus TestSystemTrayDelegate::GetPowerSupplyStatus() const {
126 return PowerSupplyStatus();
129 void TestSystemTrayDelegate::RequestStatusUpdate() const {
132 void TestSystemTrayDelegate::ShowSettings() {
135 void TestSystemTrayDelegate::ShowDateSettings() {
138 void TestSystemTrayDelegate::ShowNetworkSettings() {
141 void TestSystemTrayDelegate::ShowBluetoothSettings() {
144 void TestSystemTrayDelegate::ShowDisplaySettings() {
147 void TestSystemTrayDelegate::ShowDriveSettings() {
150 void TestSystemTrayDelegate::ShowIMESettings() {
153 void TestSystemTrayDelegate::ShowHelp() {
156 void TestSystemTrayDelegate::ShowAccessibilityHelp() {
159 void TestSystemTrayDelegate::ShowPublicAccountInfo() {
162 void TestSystemTrayDelegate::ShowEnterpriseInfo() {
165 void TestSystemTrayDelegate::ShutDown() {
166 MessageLoop::current()->Quit();
169 void TestSystemTrayDelegate::SignOut() {
170 MessageLoop::current()->Quit();
173 void TestSystemTrayDelegate::RequestLockScreen() {
176 void TestSystemTrayDelegate::RequestRestart() {
179 void TestSystemTrayDelegate::GetAvailableBluetoothDevices(
180 BluetoothDeviceList* list) {
183 void TestSystemTrayDelegate::BluetoothStartDiscovering() {
186 void TestSystemTrayDelegate::BluetoothStopDiscovering() {
189 void TestSystemTrayDelegate::ToggleBluetoothConnection(
190 const std::string& address) {
193 void TestSystemTrayDelegate::GetCurrentIME(IMEInfo* info) {
196 void TestSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) {
199 void TestSystemTrayDelegate::GetCurrentIMEProperties(
200 IMEPropertyInfoList* list) {
203 void TestSystemTrayDelegate::SwitchIME(const std::string& ime_id) {
206 void TestSystemTrayDelegate::ActivateIMEProperty(const std::string& key) {
209 void TestSystemTrayDelegate::CancelDriveOperation(const base::FilePath&) {
212 void TestSystemTrayDelegate::GetDriveOperationStatusList(
213 ash::DriveOperationStatusList*) {
216 void TestSystemTrayDelegate::GetMostRelevantNetworkIcon(NetworkIconInfo* info,
217 bool large) {
220 void TestSystemTrayDelegate::GetVirtualNetworkIcon(ash::NetworkIconInfo* info) {
223 void TestSystemTrayDelegate::GetAvailableNetworks(
224 std::vector<NetworkIconInfo>* list) {
227 void TestSystemTrayDelegate::GetVirtualNetworks(
228 std::vector<NetworkIconInfo>* list) {
231 void TestSystemTrayDelegate::ConnectToNetwork(const std::string& network_id) {
234 void TestSystemTrayDelegate::GetNetworkAddresses(
235 std::string* ip_address,
236 std::string* ethernet_mac_address,
237 std::string* wifi_mac_address) {
238 *ip_address = "127.0.0.1";
239 *ethernet_mac_address = "00:11:22:33:44:55";
240 *wifi_mac_address = "66:77:88:99:00:11";
243 void TestSystemTrayDelegate::RequestNetworkScan() {
246 void TestSystemTrayDelegate::AddBluetoothDevice() {
249 void TestSystemTrayDelegate::ToggleAirplaneMode() {
252 void TestSystemTrayDelegate::ToggleWifi() {
253 wifi_enabled_ = !wifi_enabled_;
256 void TestSystemTrayDelegate::ToggleMobile() {
257 cellular_enabled_ = !cellular_enabled_;
260 void TestSystemTrayDelegate::ToggleBluetooth() {
261 bluetooth_enabled_ = !bluetooth_enabled_;
264 bool TestSystemTrayDelegate::IsBluetoothDiscovering() {
265 return false;
268 void TestSystemTrayDelegate::ShowOtherWifi() {
271 void TestSystemTrayDelegate::ShowOtherVPN() {
274 void TestSystemTrayDelegate::ShowOtherCellular() {
277 bool TestSystemTrayDelegate::IsNetworkConnected() {
278 return true;
281 bool TestSystemTrayDelegate::GetWifiAvailable() {
282 return true;
285 bool TestSystemTrayDelegate::GetMobileAvailable() {
286 return true;
289 bool TestSystemTrayDelegate::GetBluetoothAvailable() {
290 return true;
293 bool TestSystemTrayDelegate::GetWifiEnabled() {
294 return wifi_enabled_;
297 bool TestSystemTrayDelegate::GetMobileEnabled() {
298 return cellular_enabled_;
301 bool TestSystemTrayDelegate::GetBluetoothEnabled() {
302 return bluetooth_enabled_;
305 bool TestSystemTrayDelegate::GetMobileScanSupported() {
306 return true;
309 bool TestSystemTrayDelegate::GetCellularCarrierInfo(std::string* carrier_id,
310 std::string* topup_url,
311 std::string* setup_url) {
312 return false;
315 bool TestSystemTrayDelegate::GetWifiScanning() {
316 return false;
319 bool TestSystemTrayDelegate::GetCellularInitializing() {
320 return false;
323 void TestSystemTrayDelegate::ShowCellularURL(const std::string& url) {
326 void TestSystemTrayDelegate::ChangeProxySettings() {
329 VolumeControlDelegate* TestSystemTrayDelegate::GetVolumeControlDelegate()
330 const {
331 return volume_control_delegate_.get();
334 void TestSystemTrayDelegate::SetVolumeControlDelegate(
335 scoped_ptr<VolumeControlDelegate> delegate) {
336 volume_control_delegate_ = delegate.Pass();
339 bool TestSystemTrayDelegate::GetSessionStartTime(
340 base::TimeTicks* session_start_time) {
341 return false;
344 bool TestSystemTrayDelegate::GetSessionLengthLimit(
345 base::TimeDelta* session_length_limit) {
346 return false;
349 int TestSystemTrayDelegate::GetSystemTrayMenuWidth() {
350 // This is the default width for English languages.
351 return 300;
354 string16 TestSystemTrayDelegate::FormatTimeDuration(
355 const base::TimeDelta& delta) const {
356 return string16();
359 void TestSystemTrayDelegate::MaybeSpeak(const std::string& utterance) const {
362 } // namespace test
363 } // namespace ash