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

Side by Side Diff: ash/common/system/chromeos/bluetooth/tray_bluetooth_helper_unittest.cc

Issue 2761993002: cros: Eliminate bluetooth methods from SystemTrayDelegate (Closed)
Patch Set: review comments 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/system/chromeos/bluetooth/tray_bluetooth_helper.h" 5 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/common/system/tray/system_tray_delegate.h" 9 #include "ash/common/system/tray/system_tray_delegate.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 13 matching lines...) Expand all
24 // Set Bluetooth discovery simulation delay to 0 so the test doesn't have to 24 // Set Bluetooth discovery simulation delay to 0 so the test doesn't have to
25 // wait or use timers. 25 // wait or use timers.
26 FakeBluetoothAdapterClient* adapter_client = 26 FakeBluetoothAdapterClient* adapter_client =
27 static_cast<FakeBluetoothAdapterClient*>( 27 static_cast<FakeBluetoothAdapterClient*>(
28 BluezDBusManager::Get()->GetBluetoothAdapterClient()); 28 BluezDBusManager::Get()->GetBluetoothAdapterClient());
29 adapter_client->SetSimulationIntervalMs(0); 29 adapter_client->SetSimulationIntervalMs(0);
30 30
31 TrayBluetoothHelper helper; 31 TrayBluetoothHelper helper;
32 helper.Initialize(); 32 helper.Initialize();
33 RunAllPendingInMessageLoop(); 33 RunAllPendingInMessageLoop();
34 EXPECT_TRUE(helper.GetAvailable()); 34 EXPECT_TRUE(helper.GetBluetoothAvailable());
35 EXPECT_FALSE(helper.GetEnabled()); 35 EXPECT_FALSE(helper.GetBluetoothEnabled());
36 EXPECT_FALSE(helper.HasDiscoverySession()); 36 EXPECT_FALSE(helper.HasBluetoothDiscoverySession());
37 EXPECT_FALSE(helper.IsDiscovering());
38 37
39 std::vector<ash::BluetoothDeviceInfo> devices; 38 std::vector<ash::BluetoothDeviceInfo> devices;
40 helper.GetAvailableDevices(&devices); 39 helper.GetAvailableBluetoothDevices(&devices);
41 // The devices are fake in tests, so don't assume any particular number. 40 // The devices are fake in tests, so don't assume any particular number.
42 EXPECT_FALSE(devices.empty()); 41 EXPECT_FALSE(devices.empty());
43 42
44 // Turn Bluetooth on. 43 // Turn Bluetooth on.
45 helper.ToggleEnabled(); 44 helper.ToggleBluetoothEnabled();
46 RunAllPendingInMessageLoop(); 45 RunAllPendingInMessageLoop();
47 EXPECT_TRUE(helper.GetEnabled()); 46 EXPECT_TRUE(helper.GetBluetoothEnabled());
48 47
49 helper.StartDiscovering(); 48 helper.StartBluetoothDiscovering();
50 RunAllPendingInMessageLoop(); 49 RunAllPendingInMessageLoop();
51 EXPECT_TRUE(helper.HasDiscoverySession()); 50 EXPECT_TRUE(helper.HasBluetoothDiscoverySession());
52 EXPECT_TRUE(helper.IsDiscovering());
53 51
54 helper.StopDiscovering(); 52 helper.StopBluetoothDiscovering();
55 RunAllPendingInMessageLoop(); 53 RunAllPendingInMessageLoop();
56 EXPECT_FALSE(helper.HasDiscoverySession()); 54 EXPECT_FALSE(helper.HasBluetoothDiscoverySession());
57 EXPECT_FALSE(helper.IsDiscovering());
58 55
59 // Turn Bluetooth off. 56 // Turn Bluetooth off.
60 helper.ToggleEnabled(); 57 helper.ToggleBluetoothEnabled();
61 RunAllPendingInMessageLoop(); 58 RunAllPendingInMessageLoop();
62 EXPECT_FALSE(helper.GetEnabled()); 59 EXPECT_FALSE(helper.GetBluetoothEnabled());
63 } 60 }
64 61
65 } // namespace 62 } // namespace
66 } // namespace ash 63 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/bluetooth/tray_bluetooth_helper.cc ('k') | ash/common/system/tray/default_system_tray_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698