| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.h" | 5 #include "chrome/browser/chromeos/bluetooth/bluetooth_pairing_dialog.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/browser_window.h" | 7 #include "chrome/browser/ui/browser_window.h" |
| 8 #include "chrome/test/base/web_ui_browser_test.h" | 8 #include "chrome/test/base/web_ui_browser_test.h" |
| 9 #include "content/public/browser/web_ui.h" | 9 #include "content/public/browser/web_ui.h" |
| 10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
| 11 #include "device/bluetooth/bluetooth_adapter_factory.h" | 11 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 12 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 12 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 13 #include "device/bluetooth/test/mock_bluetooth_device.h" | 13 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 | 15 |
| 16 class BluetoothPairingUITest : public WebUIBrowserTest { | 16 class BluetoothPairingUITest : public WebUIBrowserTest { |
| 17 public: | 17 public: |
| 18 BluetoothPairingUITest(); | 18 BluetoothPairingUITest(); |
| 19 ~BluetoothPairingUITest() override; | 19 ~BluetoothPairingUITest() override; |
| 20 | 20 |
| 21 void ShowDialog(); | 21 void ShowDialog(); |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> mock_adapter_; | 24 scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> mock_adapter_; |
| 25 scoped_ptr<device::MockBluetoothDevice> mock_device_; | 25 std::unique_ptr<device::MockBluetoothDevice> mock_device_; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 BluetoothPairingUITest::BluetoothPairingUITest() {} | 28 BluetoothPairingUITest::BluetoothPairingUITest() {} |
| 29 | 29 |
| 30 BluetoothPairingUITest::~BluetoothPairingUITest() {} | 30 BluetoothPairingUITest::~BluetoothPairingUITest() {} |
| 31 | 31 |
| 32 void BluetoothPairingUITest::ShowDialog() { | 32 void BluetoothPairingUITest::ShowDialog() { |
| 33 mock_adapter_ = new testing::NiceMock<device::MockBluetoothAdapter>(); | 33 mock_adapter_ = new testing::NiceMock<device::MockBluetoothAdapter>(); |
| 34 device::BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_); | 34 device::BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_); |
| 35 EXPECT_CALL(*mock_adapter_, IsPresent()) | 35 EXPECT_CALL(*mock_adapter_, IsPresent()) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 54 chromeos::BluetoothPairingDialog* dialog = | 54 chromeos::BluetoothPairingDialog* dialog = |
| 55 new chromeos::BluetoothPairingDialog( | 55 new chromeos::BluetoothPairingDialog( |
| 56 browser()->window()->GetNativeWindow(), mock_device_.get()); | 56 browser()->window()->GetNativeWindow(), mock_device_.get()); |
| 57 dialog->Show(); | 57 dialog->Show(); |
| 58 | 58 |
| 59 content::WebUI* webui = dialog->GetWebUIForTest(); | 59 content::WebUI* webui = dialog->GetWebUIForTest(); |
| 60 content::WebContents* webui_webcontents = webui->GetWebContents(); | 60 content::WebContents* webui_webcontents = webui->GetWebContents(); |
| 61 content::WaitForLoadStop(webui_webcontents); | 61 content::WaitForLoadStop(webui_webcontents); |
| 62 SetWebUIInstance(webui); | 62 SetWebUIInstance(webui); |
| 63 } | 63 } |
| OLD | NEW |