Index: device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc |
diff --git a/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc |
index 3c7addf719a9a2030df75396cdb5a80e1cd9e66d..170c80636797b6799f26b8e6249e23be82aecbc3 100644 |
--- a/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc |
+++ b/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc |
@@ -279,4 +279,31 @@ TEST_F(BluetoothAdvertisementBlueZTest, UnregisterAfterAdapterShutdown) { |
ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST); |
} |
+TEST_F(BluetoothAdvertisementBlueZTest, ResetAdvertising) { |
+ bluez::FakeBluetoothLEAdvertisingManagerClient* adv_client = |
+ static_cast<bluez::FakeBluetoothLEAdvertisingManagerClient*>( |
+ bluez::BluezDBusManager::Get() |
+ ->GetBluetoothLEAdvertisingManagerClient()); |
+ |
+ // Creates and registers multiple advertisements. |
+ scoped_refptr<BluetoothAdvertisement> advertisement1 = CreateAdvertisement(); |
+ ExpectSuccess(); |
+ EXPECT_TRUE(advertisement1); |
+ scoped_refptr<BluetoothAdvertisement> advertisement2 = CreateAdvertisement(); |
+ ExpectSuccess(); |
+ EXPECT_TRUE(advertisement2); |
+ // There should be 2 currently registered advertisements. |
+ EXPECT_EQ(2, adv_client->currently_registered()); |
+ |
+ adapter_->ResetAdvertising( |
+ base::Bind(&BluetoothAdvertisementBlueZTest::Callback, |
+ base::Unretained(this)), |
+ base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback, |
+ base::Unretained(this))); |
+ ExpectSuccess(); |
+ |
+ // Checks that the advertisements have been cleared after ResetAdvertising. |
+ EXPECT_EQ(0, adv_client->currently_registered()); |
+} |
+ |
} // namespace bluez |