| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/device.h" | 5 #include "device/bluetooth/device.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 proxy_.set_connection_error_handler( | 135 proxy_.set_connection_error_handler( |
| 136 base::Bind(&BluetoothInterfaceDeviceTest::OnConnectionError, | 136 base::Bind(&BluetoothInterfaceDeviceTest::OnConnectionError, |
| 137 weak_factory_.GetWeakPtr())); | 137 weak_factory_.GetWeakPtr())); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void TearDown() override { | 140 void TearDown() override { |
| 141 EXPECT_EQ(expected_success_callback_calls_, actual_success_callback_calls_); | 141 EXPECT_EQ(expected_success_callback_calls_, actual_success_callback_calls_); |
| 142 EXPECT_EQ(message_pipe_closed_, expect_device_service_deleted_); | 142 EXPECT_EQ(message_pipe_closed_, expect_device_service_deleted_); |
| 143 proxy_.reset(); | 143 proxy_.reset(); |
| 144 base::RunLoop().RunUntilIdle(); |
| 144 } | 145 } |
| 145 | 146 |
| 146 protected: | 147 protected: |
| 147 void OnConnectionError() { message_pipe_closed_ = true; } | 148 void OnConnectionError() { message_pipe_closed_ = true; } |
| 148 | 149 |
| 149 void SimulateGattServicesDiscovered() { | 150 void SimulateGattServicesDiscovered() { |
| 150 for (auto& observer : adapter_->GetObservers()) | 151 for (auto& observer : adapter_->GetObservers()) |
| 151 observer.GattServicesDiscovered(adapter_.get(), &device_); | 152 observer.GattServicesDiscovered(adapter_.get(), &device_); |
| 152 } | 153 } |
| 153 | 154 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 EXPECT_EQ(0, actual_callback_count_); | 267 EXPECT_EQ(0, actual_callback_count_); |
| 267 | 268 |
| 268 // Simulate connection loss. | 269 // Simulate connection loss. |
| 269 proxy_->Disconnect(); | 270 proxy_->Disconnect(); |
| 270 expect_device_service_deleted_ = true; | 271 expect_device_service_deleted_ = true; |
| 271 | 272 |
| 272 // Wait for message pipe to process error. | 273 // Wait for message pipe to process error. |
| 273 base::RunLoop().RunUntilIdle(); | 274 base::RunLoop().RunUntilIdle(); |
| 274 } | 275 } |
| 275 } // namespace bluetooth | 276 } // namespace bluetooth |
| OLD | NEW |