Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3832)

Unified Diff: chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc

Issue 2383953002: [Bootstrapping] Introduce an accelerator to put a ChromeOS device into Slave OOBE process. (Closed)
Patch Set: Address the comments. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc
diff --git a/chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc b/chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc
index d47b062c2973813fb9eded03b863257b5860f5ea..1afe36f1b3cf5b88023df0c1237f90062d4628e6 100644
--- a/chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc
+++ b/chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc
@@ -45,33 +45,36 @@ class TestDelegate
} // namespace
-class BluetoothHostPairingTest : public OobeBaseTest {
+// This is the class to simulate the OOBE process for devices that don't have
+// sufficient input, i.e., the first screen of OOBE is the HID detection screen.
+// The device will put itself in Bluetooth discoverable mode.
+class BluetoothHostPairingTestNoInput : public OobeBaseTest {
achuithb 2016/10/05 22:24:10 Isn't BluetoothHostPairingNoInputTest better? I th
xdai1 2016/10/05 23:57:29 Done.
public:
using InputDeviceInfo = device::InputServiceLinux::InputDeviceInfo;
- BluetoothHostPairingTest() {
+ BluetoothHostPairingTestNoInput() {
InputServiceProxy::SetThreadIdForTesting(content::BrowserThread::UI);
input_service_linux_.reset(new device::FakeInputServiceLinux);
device::InputServiceLinux::SetForTesting(input_service_linux_.get());
-
- AddUsbMouse();
- AddUsbKeyboard();
}
- ~BluetoothHostPairingTest() override {}
+ ~BluetoothHostPairingTestNoInput() override {}
// OobeBaseTest override:
void SetUpOnMainThread() override {
OobeBaseTest::SetUpOnMainThread();
delegate_.reset(new TestDelegate);
- controller()->SetDelegateForTesting(delegate_.get());
- bluetooth_adapter_ = controller()->GetAdapterForTesting();
+ if (controller()) {
+ controller()->SetDelegateForTesting(delegate_.get());
+ bluetooth_adapter_ = controller()->GetAdapterForTesting();
+ }
}
pairing_chromeos::BluetoothHostPairingController* controller() {
WizardController* wizard_controller =
achuithb 2016/10/05 22:24:10 You could just get rid of this and inlign below.
xdai1 2016/10/05 23:57:29 Done.
WizardController::default_controller();
- return wizard_controller->GetSharkConnectionListenerForTesting()
- ->GetControllerForTesting();
+ pairing_chromeos::SharkConnectionListener* shark_listener =
+ wizard_controller->GetSharkConnectionListenerForTesting();
+ return shark_listener ? shark_listener->GetControllerForTesting() : nullptr;
}
device::BluetoothAdapter* bluetooth_adapter() {
@@ -112,14 +115,15 @@ class BluetoothHostPairingTest : public OobeBaseTest {
scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
std::unique_ptr<TestDelegate> delegate_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingTest);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingTestNoInput);
};
-// Test that in normal user OOBE login flow, if there is no Bluetooth device
-// connected, the Bluetooth adapter should be disabled when OOBE reaches login
-// screen (which means OOBE has been completed).
-IN_PROC_BROWSER_TEST_F(BluetoothHostPairingTest, NoBluetoothDeviceConnected) {
- OobeScreenWaiter(OobeScreen::SCREEN_OOBE_NETWORK).Wait();
+// Test that in normal user OOBE login flow for devices lacking input devices,
+// if there is no Bluetooth device connected, the Bluetooth adapter should be
+// disabled when OOBE reaches login screen (which means OOBE has been completed)
+IN_PROC_BROWSER_TEST_F(BluetoothHostPairingTestNoInput,
+ NoBluetoothDeviceConnected) {
+ OobeScreenWaiter(OobeScreen::SCREEN_OOBE_HID_DETECTION).Wait();
EXPECT_EQ(bluetooth_adapter()->IsPowered(), true);
WizardController::default_controller()->SkipToLoginForTesting(
LoginScreenContext());
@@ -128,10 +132,12 @@ IN_PROC_BROWSER_TEST_F(BluetoothHostPairingTest, NoBluetoothDeviceConnected) {
EXPECT_EQ(bluetooth_adapter()->IsPowered(), false);
}
-// Test that in normal user OOBE login flow, if there is any Bluetooth device
-// connected, the Bluetooth adapter should not be disabled after OOBE completes.
-IN_PROC_BROWSER_TEST_F(BluetoothHostPairingTest, BluetoothDeviceConnected) {
- OobeScreenWaiter(OobeScreen::SCREEN_OOBE_NETWORK).Wait();
+// Test that in normal user OOBE login flow for devices lacking input devices,
+// if there is any Bluetooth device connected, the Bluetooth adapter should not
+// be disabled after OOBE completes.
+IN_PROC_BROWSER_TEST_F(BluetoothHostPairingTestNoInput,
+ BluetoothDeviceConnected) {
+ OobeScreenWaiter(OobeScreen::SCREEN_OOBE_HID_DETECTION).Wait();
AddBluetoothMouse();
EXPECT_EQ(bluetooth_adapter()->IsPowered(), true);
WizardController::default_controller()->SkipToLoginForTesting(
@@ -141,4 +147,29 @@ IN_PROC_BROWSER_TEST_F(BluetoothHostPairingTest, BluetoothDeviceConnected) {
EXPECT_EQ(bluetooth_adapter()->IsPowered(), true);
}
+// This is the class to simulate the OOBE process for devices that have
+// sufficient input, i.e., the first screen of OOBE is the network screen.
+// The device will not put itself in Bluetooth discoverable mode until the user
+// manually trigger it using the proper accelerator.
+class BluetoothHostPairingTestWithInput
achuithb 2016/10/05 22:24:10 Test last
xdai1 2016/10/05 23:57:29 Done.
+ : public BluetoothHostPairingTestNoInput {
+ public:
+ BluetoothHostPairingTestWithInput() {
+ AddUsbMouse();
+ AddUsbKeyboard();
+ }
+ ~BluetoothHostPairingTestWithInput() override {}
+
+ DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingTestWithInput);
achuithb 2016/10/05 22:24:10 This must be private
xdai1 2016/10/05 23:57:29 Done.
+};
+
+// Test that in normal user OOBE login flow for devices that have input devices,
+// the Bluetooth is disabled by default.
+IN_PROC_BROWSER_TEST_F(BluetoothHostPairingTestWithInput,
+ BluetoothDisableByDefault) {
+ OobeScreenWaiter(OobeScreen::SCREEN_OOBE_NETWORK).Wait();
+ EXPECT_FALSE(controller());
+ EXPECT_FALSE(bluetooth_adapter());
+}
+
} // namespace chromeos
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/startup_utils.cc » ('j') | chrome/browser/chromeos/login/wizard_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698