| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 .Times(1) | 250 .Times(1) |
| 251 .WillOnce(Return(true)); | 251 .WillOnce(Return(true)); |
| 252 EXPECT_CALL(*mock_discovery_session_, | 252 EXPECT_CALL(*mock_discovery_session_, |
| 253 SetDiscoveryFilterRaw(Eq(nullptr), _, _)) | 253 SetDiscoveryFilterRaw(Eq(nullptr), _, _)) |
| 254 .Times(1) | 254 .Times(1) |
| 255 .WillOnce(InvokeCallbackArgument<1>()); | 255 .WillOnce(InvokeCallbackArgument<1>()); |
| 256 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/discovery_filter")) | 256 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/discovery_filter")) |
| 257 << message_; | 257 << message_; |
| 258 } | 258 } |
| 259 | 259 |
| 260 IN_PROC_BROWSER_TEST_F(BluetoothPrivateApiTest, Connect) { |
| 261 EXPECT_CALL(*mock_device_.get(), IsConnected()) |
| 262 .Times(2) |
| 263 .WillOnce(Return(false)) |
| 264 .WillOnce(Return(true)); |
| 265 EXPECT_CALL(*mock_device_.get(), Connect(_, _, _)) |
| 266 .WillOnce(InvokeCallbackArgument<1>()); |
| 267 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/connect")) |
| 268 << message_; |
| 269 } |
| 270 |
| 260 IN_PROC_BROWSER_TEST_F(BluetoothPrivateApiTest, Pair) { | 271 IN_PROC_BROWSER_TEST_F(BluetoothPrivateApiTest, Pair) { |
| 261 EXPECT_CALL(*mock_adapter_.get(), | 272 EXPECT_CALL(*mock_adapter_.get(), |
| 262 AddPairingDelegate( | 273 AddPairingDelegate( |
| 263 _, device::BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH)); | 274 _, device::BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH)); |
| 264 EXPECT_CALL(*mock_device_, ExpectingConfirmation()) | 275 EXPECT_CALL(*mock_device_, ExpectingConfirmation()) |
| 265 .WillRepeatedly(Return(true)); | 276 .WillRepeatedly(Return(true)); |
| 266 EXPECT_CALL(*mock_device_.get(), Pair(_, _, _)) | 277 EXPECT_CALL(*mock_device_.get(), Pair(_, _, _)) |
| 267 .WillOnce(DoAll( | 278 .WillOnce(DoAll( |
| 268 WithoutArgs(Invoke( | 279 WithoutArgs(Invoke( |
| 269 this, | 280 this, |
| 270 &BluetoothPrivateApiTest::DispatchConfirmPasskeyPairingEvent)), | 281 &BluetoothPrivateApiTest::DispatchConfirmPasskeyPairingEvent)), |
| 271 InvokeCallbackArgument<1>())); | 282 InvokeCallbackArgument<1>())); |
| 272 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/pair")) << message_; | 283 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/pair")) << message_; |
| 273 } | 284 } |
| 274 | 285 |
| 275 } // namespace extensions | 286 } // namespace extensions |
| OLD | NEW |