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

Side by Side Diff: device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc

Issue 2311093005: Remove calls to deprecated MessageLoop methods in device. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | device/bluetooth/bluez/bluetooth_audio_sink_bluez_unittest.cc » ('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 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Clear the last advertisement we created. 117 // Clear the last advertisement we created.
118 advertisement_ = nullptr; 118 advertisement_ = nullptr;
119 119
120 adapter_->RegisterAdvertisement( 120 adapter_->RegisterAdvertisement(
121 CreateAdvertisementData(), 121 CreateAdvertisementData(),
122 base::Bind(&BluetoothAdvertisementBlueZTest::RegisterCallback, 122 base::Bind(&BluetoothAdvertisementBlueZTest::RegisterCallback,
123 base::Unretained(this)), 123 base::Unretained(this)),
124 base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback, 124 base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback,
125 base::Unretained(this))); 125 base::Unretained(this)));
126 126
127 message_loop_.RunUntilIdle(); 127 base::RunLoop().RunUntilIdle();
128 return advertisement_; 128 return advertisement_;
129 } 129 }
130 130
131 void UnregisterAdvertisement( 131 void UnregisterAdvertisement(
132 scoped_refptr<BluetoothAdvertisement> advertisement) { 132 scoped_refptr<BluetoothAdvertisement> advertisement) {
133 advertisement->Unregister( 133 advertisement->Unregister(
134 base::Bind(&BluetoothAdvertisementBlueZTest::Callback, 134 base::Bind(&BluetoothAdvertisementBlueZTest::Callback,
135 base::Unretained(this)), 135 base::Unretained(this)),
136 base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback, 136 base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback,
137 base::Unretained(this))); 137 base::Unretained(this)));
138 138
139 message_loop_.RunUntilIdle(); 139 base::RunLoop().RunUntilIdle();
140 } 140 }
141 141
142 void TriggerReleased(scoped_refptr<BluetoothAdvertisement> advertisement) { 142 void TriggerReleased(scoped_refptr<BluetoothAdvertisement> advertisement) {
143 BluetoothAdvertisementBlueZ* adv = 143 BluetoothAdvertisementBlueZ* adv =
144 static_cast<BluetoothAdvertisementBlueZ*>(advertisement.get()); 144 static_cast<BluetoothAdvertisementBlueZ*>(advertisement.get());
145 bluez::FakeBluetoothLEAdvertisementServiceProvider* provider = 145 bluez::FakeBluetoothLEAdvertisementServiceProvider* provider =
146 static_cast<bluez::FakeBluetoothLEAdvertisementServiceProvider*>( 146 static_cast<bluez::FakeBluetoothLEAdvertisementServiceProvider*>(
147 adv->provider()); 147 adv->provider());
148 provider->Release(); 148 provider->Release();
149 } 149 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 TriggerReleased(advertisement); 241 TriggerReleased(advertisement);
242 EXPECT_TRUE(observer_->released()); 242 EXPECT_TRUE(observer_->released());
243 243
244 // Unregistering an advertisement that has been released should give us an 244 // Unregistering an advertisement that has been released should give us an
245 // error. 245 // error.
246 UnregisterAdvertisement(advertisement); 246 UnregisterAdvertisement(advertisement);
247 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST); 247 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST);
248 } 248 }
249 249
250 } // namespace bluez 250 } // namespace bluez
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluez/bluetooth_audio_sink_bluez_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698