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

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

Issue 2438963002: bluetooth: Add tests for when frame reconnects during readValue (Closed)
Patch Set: Address jyasskin's comments Created 4 years, 1 month 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 BluetoothRemoteGattService* MockBluetoothDevice::GetMockService( 82 BluetoothRemoteGattService* MockBluetoothDevice::GetMockService(
83 const std::string& identifier) const { 83 const std::string& identifier) const {
84 for (BluetoothRemoteGattService* service : mock_services_) { 84 for (BluetoothRemoteGattService* service : mock_services_) {
85 if (service->GetIdentifier() == identifier) 85 if (service->GetIdentifier() == identifier)
86 return service; 86 return service;
87 } 87 }
88 return nullptr; 88 return nullptr;
89 } 89 }
90 90
91 void MockBluetoothDevice::PushPendingCallback(const base::Closure& callback) {
92 pending_callbacks_.push(callback);
93 }
94
95 void MockBluetoothDevice::RunPendingCallbacks() {
96 while (!pending_callbacks_.empty()) {
97 pending_callbacks_.front().Run();
98 pending_callbacks_.pop();
99 }
100 }
101
91 } // namespace device 102 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698