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

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

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: still need to check MessageLoop::current() in Mojo's RunLoopNestingObserver::GetForThread() Created 3 years, 7 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 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 base::Bind(&BluetoothAdvertisementBlueZTest::GetAdapterCallback, 86 base::Bind(&BluetoothAdvertisementBlueZTest::GetAdapterCallback,
87 base::Unretained(this))); 87 base::Unretained(this)));
88 base::RunLoop().Run(); 88 base::RunLoop().Run();
89 } 89 }
90 90
91 // Called whenever BluetoothAdapter is retrieved successfully. 91 // Called whenever BluetoothAdapter is retrieved successfully.
92 void GetAdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { 92 void GetAdapterCallback(scoped_refptr<BluetoothAdapter> adapter) {
93 adapter_ = adapter; 93 adapter_ = adapter;
94 ASSERT_NE(adapter_.get(), nullptr); 94 ASSERT_NE(adapter_.get(), nullptr);
95 ASSERT_TRUE(adapter_->IsInitialized()); 95 ASSERT_TRUE(adapter_->IsInitialized());
96 if (base::MessageLoop::current() && 96 if (base::RunLoop::IsRunningOnCurrentThread())
97 base::MessageLoop::current()->is_running()) {
98 base::MessageLoop::current()->QuitWhenIdle(); 97 base::MessageLoop::current()->QuitWhenIdle();
99 }
100 } 98 }
101 99
102 std::unique_ptr<BluetoothAdvertisement::Data> CreateAdvertisementData() { 100 std::unique_ptr<BluetoothAdvertisement::Data> CreateAdvertisementData() {
103 std::unique_ptr<BluetoothAdvertisement::Data> data = 101 std::unique_ptr<BluetoothAdvertisement::Data> data =
104 base::MakeUnique<BluetoothAdvertisement::Data>( 102 base::MakeUnique<BluetoothAdvertisement::Data>(
105 BluetoothAdvertisement::ADVERTISEMENT_TYPE_BROADCAST); 103 BluetoothAdvertisement::ADVERTISEMENT_TYPE_BROADCAST);
106 data->set_service_uuids( 104 data->set_service_uuids(
107 base::MakeUnique<BluetoothAdvertisement::UUIDList>()); 105 base::MakeUnique<BluetoothAdvertisement::UUIDList>());
108 data->set_manufacturer_data( 106 data->set_manufacturer_data(
109 base::MakeUnique<BluetoothAdvertisement::ManufacturerData>()); 107 base::MakeUnique<BluetoothAdvertisement::ManufacturerData>());
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 EXPECT_TRUE(advertisement); 273 EXPECT_TRUE(advertisement);
276 274
277 // Shutdown the default adapter. 275 // Shutdown the default adapter.
278 BluetoothAdapterFactory::Shutdown(); 276 BluetoothAdapterFactory::Shutdown();
279 277
280 UnregisterAdvertisement(advertisement); 278 UnregisterAdvertisement(advertisement);
281 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST); 279 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST);
282 } 280 }
283 281
284 } // namespace bluez 282 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc ('k') | device/bluetooth/bluez/bluetooth_bluez_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698