OLD | NEW |
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 17 matching lines...) Expand all Loading... |
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.GetBluetoothAvailable()); | 34 EXPECT_TRUE(helper.GetBluetoothAvailable()); |
35 EXPECT_FALSE(helper.GetBluetoothEnabled()); | 35 EXPECT_FALSE(helper.GetBluetoothEnabled()); |
36 EXPECT_FALSE(helper.HasBluetoothDiscoverySession()); | 36 EXPECT_FALSE(helper.HasBluetoothDiscoverySession()); |
37 | 37 |
38 std::vector<ash::BluetoothDeviceInfo> devices; | 38 BluetoothDeviceList devices = helper.GetAvailableBluetoothDevices(); |
39 helper.GetAvailableBluetoothDevices(&devices); | |
40 // The devices are fake in tests, so don't assume any particular number. | 39 // The devices are fake in tests, so don't assume any particular number. |
41 EXPECT_FALSE(devices.empty()); | 40 EXPECT_FALSE(devices.empty()); |
42 | 41 |
43 // Turn Bluetooth on. | 42 // Turn Bluetooth on. |
44 helper.ToggleBluetoothEnabled(); | 43 helper.ToggleBluetoothEnabled(); |
45 RunAllPendingInMessageLoop(); | 44 RunAllPendingInMessageLoop(); |
46 EXPECT_TRUE(helper.GetBluetoothEnabled()); | 45 EXPECT_TRUE(helper.GetBluetoothEnabled()); |
47 | 46 |
48 helper.StartBluetoothDiscovering(); | 47 helper.StartBluetoothDiscovering(); |
49 RunAllPendingInMessageLoop(); | 48 RunAllPendingInMessageLoop(); |
50 EXPECT_TRUE(helper.HasBluetoothDiscoverySession()); | 49 EXPECT_TRUE(helper.HasBluetoothDiscoverySession()); |
51 | 50 |
52 helper.StopBluetoothDiscovering(); | 51 helper.StopBluetoothDiscovering(); |
53 RunAllPendingInMessageLoop(); | 52 RunAllPendingInMessageLoop(); |
54 EXPECT_FALSE(helper.HasBluetoothDiscoverySession()); | 53 EXPECT_FALSE(helper.HasBluetoothDiscoverySession()); |
55 | 54 |
56 // Turn Bluetooth off. | 55 // Turn Bluetooth off. |
57 helper.ToggleBluetoothEnabled(); | 56 helper.ToggleBluetoothEnabled(); |
58 RunAllPendingInMessageLoop(); | 57 RunAllPendingInMessageLoop(); |
59 EXPECT_FALSE(helper.GetBluetoothEnabled()); | 58 EXPECT_FALSE(helper.GetBluetoothEnabled()); |
60 } | 59 } |
61 | 60 |
62 } // namespace | 61 } // namespace |
63 } // namespace ash | 62 } // namespace ash |
OLD | NEW |