OLD | NEW |
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 "device/bluetooth/test/bluetooth_test.h" | 5 #include "device/bluetooth/test/bluetooth_test.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 if (expected == Call::EXPECTED) | 103 if (expected == Call::EXPECTED) |
104 ++actual_success_callback_calls_; | 104 ++actual_success_callback_calls_; |
105 else | 105 else |
106 unexpected_success_callback_ = true; | 106 unexpected_success_callback_ = true; |
107 } | 107 } |
108 | 108 |
109 void BluetoothTestBase::DiscoverySessionCallback( | 109 void BluetoothTestBase::DiscoverySessionCallback( |
110 Call expected, | 110 Call expected, |
111 std::unique_ptr<BluetoothDiscoverySession> discovery_session) { | 111 std::unique_ptr<BluetoothDiscoverySession> discovery_session) { |
112 ++callback_count_; | 112 ++callback_count_; |
113 discovery_sessions_.push_back(discovery_session.release()); | 113 discovery_sessions_.push_back(std::move(discovery_session)); |
114 | 114 |
115 if (expected == Call::EXPECTED) | 115 if (expected == Call::EXPECTED) |
116 ++actual_success_callback_calls_; | 116 ++actual_success_callback_calls_; |
117 else | 117 else |
118 unexpected_success_callback_ = true; | 118 unexpected_success_callback_ = true; |
119 } | 119 } |
120 | 120 |
121 void BluetoothTestBase::GattConnectionCallback( | 121 void BluetoothTestBase::GattConnectionCallback( |
122 Call expected, | 122 Call expected, |
123 std::unique_ptr<BluetoothGattConnection> connection) { | 123 std::unique_ptr<BluetoothGattConnection> connection) { |
124 ++callback_count_; | 124 ++callback_count_; |
125 gatt_connections_.push_back(connection.release()); | 125 gatt_connections_.push_back(std::move(connection)); |
126 | 126 |
127 if (expected == Call::EXPECTED) | 127 if (expected == Call::EXPECTED) |
128 ++actual_success_callback_calls_; | 128 ++actual_success_callback_calls_; |
129 else | 129 else |
130 unexpected_success_callback_ = true; | 130 unexpected_success_callback_ = true; |
131 } | 131 } |
132 | 132 |
133 void BluetoothTestBase::NotifyCallback( | 133 void BluetoothTestBase::NotifyCallback( |
134 Call expected, | 134 Call expected, |
135 std::unique_ptr<BluetoothGattNotifySession> notify_session) { | 135 std::unique_ptr<BluetoothGattNotifySession> notify_session) { |
136 notify_sessions_.push_back(notify_session.release()); | 136 notify_sessions_.push_back(std::move(notify_session)); |
137 | 137 |
138 ++callback_count_; | 138 ++callback_count_; |
139 if (expected == Call::EXPECTED) | 139 if (expected == Call::EXPECTED) |
140 ++actual_success_callback_calls_; | 140 ++actual_success_callback_calls_; |
141 else | 141 else |
142 unexpected_success_callback_ = true; | 142 unexpected_success_callback_ = true; |
143 } | 143 } |
144 | 144 |
145 void BluetoothTestBase::NotifyCheckForPrecedingCalls( | 145 void BluetoothTestBase::NotifyCheckForPrecedingCalls( |
146 int num_of_preceding_calls, | 146 int num_of_preceding_calls, |
147 std::unique_ptr<BluetoothGattNotifySession> notify_session) { | 147 std::unique_ptr<BluetoothGattNotifySession> notify_session) { |
148 EXPECT_EQ(num_of_preceding_calls, callback_count_); | 148 EXPECT_EQ(num_of_preceding_calls, callback_count_); |
149 | 149 |
150 notify_sessions_.push_back(notify_session.release()); | 150 notify_sessions_.push_back(std::move(notify_session)); |
151 | 151 |
152 ++callback_count_; | 152 ++callback_count_; |
153 ++actual_success_callback_calls_; | 153 ++actual_success_callback_calls_; |
154 } | 154 } |
155 | 155 |
156 void BluetoothTestBase::StopNotifyCallback(Call expected) { | 156 void BluetoothTestBase::StopNotifyCallback(Call expected) { |
157 ++callback_count_; | 157 ++callback_count_; |
158 | 158 |
159 if (expected == Call::EXPECTED) | 159 if (expected == Call::EXPECTED) |
160 ++actual_success_callback_calls_; | 160 ++actual_success_callback_calls_; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 gatt_write_characteristic_attempts_ = 0; | 374 gatt_write_characteristic_attempts_ = 0; |
375 gatt_read_descriptor_attempts_ = 0; | 375 gatt_read_descriptor_attempts_ = 0; |
376 gatt_write_descriptor_attempts_ = 0; | 376 gatt_write_descriptor_attempts_ = 0; |
377 } | 377 } |
378 | 378 |
379 void BluetoothTestBase::RemoveTimedOutDevices() { | 379 void BluetoothTestBase::RemoveTimedOutDevices() { |
380 adapter_->RemoveTimedOutDevices(); | 380 adapter_->RemoveTimedOutDevices(); |
381 } | 381 } |
382 | 382 |
383 } // namespace device | 383 } // namespace device |
OLD | NEW |