Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bluez/bluetooth_advertisement_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_advertisement_bluez.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 scoped_refptr<BluetoothAdvertisement> current_advertisement; | 227 scoped_refptr<BluetoothAdvertisement> current_advertisement; |
| 228 for (size_t i = 0; i < kMaxBluezAdvertisements; i++) { | 228 for (size_t i = 0; i < kMaxBluezAdvertisements; i++) { |
| 229 current_advertisement = CreateAdvertisement(); | 229 current_advertisement = CreateAdvertisement(); |
| 230 ExpectSuccess(); | 230 ExpectSuccess(); |
| 231 EXPECT_TRUE(current_advertisement); | 231 EXPECT_TRUE(current_advertisement); |
| 232 advertisements.emplace_back(std::move(current_advertisement)); | 232 advertisements.emplace_back(std::move(current_advertisement)); |
| 233 } | 233 } |
| 234 | 234 |
| 235 // The next advertisement should fail to register. | 235 // The next advertisement should fail to register. |
| 236 current_advertisement = CreateAdvertisement(); | 236 current_advertisement = CreateAdvertisement(); |
| 237 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_ALREADY_EXISTS); | 237 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_FAILED); |
|
rkc
2017/06/01 18:10:50
What's the difference between ALREADY_EXISTS and F
| |
| 238 EXPECT_FALSE(current_advertisement); | 238 EXPECT_FALSE(current_advertisement); |
| 239 } | 239 } |
| 240 | 240 |
| 241 TEST_F(BluetoothAdvertisementBlueZTest, DoubleUnregisterFailed) { | 241 TEST_F(BluetoothAdvertisementBlueZTest, DoubleUnregisterFailed) { |
| 242 scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement(); | 242 scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement(); |
| 243 ExpectSuccess(); | 243 ExpectSuccess(); |
| 244 EXPECT_TRUE(advertisement); | 244 EXPECT_TRUE(advertisement); |
| 245 | 245 |
| 246 UnregisterAdvertisement(advertisement); | 246 UnregisterAdvertisement(advertisement); |
| 247 ExpectSuccess(); | 247 ExpectSuccess(); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 273 EXPECT_TRUE(advertisement); | 273 EXPECT_TRUE(advertisement); |
| 274 | 274 |
| 275 // Shutdown the default adapter. | 275 // Shutdown the default adapter. |
| 276 BluetoothAdapterFactory::Shutdown(); | 276 BluetoothAdapterFactory::Shutdown(); |
| 277 | 277 |
| 278 UnregisterAdvertisement(advertisement); | 278 UnregisterAdvertisement(advertisement); |
| 279 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST); | 279 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace bluez | 282 } // namespace bluez |
| OLD | NEW |