| 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 "chrome/browser/ui/ash/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" |
| 11 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 11 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 12 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" | 12 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" |
| 13 | 13 |
| 14 using bluez::BluezDBusManager; | 14 using bluez::BluezDBusManager; |
| 15 using bluez::FakeBluetoothAdapterClient; | 15 using bluez::FakeBluetoothAdapterClient; |
| 16 | 16 |
| 17 using TrayBluetoothHelperTest = ash::test::AshTestBase; | 17 namespace ash { |
| 18 namespace { |
| 19 |
| 20 using TrayBluetoothHelperTest = test::AshTestBase; |
| 18 | 21 |
| 19 // Tests basic functionality like turning Bluetooth on and off. | 22 // Tests basic functionality like turning Bluetooth on and off. |
| 20 TEST_F(TrayBluetoothHelperTest, Basics) { | 23 TEST_F(TrayBluetoothHelperTest, Basics) { |
| 21 // 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 |
| 22 // wait or use timers. | 25 // wait or use timers. |
| 23 FakeBluetoothAdapterClient* adapter_client = | 26 FakeBluetoothAdapterClient* adapter_client = |
| 24 static_cast<FakeBluetoothAdapterClient*>( | 27 static_cast<FakeBluetoothAdapterClient*>( |
| 25 BluezDBusManager::Get()->GetBluetoothAdapterClient()); | 28 BluezDBusManager::Get()->GetBluetoothAdapterClient()); |
| 26 adapter_client->SetSimulationIntervalMs(0); | 29 adapter_client->SetSimulationIntervalMs(0); |
| 27 | 30 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 51 helper.StopDiscovering(); | 54 helper.StopDiscovering(); |
| 52 RunAllPendingInMessageLoop(); | 55 RunAllPendingInMessageLoop(); |
| 53 EXPECT_FALSE(helper.HasDiscoverySession()); | 56 EXPECT_FALSE(helper.HasDiscoverySession()); |
| 54 EXPECT_FALSE(helper.IsDiscovering()); | 57 EXPECT_FALSE(helper.IsDiscovering()); |
| 55 | 58 |
| 56 // Turn Bluetooth off. | 59 // Turn Bluetooth off. |
| 57 helper.ToggleEnabled(); | 60 helper.ToggleEnabled(); |
| 58 RunAllPendingInMessageLoop(); | 61 RunAllPendingInMessageLoop(); |
| 59 EXPECT_FALSE(helper.GetEnabled()); | 62 EXPECT_FALSE(helper.GetEnabled()); |
| 60 } | 63 } |
| 64 |
| 65 } // namespace |
| 66 } // namespace ash |
| OLD | NEW |