xref: /aosp_15_r20/external/autotest/server/site_tests/autoupdate_FromUI/autoupdate_FromUI.py (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Lint as: python2, python3
2# Copyright 2020 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6from autotest_lib.client.common_lib.cros import kernel_utils
7from autotest_lib.server.cros.update_engine import update_engine_test
8
9
10class autoupdate_FromUI(update_engine_test.UpdateEngineTest):
11    """Trigger an update from the UI.
12
13    Start an update by clicking on the 'Check for update' button in the
14    ChromeOS settings menu, instead of calling to update_engine_client
15    directly.
16
17    """
18    version = 1
19    _UI_TEST = 'autoupdate_UpdateFromUI'
20
21
22    def run_once(self, full_payload=True, job_repo_url=None,
23                 running_at_desk=False):
24        """
25        Tests that we can successfully perform an update via the UI.
26
27        @param full_payload: True for a full payload. False for delta.
28        @param job_repo_url: Used for debugging locally. This is used to figure
29                             out the current build and the devserver to use.
30                             The test will read this from a host argument
31                             when run in the lab.
32        @param running_at_desk: True if the test is being run locally.
33
34        """
35        payload_url = self.get_payload_for_nebraska(
36            job_repo_url, full_payload=full_payload,
37            public_bucket=running_at_desk)
38
39        active, inactive = kernel_utils.get_kernel_state(self._host)
40        # Login and click 'Check for update' in the Settings app.
41        self._run_client_test_and_check_result(self._UI_TEST,
42                                               payload_url=payload_url)
43
44        self._host.reboot()
45
46        # Check that the update completed successfully
47        rootfs_hostlog, _ = self._create_hostlog_files()
48        self.verify_update_events(self._CUSTOM_LSB_VERSION, rootfs_hostlog)
49        kernel_utils.verify_boot_expectations(inactive, host=self._host)
50