| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/proximity_auth/bluetooth_connection.h" | 5 #include "components/proximity_auth/bluetooth_connection.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 // The connection disconnects and unregisters as an observer upon destruction. | 199 // The connection disconnects and unregisters as an observer upon destruction. |
| 200 EXPECT_CALL(*socket_, Disconnect(_)); | 200 EXPECT_CALL(*socket_, Disconnect(_)); |
| 201 EXPECT_CALL(*adapter_, RemoveObserver(&connection)); | 201 EXPECT_CALL(*adapter_, RemoveObserver(&connection)); |
| 202 } | 202 } |
| 203 | 203 |
| 204 TEST_F(ProximityAuthBluetoothConnectionTest, Connect_NoBluetoothAdapter) { | 204 TEST_F(ProximityAuthBluetoothConnectionTest, Connect_NoBluetoothAdapter) { |
| 205 // Some platforms do not support Bluetooth. This test is only meaningful on | 205 // Some platforms do not support Bluetooth. This test is only meaningful on |
| 206 // those platforms. | 206 // those platforms. |
| 207 adapter_ = NULL; | 207 adapter_ = NULL; |
| 208 if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) | 208 if (device::BluetoothAdapterFactory::IsBluetoothSupported()) |
| 209 return; | 209 return; |
| 210 | 210 |
| 211 StrictMock<MockBluetoothConnection> connection; | 211 StrictMock<MockBluetoothConnection> connection; |
| 212 EXPECT_CALL(connection, SetStatusProxy(_)).Times(0); | 212 EXPECT_CALL(connection, SetStatusProxy(_)).Times(0); |
| 213 connection.Connect(); | 213 connection.Connect(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 TEST_F(ProximityAuthBluetoothConnectionTest, Connect_DeviceMissing) { | 216 TEST_F(ProximityAuthBluetoothConnectionTest, Connect_DeviceMissing) { |
| 217 StrictMock<MockBluetoothConnection> connection; | 217 StrictMock<MockBluetoothConnection> connection; |
| 218 | 218 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 EXPECT_TRUE(connection.IsConnected()); | 480 EXPECT_TRUE(connection.IsConnected()); |
| 481 connection.DeviceChanged(adapter_.get(), &device_); | 481 connection.DeviceChanged(adapter_.get(), &device_); |
| 482 EXPECT_TRUE(connection.IsConnected()); | 482 EXPECT_TRUE(connection.IsConnected()); |
| 483 | 483 |
| 484 // The connection disconnects and unregisters as an observer upon destruction. | 484 // The connection disconnects and unregisters as an observer upon destruction. |
| 485 EXPECT_CALL(*socket_, Disconnect(_)); | 485 EXPECT_CALL(*socket_, Disconnect(_)); |
| 486 EXPECT_CALL(*adapter_, RemoveObserver(&connection)); | 486 EXPECT_CALL(*adapter_, RemoveObserver(&connection)); |
| 487 } | 487 } |
| 488 | 488 |
| 489 } // namespace proximity_auth | 489 } // namespace proximity_auth |
| OLD | NEW |