| 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/extensions/extension_apitest.h" | 11 #include "chrome/browser/extensions/extension_apitest.h" |
| 12 #include "device/bluetooth/bluetooth_common.h" |
| 12 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 13 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 13 #include "device/bluetooth/test/mock_bluetooth_device.h" | 14 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 14 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" | 15 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" |
| 15 #include "extensions/browser/api/bluetooth/bluetooth_api.h" | 16 #include "extensions/browser/api/bluetooth/bluetooth_api.h" |
| 16 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" | 17 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" |
| 17 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
| 18 #include "extensions/common/api/bluetooth_private.h" | 19 #include "extensions/common/api/bluetooth_private.h" |
| 19 #include "extensions/common/switches.h" | 20 #include "extensions/common/switches.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 21 | 22 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 WithArgs<0>(Invoke(this, &BluetoothPrivateApiTest::ForgetDevice))); | 246 WithArgs<0>(Invoke(this, &BluetoothPrivateApiTest::ForgetDevice))); |
| 246 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/forget_device")) | 247 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/forget_device")) |
| 247 << message_; | 248 << message_; |
| 248 } | 249 } |
| 249 #endif | 250 #endif |
| 250 | 251 |
| 251 IN_PROC_BROWSER_TEST_F(BluetoothPrivateApiTest, DiscoveryFilter) { | 252 IN_PROC_BROWSER_TEST_F(BluetoothPrivateApiTest, DiscoveryFilter) { |
| 252 mock_discovery_session_ = new NiceMock<MockBluetoothDiscoverySession>(); | 253 mock_discovery_session_ = new NiceMock<MockBluetoothDiscoverySession>(); |
| 253 | 254 |
| 254 BluetoothDiscoveryFilter discovery_filter( | 255 BluetoothDiscoveryFilter discovery_filter( |
| 255 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); | 256 device::BluetoothTransport::TRANSPORT_LE); |
| 256 discovery_filter.SetPathloss(50); | 257 discovery_filter.SetPathloss(50); |
| 257 discovery_filter.AddUUID(BluetoothUUID("cafe")); | 258 discovery_filter.AddUUID(BluetoothUUID("cafe")); |
| 258 discovery_filter.AddUUID( | 259 discovery_filter.AddUUID( |
| 259 BluetoothUUID("0000bebe-0000-1000-8000-00805f9b34fb")); | 260 BluetoothUUID("0000bebe-0000-1000-8000-00805f9b34fb")); |
| 260 | 261 |
| 261 EXPECT_CALL(*mock_adapter_.get(), StartDiscoverySessionWithFilterRaw( | 262 EXPECT_CALL(*mock_adapter_.get(), StartDiscoverySessionWithFilterRaw( |
| 262 IsFilterEqual(&discovery_filter), _, _)) | 263 IsFilterEqual(&discovery_filter), _, _)) |
| 263 .Times(1) | 264 .Times(1) |
| 264 .WillOnce(WithArgs<1>(Invoke( | 265 .WillOnce(WithArgs<1>(Invoke( |
| 265 this, &BluetoothPrivateApiTest::CallSetDiscoveryFilterCallback))); | 266 this, &BluetoothPrivateApiTest::CallSetDiscoveryFilterCallback))); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 294 EXPECT_CALL(*mock_device_.get(), Pair(_, _, _)) | 295 EXPECT_CALL(*mock_device_.get(), Pair(_, _, _)) |
| 295 .WillOnce(DoAll( | 296 .WillOnce(DoAll( |
| 296 WithoutArgs(Invoke( | 297 WithoutArgs(Invoke( |
| 297 this, | 298 this, |
| 298 &BluetoothPrivateApiTest::DispatchConfirmPasskeyPairingEvent)), | 299 &BluetoothPrivateApiTest::DispatchConfirmPasskeyPairingEvent)), |
| 299 InvokeCallbackArgument<1>())); | 300 InvokeCallbackArgument<1>())); |
| 300 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/pair")) << message_; | 301 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/pair")) << message_; |
| 301 } | 302 } |
| 302 | 303 |
| 303 } // namespace extensions | 304 } // namespace extensions |
| OLD | NEW |