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

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

Issue 2244693002: bluetooth: Refactor how we update based on Advertising Data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix arc 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 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ 5 #ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_
6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ 6 #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 MOCK_CONST_METHOD0(GetDeviceID, uint16_t()); 44 MOCK_CONST_METHOD0(GetDeviceID, uint16_t());
45 MOCK_CONST_METHOD0(GetAppearance, uint16_t()); 45 MOCK_CONST_METHOD0(GetAppearance, uint16_t());
46 MOCK_CONST_METHOD0(GetName, base::Optional<std::string>()); 46 MOCK_CONST_METHOD0(GetName, base::Optional<std::string>());
47 MOCK_CONST_METHOD0(GetNameForDisplay, base::string16()); 47 MOCK_CONST_METHOD0(GetNameForDisplay, base::string16());
48 MOCK_CONST_METHOD0(GetDeviceType, BluetoothDevice::DeviceType()); 48 MOCK_CONST_METHOD0(GetDeviceType, BluetoothDevice::DeviceType());
49 MOCK_CONST_METHOD0(IsPaired, bool()); 49 MOCK_CONST_METHOD0(IsPaired, bool());
50 MOCK_CONST_METHOD0(IsConnected, bool()); 50 MOCK_CONST_METHOD0(IsConnected, bool());
51 MOCK_CONST_METHOD0(IsGattConnected, bool()); 51 MOCK_CONST_METHOD0(IsGattConnected, bool());
52 MOCK_CONST_METHOD0(IsConnectable, bool()); 52 MOCK_CONST_METHOD0(IsConnectable, bool());
53 MOCK_CONST_METHOD0(IsConnecting, bool()); 53 MOCK_CONST_METHOD0(IsConnecting, bool());
54 MOCK_CONST_METHOD0(GetUUIDs, UUIDList()); 54 MOCK_CONST_METHOD0(GetUUIDs, UUIDSet());
55 MOCK_CONST_METHOD0(GetInquiryRSSI, base::Optional<int8_t>()); 55 MOCK_CONST_METHOD0(GetInquiryRSSI, base::Optional<int8_t>());
56 MOCK_CONST_METHOD0(GetInquiryTxPower, base::Optional<int8_t>()); 56 MOCK_CONST_METHOD0(GetInquiryTxPower, base::Optional<int8_t>());
57 MOCK_CONST_METHOD0(ExpectingPinCode, bool()); 57 MOCK_CONST_METHOD0(ExpectingPinCode, bool());
58 MOCK_CONST_METHOD0(ExpectingPasskey, bool()); 58 MOCK_CONST_METHOD0(ExpectingPasskey, bool());
59 MOCK_CONST_METHOD0(ExpectingConfirmation, bool()); 59 MOCK_CONST_METHOD0(ExpectingConfirmation, bool());
60 MOCK_METHOD1(GetConnectionInfo, void(const ConnectionInfoCallback& callback)); 60 MOCK_METHOD1(GetConnectionInfo, void(const ConnectionInfoCallback& callback));
61 MOCK_METHOD3(Connect, 61 MOCK_METHOD3(Connect,
62 void(BluetoothDevice::PairingDelegate* pairing_delegate, 62 void(BluetoothDevice::PairingDelegate* pairing_delegate,
63 const base::Closure& callback, 63 const base::Closure& callback,
64 const BluetoothDevice::ConnectErrorCallback& 64 const BluetoothDevice::ConnectErrorCallback&
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // test cases without using these functions. 107 // test cases without using these functions.
108 // Example: 108 // Example:
109 // ON_CALL(*mock_device, GetGattServices)) 109 // ON_CALL(*mock_device, GetGattServices))
110 // .WillByDefault(Invoke(*mock_device, 110 // .WillByDefault(Invoke(*mock_device,
111 // &MockBluetoothDevice::GetMockServices)); 111 // &MockBluetoothDevice::GetMockServices));
112 void AddMockService(std::unique_ptr<MockBluetoothGattService> mock_device); 112 void AddMockService(std::unique_ptr<MockBluetoothGattService> mock_device);
113 std::vector<BluetoothRemoteGattService*> GetMockServices() const; 113 std::vector<BluetoothRemoteGattService*> GetMockServices() const;
114 BluetoothRemoteGattService* GetMockService( 114 BluetoothRemoteGattService* GetMockService(
115 const std::string& identifier) const; 115 const std::string& identifier) const;
116 116
117 void AddUUID(const BluetoothUUID& uuid) { uuids_.push_back(uuid); } 117 void AddUUID(const BluetoothUUID& uuid) { uuids_.insert(uuid); }
118 118
119 void SetConnected(bool connected) { connected_ = connected; } 119 void SetConnected(bool connected) { connected_ = connected; }
120 120
121 private: 121 private:
122 uint32_t bluetooth_class_; 122 uint32_t bluetooth_class_;
123 base::Optional<std::string> name_; 123 base::Optional<std::string> name_;
124 std::string address_; 124 std::string address_;
125 BluetoothDevice::UUIDList uuids_; 125 BluetoothDevice::UUIDSet uuids_;
126 bool connected_; 126 bool connected_;
127 127
128 ScopedVector<MockBluetoothGattService> mock_services_; 128 ScopedVector<MockBluetoothGattService> mock_services_;
129 }; 129 };
130 130
131 } // namespace device 131 } // namespace device
132 132
133 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_ 133 #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698