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

Side by Side Diff: device/bluetooth/test/mock_bluetooth_gatt_service.cc

Issue 2567903004: Replace ScopedVector/ScopedPtrHashMap with std::vector and std::unordered_map (Closed)
Patch Set: Mac bustage Created 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/mock_bluetooth_gatt_service.h" 5 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "device/bluetooth/test/mock_bluetooth_device.h" 10 #include "device/bluetooth/test/mock_bluetooth_device.h"
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 void MockBluetoothGattService::AddMockCharacteristic( 40 void MockBluetoothGattService::AddMockCharacteristic(
41 std::unique_ptr<MockBluetoothGattCharacteristic> mock_characteristic) { 41 std::unique_ptr<MockBluetoothGattCharacteristic> mock_characteristic) {
42 mock_characteristics_.push_back(std::move(mock_characteristic)); 42 mock_characteristics_.push_back(std::move(mock_characteristic));
43 } 43 }
44 44
45 std::vector<BluetoothRemoteGattCharacteristic*> 45 std::vector<BluetoothRemoteGattCharacteristic*>
46 MockBluetoothGattService::GetMockCharacteristics() const { 46 MockBluetoothGattService::GetMockCharacteristics() const {
47 std::vector<BluetoothRemoteGattCharacteristic*> characteristics; 47 std::vector<BluetoothRemoteGattCharacteristic*> characteristics;
48 for (BluetoothRemoteGattCharacteristic* characteristic : 48 for (auto& mock : mock_characteristics_) {
49 mock_characteristics_) { 49 characteristics.push_back(mock.get());
50 characteristics.push_back(characteristic);
51 } 50 }
52 return characteristics; 51 return characteristics;
53 } 52 }
54 53
55 BluetoothRemoteGattCharacteristic* 54 BluetoothRemoteGattCharacteristic*
56 MockBluetoothGattService::GetMockCharacteristic( 55 MockBluetoothGattService::GetMockCharacteristic(
57 const std::string& identifier) const { 56 const std::string& identifier) const {
58 for (BluetoothRemoteGattCharacteristic* characteristic : 57 for (auto& mock : mock_characteristics_) {
59 mock_characteristics_) { 58 if (mock->GetIdentifier() == identifier) {
60 if (characteristic->GetIdentifier() == identifier) { 59 return mock.get();
61 return characteristic;
62 } 60 }
63 } 61 }
64 return nullptr; 62 return nullptr;
65 } 63 }
66 64
67 } // namespace device 65 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698