xref: /aosp_15_r20/external/autotest/client/site_tests/power_LoadTest/control.single_page (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright (c) 2012 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
5AUTHOR = "ChromeOS Team"
6NAME = "power_LoadTest.single_page"
7PURPOSE = "Measure power draw when system is under load."
8CRITERIA = "This test is a benchmark."
9TIME = "MEDIUM"
10TEST_CATEGORY = "Benchmark"
11TEST_CLASS = "power"
12TEST_TYPE = "client"
13PY_VERSION = 3
14
15DOC = """
16This test measures the power of a single webpage including stats such as
17cpu usage.
18
19@args: the website url to run the test with
20
21The following manual steps need to be performed on the device under test
22before this test can be run:
23  - make sure that Ethernet cable is disconnected and WiFi is connected
24  - disconnect power cable
25
26You are now ready to run the test.
27"""
28
29# TODO (bleung): Find a way to do automatic Facebook login for test account.
30# TODO (tbroch): Find way to not replicate all these parameters that are common
31# between this control file and the original
32loop_time = 300
33loop_count = 1
34
35# Task format:
36# This sets the tasks variable in the extension directly via javascript.
37#
38# Args:
39# type: [window, cycle] Window will open a window with tabs for the duration of
40# the window. Cycle will cycle through the urls for the duration of the window
41# every delay ms.
42# name: name of the window
43# start: start time (ms)
44# duration: duration of task (ms)
45# delay: time for each url for the cycle type (ms)
46# timeout: time before loading a url times out for the cycle type (ms)
47# focus: whether the window should be in the foreground
48# tabs: list of urls for the window type
49# urls: list of urls to cycle through for the cycle type
50
51# The duration and delay are scaled by 1/12 due to the loop time being 300
52# instead of 3600 seconds. This is why duration is minutes(60) instead of
53# minutes(5) and delay is minutes(12) instead of minutes(1).
54#
55tasks = """
56[
57  {
58    type: 'cycle',
59    name: 'web',
60    start: seconds(1),
61    duration: minutes(60),
62    delay: minutes(12),
63    timeout: seconds(10),
64    focus: true,
65    urls: ['%s'],
66  },
67]
68""" % (args[0])
69
70args_dict = utils.args_to_dict(args)
71pdash_note = args_dict.get('pdash_note', '')
72job.run_test('power_LoadTest', loop_time=loop_time, loop_count=loop_count,
73             test_low_batt_p=6, tasks=tasks, tag=NAME.split('.')[1],
74             pdash_note=pdash_note)
75