| 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 26 matching lines...) Expand all Loading... |
| 37 const char kDeviceName[] = "Red"; | 37 const char kDeviceName[] = "Red"; |
| 38 } | 38 } |
| 39 | 39 |
| 40 class BluetoothPrivateApiTest : public ExtensionApiTest { | 40 class BluetoothPrivateApiTest : public ExtensionApiTest { |
| 41 public: | 41 public: |
| 42 BluetoothPrivateApiTest() | 42 BluetoothPrivateApiTest() |
| 43 : adapter_name_(kAdapterName), | 43 : adapter_name_(kAdapterName), |
| 44 adapter_powered_(false), | 44 adapter_powered_(false), |
| 45 adapter_discoverable_(false) {} | 45 adapter_discoverable_(false) {} |
| 46 | 46 |
| 47 virtual ~BluetoothPrivateApiTest() {} | 47 ~BluetoothPrivateApiTest() override {} |
| 48 | 48 |
| 49 void SetUpOnMainThread() override { | 49 void SetUpOnMainThread() override { |
| 50 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 50 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 51 switches::kWhitelistedExtensionID, kTestExtensionId); | 51 switches::kWhitelistedExtensionID, kTestExtensionId); |
| 52 mock_adapter_ = new NiceMock<MockBluetoothAdapter>(); | 52 mock_adapter_ = new NiceMock<MockBluetoothAdapter>(); |
| 53 event_router()->SetAdapterForTest(mock_adapter_.get()); | 53 event_router()->SetAdapterForTest(mock_adapter_.get()); |
| 54 mock_device_.reset(new NiceMock<MockBluetoothDevice>(mock_adapter_.get(), | 54 mock_device_.reset(new NiceMock<MockBluetoothDevice>(mock_adapter_.get(), |
| 55 0, | 55 0, |
| 56 kDeviceName, | 56 kDeviceName, |
| 57 "11:12:13:14:15:16", | 57 "11:12:13:14:15:16", |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 _, device::BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH)) | 177 _, device::BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH)) |
| 178 .WillOnce(WithoutArgs( | 178 .WillOnce(WithoutArgs( |
| 179 Invoke(this, &BluetoothPrivateApiTest::DispatchPasskeyPairingEvent))); | 179 Invoke(this, &BluetoothPrivateApiTest::DispatchPasskeyPairingEvent))); |
| 180 EXPECT_CALL(*mock_device_, ExpectingPasskey()).WillRepeatedly(Return(true)); | 180 EXPECT_CALL(*mock_device_, ExpectingPasskey()).WillRepeatedly(Return(true)); |
| 181 EXPECT_CALL(*mock_device_, SetPasskey(900531)); | 181 EXPECT_CALL(*mock_device_, SetPasskey(900531)); |
| 182 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/passkey_pairing")) | 182 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/passkey_pairing")) |
| 183 << message_; | 183 << message_; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace extensions | 186 } // namespace extensions |
| OLD | NEW |