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

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

Issue 1544323002: Convert Pass()→std::move() in //device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 adapter_ = adapter; 86 adapter_ = adapter;
87 ASSERT_NE(adapter_.get(), nullptr); 87 ASSERT_NE(adapter_.get(), nullptr);
88 ASSERT_TRUE(adapter_->IsInitialized()); 88 ASSERT_TRUE(adapter_->IsInitialized());
89 } 89 }
90 90
91 scoped_ptr<BluetoothAdvertisement::Data> CreateAdvertisementData() { 91 scoped_ptr<BluetoothAdvertisement::Data> CreateAdvertisementData() {
92 scoped_ptr<BluetoothAdvertisement::Data> data = 92 scoped_ptr<BluetoothAdvertisement::Data> data =
93 make_scoped_ptr(new BluetoothAdvertisement::Data( 93 make_scoped_ptr(new BluetoothAdvertisement::Data(
94 BluetoothAdvertisement::ADVERTISEMENT_TYPE_BROADCAST)); 94 BluetoothAdvertisement::ADVERTISEMENT_TYPE_BROADCAST));
95 data->set_service_uuids( 95 data->set_service_uuids(
96 make_scoped_ptr(new BluetoothAdvertisement::UUIDList()).Pass()); 96 make_scoped_ptr(new BluetoothAdvertisement::UUIDList()));
97 data->set_manufacturer_data( 97 data->set_manufacturer_data(
98 make_scoped_ptr(new BluetoothAdvertisement::ManufacturerData()).Pass()); 98 make_scoped_ptr(new BluetoothAdvertisement::ManufacturerData()));
99 data->set_solicit_uuids( 99 data->set_solicit_uuids(
100 make_scoped_ptr(new BluetoothAdvertisement::UUIDList()).Pass()); 100 make_scoped_ptr(new BluetoothAdvertisement::UUIDList()));
101 data->set_service_data( 101 data->set_service_data(
102 make_scoped_ptr(new BluetoothAdvertisement::ServiceData()).Pass()); 102 make_scoped_ptr(new BluetoothAdvertisement::ServiceData()));
103 return data.Pass(); 103 return data;
104 } 104 }
105 105
106 // Creates and registers an advertisement with the adapter. 106 // Creates and registers an advertisement with the adapter.
107 scoped_refptr<BluetoothAdvertisement> CreateAdvertisement() { 107 scoped_refptr<BluetoothAdvertisement> CreateAdvertisement() {
108 // Clear the last advertisement we created. 108 // Clear the last advertisement we created.
109 advertisement_ = nullptr; 109 advertisement_ = nullptr;
110 110
111 adapter_->RegisterAdvertisement( 111 adapter_->RegisterAdvertisement(
112 CreateAdvertisementData().Pass(), 112 CreateAdvertisementData(),
113 base::Bind(&BluetoothAdvertisementBlueZTest::RegisterCallback, 113 base::Bind(&BluetoothAdvertisementBlueZTest::RegisterCallback,
114 base::Unretained(this)), 114 base::Unretained(this)),
115 base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback, 115 base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback,
116 base::Unretained(this))); 116 base::Unretained(this)));
117 117
118 message_loop_.RunUntilIdle(); 118 message_loop_.RunUntilIdle();
119 return advertisement_; 119 return advertisement_;
120 } 120 }
121 121
122 void UnregisterAdvertisement( 122 void UnregisterAdvertisement(
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 TriggerReleased(advertisement); 232 TriggerReleased(advertisement);
233 EXPECT_TRUE(observer_->released()); 233 EXPECT_TRUE(observer_->released());
234 234
235 // Unregistering an advertisement that has been released should give us an 235 // Unregistering an advertisement that has been released should give us an
236 // error. 236 // error.
237 UnregisterAdvertisement(advertisement); 237 UnregisterAdvertisement(advertisement);
238 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST); 238 ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST);
239 } 239 }
240 240
241 } // namespace bluez 241 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_advertisement_bluez.cc ('k') | device/bluetooth/bluetooth_bluez_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698