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

Side by Side Diff: device/bluetooth/bluetooth_device_unittest.cc

Issue 2009753002: bluetooth: Make public BluetoothDevice::GetName method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out name/alias Created 4 years, 5 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
« no previous file with comments | « device/bluetooth/bluetooth_device_android.cc ('k') | device/bluetooth/bluetooth_device_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/bluetooth/bluetooth_device.h" 5 #include "device/bluetooth/bluetooth_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 InitWithFakeAdapter(); 111 InitWithFakeAdapter();
112 StartLowEnergyDiscoverySession(); 112 StartLowEnergyDiscoverySession();
113 BluetoothDevice* device = SimulateLowEnergyDevice(3); 113 BluetoothDevice* device = SimulateLowEnergyDevice(3);
114 ASSERT_TRUE(device); 114 ASSERT_TRUE(device);
115 BluetoothDevice::UUIDList uuids = device->GetUUIDs(); 115 BluetoothDevice::UUIDList uuids = device->GetUUIDs();
116 EXPECT_EQ(0u, uuids.size()); 116 EXPECT_EQ(0u, uuids.size());
117 } 117 }
118 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) 118 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
119 119
120 #if defined(OS_ANDROID) 120 #if defined(OS_ANDROID) || defined(OS_MACOSX)
121 // GetDeviceName for Device with no name. 121 // GetName for Device with no name.
122 TEST_F(BluetoothTest, GetDeviceName_NullName) { 122 TEST_F(BluetoothTest, GetName_NullName) {
123 if (!PlatformSupportsLowEnergy()) { 123 if (!PlatformSupportsLowEnergy()) {
124 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; 124 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
125 return; 125 return;
126 } 126 }
127 InitWithFakeAdapter(); 127 InitWithFakeAdapter();
128 StartLowEnergyDiscoverySession(); 128 StartLowEnergyDiscoverySession();
129 BluetoothDevice* device = SimulateLowEnergyDevice(5); 129 BluetoothDevice* device = SimulateLowEnergyDevice(5);
130 EXPECT_EQ("", device->GetDeviceName()); 130 EXPECT_FALSE(device->GetName());
131 } 131 }
132 #endif // defined(OS_ANDROID) 132 #endif // defined(OS_ANDROID) || defined(OS_MACOSX)
133 133
134 // TODO(scheib): Test with a device with no name. http://crbug.com/506415 134 // TODO(506415): Test GetNameForDisplay with a device with no name.
135 // BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which 135 // BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which
136 // requires string resources to be loaded. For that, something like 136 // requires string resources to be loaded. For that, something like
137 // InitSharedInstance must be run. See unittest files that call that. It will 137 // InitSharedInstance must be run. See unittest files that call that. It will
138 // also require build configuration to generate string resources into a .pak 138 // also require build configuration to generate string resources into a .pak
139 // file. 139 // file.
140 140
141 #if defined(OS_ANDROID) || defined(OS_MACOSX) 141 #if defined(OS_ANDROID) || defined(OS_MACOSX)
142 // Basic CreateGattConnection test. 142 // Basic CreateGattConnection test.
143 TEST_F(BluetoothTest, CreateGattConnection) { 143 TEST_F(BluetoothTest, CreateGattConnection) {
144 if (!PlatformSupportsLowEnergy()) { 144 if (!PlatformSupportsLowEnergy()) {
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 655
656 BluetoothDevice* device2 = SimulateLowEnergyDevice(6); 656 BluetoothDevice* device2 = SimulateLowEnergyDevice(6);
657 EXPECT_EQ(BLUETOOTH_TRANSPORT_DUAL, device2->GetType()); 657 EXPECT_EQ(BLUETOOTH_TRANSPORT_DUAL, device2->GetType());
658 658
659 BluetoothDevice* device3 = SimulateClassicDevice(); 659 BluetoothDevice* device3 = SimulateClassicDevice();
660 EXPECT_EQ(BLUETOOTH_TRANSPORT_CLASSIC, device3->GetType()); 660 EXPECT_EQ(BLUETOOTH_TRANSPORT_CLASSIC, device3->GetType());
661 } 661 }
662 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) 662 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
663 663
664 } // namespace device 664 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_android.cc ('k') | device/bluetooth/bluetooth_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698