Chromium Code Reviews| Index: chrome/browser/chromeos/login/hid_detection_browsertest.cc |
| diff --git a/chrome/browser/chromeos/login/hid_detection_browsertest.cc b/chrome/browser/chromeos/login/hid_detection_browsertest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e2e37d8bd74c65365bbc8b1fd96bb22eea9a94c1 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/login/hid_detection_browsertest.cc |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/chromeos/device/input_service_proxy_factory.h" |
| +#include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
| +#include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
| +#include "chrome/browser/chromeos/login/ui/oobe_display.h" |
| +#include "device/bluetooth/bluetooth_adapter_factory.h" |
| +#include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| +#include "testing/gmock/include/gmock/gmock.h" |
| + |
| +using testing::_; |
| + |
| +namespace { |
| + |
| +void SetUpBluetoothMock( |
| + scoped_refptr< |
| + testing::NiceMock<device::MockBluetoothAdapter> > mock_adapter, |
| + bool is_present) { |
| + device::BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); |
| + |
| + EXPECT_CALL(*mock_adapter, IsPresent()) |
| + .WillRepeatedly(testing::Return(is_present)); |
| + |
| + EXPECT_CALL(*mock_adapter, IsPowered()) |
| + .WillRepeatedly(testing::Return(true)); |
| + EXPECT_CALL(*mock_adapter, GetDevices()).WillRepeatedly( |
| + testing::Return(device::BluetoothAdapter::ConstDeviceList())); |
| +} |
| + |
| +} // namespace |
| + |
| +namespace chromeos { |
| + |
| + |
| +class HidDetectionTest : public OobeBaseTest { |
| + public: |
| + HidDetectionTest() {} |
| + |
| + ~HidDetectionTest() override {} |
| + |
| + void SetUpInProcessBrowserTestFixture() override { |
| + OobeBaseTest::SetUpInProcessBrowserTestFixture(); |
| + |
| + mock_adapter_ = new testing::NiceMock<device::MockBluetoothAdapter>(); |
| + SetUpBluetoothMock(mock_adapter_, true); |
| + InputServiceProxyFactory::SetFakeForTesting(true); |
| + } |
| + |
| + private: |
| + scoped_refptr< |
| + testing::NiceMock<device::MockBluetoothAdapter> > mock_adapter_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(HidDetectionTest); |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(HidDetectionTest, NoDevicesConnected) { |
| + OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_HID_DETECTION).Wait(); |
| +} |
| + |
|
Nikita (slow)
2015/02/11 14:53:07
I suggest at least adding one test case that check
merkulova
2015/02/13 10:00:04
Done.
|
| +} // namespace chromeos |