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/bind.h" | 5 #include "base/bind.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 "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | 9 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
10 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 10 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 EXPECT_CALL(*mock_adapter, IsPowered()) | 36 EXPECT_CALL(*mock_adapter, IsPowered()) |
37 .WillRepeatedly(testing::Return(true)); | 37 .WillRepeatedly(testing::Return(true)); |
38 EXPECT_CALL(*mock_adapter, GetDevices()).WillRepeatedly( | 38 EXPECT_CALL(*mock_adapter, GetDevices()).WillRepeatedly( |
39 testing::Return(device::BluetoothAdapter::ConstDeviceList())); | 39 testing::Return(device::BluetoothAdapter::ConstDeviceList())); |
40 } | 40 } |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 namespace chromeos { | 44 namespace chromeos { |
45 | 45 |
46 // Boolean parameter is used to run this test for webview (true) and for | 46 class HidDetectionTest : public OobeBaseTest { |
47 // iframe (false) GAIA sign in. | |
48 class HidDetectionTest : public OobeBaseTest, | |
49 public testing::WithParamInterface<bool> { | |
50 public: | 47 public: |
51 typedef device::InputServiceLinux::InputDeviceInfo InputDeviceInfo; | 48 typedef device::InputServiceLinux::InputDeviceInfo InputDeviceInfo; |
52 | 49 |
53 HidDetectionTest() : weak_ptr_factory_(this) { | 50 HidDetectionTest() : weak_ptr_factory_(this) { |
54 set_use_webview(GetParam()); | |
55 InputServiceProxy::SetThreadIdForTesting(content::BrowserThread::UI); | 51 InputServiceProxy::SetThreadIdForTesting(content::BrowserThread::UI); |
56 HidDetectionTest::InitInputService(); | 52 HidDetectionTest::InitInputService(); |
57 } | 53 } |
58 | 54 |
59 ~HidDetectionTest() override {} | 55 ~HidDetectionTest() override {} |
60 | 56 |
61 void InitInputService() { | 57 void InitInputService() { |
62 input_service_linux_.reset(new device::FakeInputServiceLinux); | 58 input_service_linux_.reset(new device::FakeInputServiceLinux); |
63 InputServiceLinux::SetForTesting(input_service_linux_.get()); | 59 InputServiceLinux::SetForTesting(input_service_linux_.get()); |
64 } | 60 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 HidDetectionSkipTest() { | 105 HidDetectionSkipTest() { |
110 AddUsbMouse("mouse"); | 106 AddUsbMouse("mouse"); |
111 AddUsbKeyboard("keyboard"); | 107 AddUsbKeyboard("keyboard"); |
112 } | 108 } |
113 | 109 |
114 void SetUpOnMainThread() override { | 110 void SetUpOnMainThread() override { |
115 HidDetectionTest::SetUpOnMainThread(); | 111 HidDetectionTest::SetUpOnMainThread(); |
116 } | 112 } |
117 }; | 113 }; |
118 | 114 |
119 IN_PROC_BROWSER_TEST_P(HidDetectionTest, NoDevicesConnected) { | 115 IN_PROC_BROWSER_TEST_F(HidDetectionTest, NoDevicesConnected) { |
120 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_HID_DETECTION).Wait(); | 116 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_HID_DETECTION).Wait(); |
121 } | 117 } |
122 | 118 |
123 IN_PROC_BROWSER_TEST_P(HidDetectionSkipTest, BothDevicesPreConnected) { | 119 IN_PROC_BROWSER_TEST_F(HidDetectionSkipTest, BothDevicesPreConnected) { |
124 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_NETWORK).Wait(); | 120 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_NETWORK).Wait(); |
| 121 |
125 } | 122 } |
126 | 123 |
127 INSTANTIATE_TEST_CASE_P(HidDetectionSuite, HidDetectionTest, testing::Bool()); | |
128 INSTANTIATE_TEST_CASE_P(HidDetectionSkipSuite, | |
129 HidDetectionSkipTest, | |
130 testing::Bool()); | |
131 | |
132 } // namespace chromeos | 124 } // namespace chromeos |
OLD | NEW |