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

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: rebase 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()); 37 EXPECT_FALSE(helper.IsBluetoothDiscovering());
38 38
39 std::vector<ash::BluetoothDeviceInfo> devices; 39 std::vector<ash::BluetoothDeviceInfo> devices;
40 helper.GetAvailableDevices(&devices); 40 helper.GetAvailableBluetoothDevices(&devices);
41 // The devices are fake in tests, so don't assume any particular number. 41 // The devices are fake in tests, so don't assume any particular number.
42 EXPECT_FALSE(devices.empty()); 42 EXPECT_FALSE(devices.empty());
43 43
44 // Turn Bluetooth on. 44 // Turn Bluetooth on.
45 helper.ToggleEnabled(); 45 helper.ToggleBluetoothEnabled();
46 RunAllPendingInMessageLoop(); 46 RunAllPendingInMessageLoop();
47 EXPECT_TRUE(helper.GetEnabled()); 47 EXPECT_TRUE(helper.GetBluetoothEnabled());
48 48
49 helper.StartDiscovering(); 49 helper.StartBluetoothDiscovering();
50 RunAllPendingInMessageLoop(); 50 RunAllPendingInMessageLoop();
51 EXPECT_TRUE(helper.HasDiscoverySession()); 51 EXPECT_TRUE(helper.HasBluetoothDiscoverySession());
52 EXPECT_TRUE(helper.IsDiscovering()); 52 EXPECT_TRUE(helper.IsBluetoothDiscovering());
53 53
54 helper.StopDiscovering(); 54 helper.StopBluetoothDiscovering();
55 RunAllPendingInMessageLoop(); 55 RunAllPendingInMessageLoop();
56 EXPECT_FALSE(helper.HasDiscoverySession()); 56 EXPECT_FALSE(helper.HasBluetoothDiscoverySession());
57 EXPECT_FALSE(helper.IsDiscovering()); 57 EXPECT_FALSE(helper.IsBluetoothDiscovering());
58 58
59 // Turn Bluetooth off. 59 // Turn Bluetooth off.
60 helper.ToggleEnabled(); 60 helper.ToggleBluetoothEnabled();
61 RunAllPendingInMessageLoop(); 61 RunAllPendingInMessageLoop();
62 EXPECT_FALSE(helper.GetEnabled()); 62 EXPECT_FALSE(helper.GetBluetoothEnabled());
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 } // namespace ash 66 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698