| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_api.h" | 10 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_api.h" |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 .WillOnce(Return(service1_.get())); | 645 .WillOnce(Return(service1_.get())); |
| 646 EXPECT_CALL(*service0_, GetCharacteristic(kTestCharacteristicId0)) | 646 EXPECT_CALL(*service0_, GetCharacteristic(kTestCharacteristicId0)) |
| 647 .Times(1) | 647 .Times(1) |
| 648 .WillOnce(Return(chrc0_.get())); | 648 .WillOnce(Return(chrc0_.get())); |
| 649 EXPECT_CALL(*service1_, GetCharacteristic(kTestCharacteristicId2)) | 649 EXPECT_CALL(*service1_, GetCharacteristic(kTestCharacteristicId2)) |
| 650 .Times(1) | 650 .Times(1) |
| 651 .WillOnce(Return(chrc2_.get())); | 651 .WillOnce(Return(chrc2_.get())); |
| 652 | 652 |
| 653 BluetoothGattNotifySession* session0 = | 653 BluetoothGattNotifySession* session0 = |
| 654 new testing::NiceMock<MockBluetoothGattNotifySession>( | 654 new testing::NiceMock<MockBluetoothGattNotifySession>( |
| 655 kTestCharacteristicId0); | 655 chrc0_->GetWeakPtr()); |
| 656 BluetoothGattNotifySession* session1 = | 656 BluetoothGattNotifySession* session1 = |
| 657 new testing::NiceMock<MockBluetoothGattNotifySession>( | 657 new testing::NiceMock<MockBluetoothGattNotifySession>( |
| 658 kTestCharacteristicId2); | 658 chrc2_->GetWeakPtr()); |
| 659 | 659 |
| 660 EXPECT_CALL(*chrc0_, StartNotifySession(_, _)) | 660 EXPECT_CALL(*chrc0_, StartNotifySession(_, _)) |
| 661 .Times(1) | 661 .Times(1) |
| 662 .WillOnce( | 662 .WillOnce( |
| 663 InvokeCallbackWithScopedPtrArg<0, BluetoothGattNotifySession>( | 663 InvokeCallbackWithScopedPtrArg<0, BluetoothGattNotifySession>( |
| 664 session0)); | 664 session0)); |
| 665 EXPECT_CALL(*chrc2_, StartNotifySession(_, _)) | 665 EXPECT_CALL(*chrc2_, StartNotifySession(_, _)) |
| 666 .Times(1) | 666 .Times(1) |
| 667 .WillOnce( | 667 .WillOnce( |
| 668 InvokeCallbackWithScopedPtrArg<0, BluetoothGattNotifySession>( | 668 InvokeCallbackWithScopedPtrArg<0, BluetoothGattNotifySession>( |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 .WillOnce(Return(chrc2_.get())); | 1275 .WillOnce(Return(chrc2_.get())); |
| 1276 EXPECT_CALL(*service0_, GetCharacteristic(kTestCharacteristicId0)) | 1276 EXPECT_CALL(*service0_, GetCharacteristic(kTestCharacteristicId0)) |
| 1277 .Times(2) | 1277 .Times(2) |
| 1278 .WillRepeatedly(Return(chrc0_.get())); | 1278 .WillRepeatedly(Return(chrc0_.get())); |
| 1279 EXPECT_CALL(*service0_, GetCharacteristic(kTestCharacteristicId1)) | 1279 EXPECT_CALL(*service0_, GetCharacteristic(kTestCharacteristicId1)) |
| 1280 .Times(1) | 1280 .Times(1) |
| 1281 .WillOnce(Return(chrc1_.get())); | 1281 .WillOnce(Return(chrc1_.get())); |
| 1282 | 1282 |
| 1283 BluetoothGattNotifySession* session0 = | 1283 BluetoothGattNotifySession* session0 = |
| 1284 new testing::NiceMock<MockBluetoothGattNotifySession>( | 1284 new testing::NiceMock<MockBluetoothGattNotifySession>( |
| 1285 kTestCharacteristicId0); | 1285 chrc0_->GetWeakPtr()); |
| 1286 MockBluetoothGattNotifySession* session1 = | 1286 MockBluetoothGattNotifySession* session1 = |
| 1287 new testing::NiceMock<MockBluetoothGattNotifySession>( | 1287 new testing::NiceMock<MockBluetoothGattNotifySession>( |
| 1288 kTestCharacteristicId1); | 1288 chrc1_->GetWeakPtr()); |
| 1289 | 1289 |
| 1290 EXPECT_CALL(*session1, Stop(_)) | 1290 EXPECT_CALL(*session1, Stop(_)) |
| 1291 .Times(1) | 1291 .Times(1) |
| 1292 .WillOnce(InvokeCallbackArgument<0>()); | 1292 .WillOnce(InvokeCallbackArgument<0>()); |
| 1293 | 1293 |
| 1294 EXPECT_CALL(*chrc0_, StartNotifySession(_, _)) | 1294 EXPECT_CALL(*chrc0_, StartNotifySession(_, _)) |
| 1295 .Times(2) | 1295 .Times(2) |
| 1296 .WillOnce(InvokeCallbackArgument<1>( | 1296 .WillOnce(InvokeCallbackArgument<1>( |
| 1297 BluetoothRemoteGattService::GATT_ERROR_FAILED)) | 1297 BluetoothRemoteGattService::GATT_ERROR_FAILED)) |
| 1298 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattNotifySession>( | 1298 .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattNotifySession>( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 1358 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 1359 | 1359 |
| 1360 listener.Reply("go"); | 1360 listener.Reply("go"); |
| 1361 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1361 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 1362 | 1362 |
| 1363 event_router()->GattServiceRemoved(mock_adapter_, device0_.get(), | 1363 event_router()->GattServiceRemoved(mock_adapter_, device0_.get(), |
| 1364 service0_.get()); | 1364 service0_.get()); |
| 1365 } | 1365 } |
| 1366 | 1366 |
| 1367 } // namespace | 1367 } // namespace |
| OLD | NEW |