| 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/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
| 7 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 7 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 8 #include "device/bluetooth/test/mock_bluetooth_device.h" | 8 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 9 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" | 9 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" |
| 10 #include "device/bluetooth/test/mock_bluetooth_gatt_connection.h" | 10 #include "device/bluetooth/test/mock_bluetooth_gatt_connection.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 const char kTestDescriptorId1[] = "desc_id1"; | 88 const char kTestDescriptorId1[] = "desc_id1"; |
| 89 const char kTestDescriptorUuid1[] = "1222"; | 89 const char kTestDescriptorUuid1[] = "1222"; |
| 90 const uint8 kTestDescriptorDefaultValue1[] = {0x04, 0x05}; | 90 const uint8 kTestDescriptorDefaultValue1[] = {0x04, 0x05}; |
| 91 | 91 |
| 92 class BluetoothLowEnergyApiTest : public ExtensionApiTest { | 92 class BluetoothLowEnergyApiTest : public ExtensionApiTest { |
| 93 public: | 93 public: |
| 94 BluetoothLowEnergyApiTest() {} | 94 BluetoothLowEnergyApiTest() {} |
| 95 | 95 |
| 96 virtual ~BluetoothLowEnergyApiTest() {} | 96 virtual ~BluetoothLowEnergyApiTest() {} |
| 97 | 97 |
| 98 virtual void SetUpOnMainThread() override { | 98 void SetUpOnMainThread() override { |
| 99 ExtensionApiTest::SetUpOnMainThread(); | 99 ExtensionApiTest::SetUpOnMainThread(); |
| 100 empty_extension_ = extensions::test_util::CreateEmptyExtension(); | 100 empty_extension_ = extensions::test_util::CreateEmptyExtension(); |
| 101 SetUpMocks(); | 101 SetUpMocks(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void TearDownOnMainThread() override { | 104 void TearDownOnMainThread() override { |
| 105 EXPECT_CALL(*mock_adapter_, RemoveObserver(_)); | 105 EXPECT_CALL(*mock_adapter_, RemoveObserver(_)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void SetUpMocks() { | 108 void SetUpMocks() { |
| 109 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); | 109 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); |
| 110 EXPECT_CALL(*mock_adapter_, GetDevices()) | 110 EXPECT_CALL(*mock_adapter_, GetDevices()) |
| 111 .WillOnce(Return(BluetoothAdapter::ConstDeviceList())); | 111 .WillOnce(Return(BluetoothAdapter::ConstDeviceList())); |
| 112 | 112 |
| 113 event_router()->SetAdapterForTesting(mock_adapter_); | 113 event_router()->SetAdapterForTesting(mock_adapter_); |
| 114 | 114 |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 event_router()->GattCharacteristicRemoved(mock_adapter_, chrc2_.get()); | 1314 event_router()->GattCharacteristicRemoved(mock_adapter_, chrc2_.get()); |
| 1315 event_router()->GattCharacteristicRemoved(mock_adapter_, chrc1_.get()); | 1315 event_router()->GattCharacteristicRemoved(mock_adapter_, chrc1_.get()); |
| 1316 event_router()->GattCharacteristicRemoved(mock_adapter_, chrc0_.get()); | 1316 event_router()->GattCharacteristicRemoved(mock_adapter_, chrc0_.get()); |
| 1317 event_router()->GattServiceRemoved( | 1317 event_router()->GattServiceRemoved( |
| 1318 mock_adapter_, device0_.get(), service1_.get()); | 1318 mock_adapter_, device0_.get(), service1_.get()); |
| 1319 event_router()->GattServiceRemoved( | 1319 event_router()->GattServiceRemoved( |
| 1320 mock_adapter_, device0_.get(), service0_.get()); | 1320 mock_adapter_, device0_.get(), service0_.get()); |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 } // namespace | 1323 } // namespace |
| OLD | NEW |