OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/memory/ref_counted.h" | |
6 #include "base/memory/scoped_ptr.h" | |
7 #include "chrome/browser/chromeos/device/input_service_proxy_factory.h" | |
8 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | |
9 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | |
10 #include "chrome/browser/chromeos/login/ui/oobe_display.h" | |
11 #include "device/bluetooth/bluetooth_adapter_factory.h" | |
12 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | |
13 #include "testing/gmock/include/gmock/gmock.h" | |
14 | |
15 using testing::_; | |
16 | |
17 namespace { | |
18 | |
19 void SetUpBluetoothMock( | |
20 scoped_refptr< | |
21 testing::NiceMock<device::MockBluetoothAdapter> > mock_adapter, | |
22 bool is_present) { | |
23 device::BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter); | |
24 | |
25 EXPECT_CALL(*mock_adapter, IsPresent()) | |
26 .WillRepeatedly(testing::Return(is_present)); | |
27 | |
28 EXPECT_CALL(*mock_adapter, IsPowered()) | |
29 .WillRepeatedly(testing::Return(true)); | |
30 EXPECT_CALL(*mock_adapter, GetDevices()).WillRepeatedly( | |
31 testing::Return(device::BluetoothAdapter::ConstDeviceList())); | |
32 } | |
33 | |
34 } // namespace | |
35 | |
36 namespace chromeos { | |
37 | |
38 | |
39 class HidDetectionTest : public OobeBaseTest { | |
40 public: | |
41 HidDetectionTest() {} | |
42 | |
43 ~HidDetectionTest() override {} | |
44 | |
45 void SetUpInProcessBrowserTestFixture() override { | |
46 OobeBaseTest::SetUpInProcessBrowserTestFixture(); | |
47 | |
48 mock_adapter_ = new testing::NiceMock<device::MockBluetoothAdapter>(); | |
49 SetUpBluetoothMock(mock_adapter_, true); | |
50 InputServiceProxyFactory::SetFakeForTesting(true); | |
51 } | |
52 | |
53 private: | |
54 scoped_refptr< | |
55 testing::NiceMock<device::MockBluetoothAdapter> > mock_adapter_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(HidDetectionTest); | |
58 }; | |
59 | |
60 IN_PROC_BROWSER_TEST_F(HidDetectionTest, NoDevicesConnected) { | |
61 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_HID_DETECTION).Wait(); | |
62 } | |
63 | |
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.
| |
64 } // namespace chromeos | |
OLD | NEW |