Chromium Code Reviews| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ y_api.h" | 6 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ y_api.h" |
| 7 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ y_event_router.h" | 7 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ y_event_router.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 10 #include "device/bluetooth/test/mock_bluetooth_device.h" | 10 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1137 ResultCatcher catcher; | 1137 ResultCatcher catcher; |
| 1138 catcher.RestrictToBrowserContext(browser()->profile()); | 1138 catcher.RestrictToBrowserContext(browser()->profile()); |
| 1139 | 1139 |
| 1140 EXPECT_CALL(*mock_adapter_, GetDevice(_)) | 1140 EXPECT_CALL(*mock_adapter_, GetDevice(_)) |
| 1141 .WillRepeatedly(Return(static_cast<BluetoothDevice*>(NULL))); | 1141 .WillRepeatedly(Return(static_cast<BluetoothDevice*>(NULL))); |
| 1142 EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress0)) | 1142 EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress0)) |
| 1143 .WillRepeatedly(Return(device0_.get())); | 1143 .WillRepeatedly(Return(device0_.get())); |
| 1144 EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress1)) | 1144 EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress1)) |
| 1145 .WillRepeatedly(Return(device1_.get())); | 1145 .WillRepeatedly(Return(device1_.get())); |
| 1146 EXPECT_CALL(*device0_, CreateGattConnection(_, _)) | 1146 EXPECT_CALL(*device0_, CreateGattConnection(_, _)) |
| 1147 .Times(9) | 1147 .Times(9) |
|
scheib
2015/11/26 00:02:50
16 times now. And src/chrome/test/data/extensions/
Kai Jiang
2015/11/29 10:40:51
Done.
| |
| 1148 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_FAILED)) | 1148 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_FAILED)) |
| 1149 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_INPROGRESS)) | 1149 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_INPROGRESS)) |
| 1150 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_FAILED)) | 1150 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_FAILED)) |
| 1151 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_REJECTED)) | 1151 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_REJECTED)) |
| 1152 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_CANCELED)) | 1152 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_CANCELED)) |
| 1153 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_TIMEOUT)) | 1153 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_TIMEOUT)) |
| 1154 .WillOnce( | 1154 .WillOnce( |
| 1155 InvokeCallbackArgument<1>(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE)) | 1155 InvokeCallbackArgument<1>(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE)) |
| 1156 .WillOnce(InvokeCallbackArgument<1>( | |
| 1157 BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID)) | |
| 1158 .WillOnce(InvokeCallbackArgument<1>( | |
| 1159 BluetoothDevice::ERROR_CONNECTION_CONGESTED)) | |
| 1160 .WillOnce(InvokeCallbackArgument<1>( | |
| 1161 BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION)) | |
| 1162 .WillOnce( | |
| 1163 InvokeCallbackArgument<1>(BluetoothDevice::ERROR_OFFSET_INVALID)) | |
| 1164 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_READ_FAILED)) | |
| 1165 .WillOnce(InvokeCallbackArgument<1>( | |
| 1166 BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED)) | |
| 1167 .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_WRITE_FAILED)) | |
| 1156 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( | 1168 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( |
| 1157 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress0, | 1169 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress0, |
| 1158 true /* expect_disconnect */))) | 1170 true /* expect_disconnect */))) |
| 1159 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( | 1171 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( |
| 1160 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress0, | 1172 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress0, |
| 1161 false /* expect_disconnect */))); | 1173 false /* expect_disconnect */))); |
| 1162 EXPECT_CALL(*device1_, CreateGattConnection(_, _)) | 1174 EXPECT_CALL(*device1_, CreateGattConnection(_, _)) |
| 1163 .Times(1) | 1175 .Times(1) |
| 1164 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( | 1176 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( |
| 1165 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress1, | 1177 CreateGattConnection(mock_adapter_, kTestLeDeviceAddress1, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1341 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 1353 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 1342 | 1354 |
| 1343 listener.Reply("go"); | 1355 listener.Reply("go"); |
| 1344 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1356 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 1345 | 1357 |
| 1346 event_router()->GattServiceRemoved(mock_adapter_, device0_.get(), | 1358 event_router()->GattServiceRemoved(mock_adapter_, device0_.get(), |
| 1347 service0_.get()); | 1359 service0_.get()); |
| 1348 } | 1360 } |
| 1349 | 1361 |
| 1350 } // namespace | 1362 } // namespace |
| OLD | NEW |