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

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

Issue 2217573002: bluetooth: Only add new devices, connected devices and devices that changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-add-or-update
Patch Set: Fix typo Created 4 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_device.h" 5 #include "device/bluetooth/test/mock_bluetooth_device.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 30 matching lines...) Expand all
41 ON_CALL(*this, GetName()).WillByDefault(testing::Return(name_)); 41 ON_CALL(*this, GetName()).WillByDefault(testing::Return(name_));
42 ON_CALL(*this, GetNameForDisplay()) 42 ON_CALL(*this, GetNameForDisplay())
43 .WillByDefault(testing::Return( 43 .WillByDefault(testing::Return(
44 base::UTF8ToUTF16(name_ ? name_.value() : "Unnamed Device"))); 44 base::UTF8ToUTF16(name_ ? name_.value() : "Unnamed Device")));
45 ON_CALL(*this, GetDeviceType()) 45 ON_CALL(*this, GetDeviceType())
46 .WillByDefault(testing::Return(DEVICE_UNKNOWN)); 46 .WillByDefault(testing::Return(DEVICE_UNKNOWN));
47 ON_CALL(*this, IsPaired()) 47 ON_CALL(*this, IsPaired())
48 .WillByDefault(testing::Return(paired)); 48 .WillByDefault(testing::Return(paired));
49 ON_CALL(*this, IsConnected()) 49 ON_CALL(*this, IsConnected())
50 .WillByDefault(testing::ReturnPointee(&connected_)); 50 .WillByDefault(testing::ReturnPointee(&connected_));
51 ON_CALL(*this, IsGattConnected())
52 .WillByDefault(testing::ReturnPointee(&connected_));
51 ON_CALL(*this, IsConnectable()) 53 ON_CALL(*this, IsConnectable())
52 .WillByDefault(testing::Return(false)); 54 .WillByDefault(testing::Return(false));
53 ON_CALL(*this, IsConnecting()) 55 ON_CALL(*this, IsConnecting())
54 .WillByDefault(testing::Return(false)); 56 .WillByDefault(testing::Return(false));
55 ON_CALL(*this, GetUUIDs()).WillByDefault(testing::Return(uuids_)); 57 ON_CALL(*this, GetUUIDs()).WillByDefault(testing::ReturnPointee(&uuids_));
56 ON_CALL(*this, ExpectingPinCode()) 58 ON_CALL(*this, ExpectingPinCode())
57 .WillByDefault(testing::Return(false)); 59 .WillByDefault(testing::Return(false));
58 ON_CALL(*this, ExpectingPasskey()) 60 ON_CALL(*this, ExpectingPasskey())
59 .WillByDefault(testing::Return(false)); 61 .WillByDefault(testing::Return(false));
60 ON_CALL(*this, ExpectingConfirmation()) 62 ON_CALL(*this, ExpectingConfirmation())
61 .WillByDefault(testing::Return(false)); 63 .WillByDefault(testing::Return(false));
62 } 64 }
63 65
64 MockBluetoothDevice::~MockBluetoothDevice() {} 66 MockBluetoothDevice::~MockBluetoothDevice() {}
65 67
(...skipping 14 matching lines...) Expand all
80 BluetoothRemoteGattService* MockBluetoothDevice::GetMockService( 82 BluetoothRemoteGattService* MockBluetoothDevice::GetMockService(
81 const std::string& identifier) const { 83 const std::string& identifier) const {
82 for (BluetoothRemoteGattService* service : mock_services_) { 84 for (BluetoothRemoteGattService* service : mock_services_) {
83 if (service->GetIdentifier() == identifier) 85 if (service->GetIdentifier() == identifier)
84 return service; 86 return service;
85 } 87 }
86 return nullptr; 88 return nullptr;
87 } 89 }
88 90
89 } // namespace device 91 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698