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