• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2015 The Chromium OS 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
5import logging, time
6
7from autotest_lib.server import autotest, test
8
9
10class cellular_ChromeEndToEnd(test.test):
11    """Reboots the DUT and runs clients side tests to test cellular UI.
12
13    """
14    version = 1
15
16
17    def _cold_reboot_dut(self, boot_id):
18        """Cold reboot the dut.
19
20        @param boot_id: DUT boot_id.
21
22        """
23        self._servo.get_power_state_controller().power_off()
24        self._servo.get_power_state_controller().power_on()
25        time.sleep(self._servo.BOOT_DELAY)
26        self._client.wait_for_restart(old_boot_id=boot_id)
27
28
29    def run_once(self, host, test):
30        """Runs the test.
31
32        @param host: A host object representing the DUT.
33        @param test: Cellular UI test to execute.
34
35        """
36
37        self._client = host
38        self._servo = host.servo
39
40        if not self._servo:
41            logging.info('Host %s does not have a servo.', host.hostname)
42            return
43
44        boot_id = self._client.get_boot_id()
45        self._cold_reboot_dut(boot_id)
46
47        client_at = autotest.Autotest(self._client)
48        client_at.run_test('network_ChromeCellularEndToEnd',
49                           test=test, check_client_result=True)
50