• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 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
5from autotest_lib.client.common_lib.cros import kernel_utils
6from autotest_lib.server.cros.update_engine import update_engine_test
7
8
9class autoupdate_FromUI(update_engine_test.UpdateEngineTest):
10    """Trigger an update from the UI.
11
12    Start an update by clicking on the 'Check for update' button in the
13    Chrome OS settings menu, instead of calling to update_engine_client
14    directly.
15
16    """
17    version = 1
18    _UI_TEST = 'autoupdate_UpdateFromUI'
19
20
21    def run_once(self, full_payload=True, job_repo_url=None,
22                 running_at_desk=False):
23        """
24        Tests that we can successfully perform an update via the UI.
25
26        @param full_payload: True for a full payload. False for delta.
27        @param job_repo_url: Used for debugging locally. This is used to figure
28                             out the current build and the devserver to use.
29                             The test will read this from a host argument
30                             when run in the lab.
31        @param running_at_desk: True if the test is being run locally.
32
33        """
34        payload_url = self.get_payload_for_nebraska(
35            job_repo_url, full_payload=full_payload,
36            public_bucket=running_at_desk)
37
38        active, inactive = kernel_utils.get_kernel_state(self._host)
39        # Login and click 'Check for update' in the Settings app.
40        self._run_client_test_and_check_result(self._UI_TEST,
41                                               payload_url=payload_url)
42
43        self._host.reboot()
44
45        # Check that the update completed successfully
46        rootfs_hostlog, _ = self._create_hostlog_files()
47        self.verify_update_events(self._CUSTOM_LSB_VERSION, rootfs_hostlog)
48        kernel_utils.verify_boot_expectations(inactive, host=self._host)
49