blob: ed8f5215f28f6e420c951e31e05b55cecd8a2dd7 [file] [log] [blame]
harpreet2cc4d112016-05-19 17:03:19 -07001# Copyright 2016 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 datetime, logging, time
6
7from autotest_lib.client.bin import test
8from autotest_lib.client.common_lib import error
9from autotest_lib.client.common_lib.cros import chrome, cfm_util
10
harpreet32731c72016-06-15 14:03:13 -070011LONG_TIMEOUT = 7
harpreet2cc4d112016-05-19 17:03:19 -070012SHORT_TIMEOUT = 2
13EXT_ID = 'ikfcpmgefdpheiiomgmhlmmkihchmdlj'
14
15
16class enterprise_CFM_SessionStress(test.test):
17 """Stress tests the device in CFM kiosk mode by initiating a new hangout
18 session multiple times.
19 """
20 version = 1
21
22
23 def _run_hangout_session(self, webview_context):
24 """Start a hangout session and do some checks before ending the session.
25
26 @param webview_context: Context for hangouts webview.
27 @raises error.TestFail if any of the checks fail.
28 """
29 current_time = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
30 hangout_name = 'auto-hangout-' + current_time
31 logging.info('Session name: %s', hangout_name)
32
harpreet2cc4d112016-05-19 17:03:19 -070033 cfm_util.start_new_hangout_session(webview_context, hangout_name)
harpreet2cc4d112016-05-19 17:03:19 -070034 time.sleep(LONG_TIMEOUT)
35 cfm_util.end_hangout_session(webview_context)
36
harpreet2cc4d112016-05-19 17:03:19 -070037
38 def run_once(self, repeat):
39 """Runs the test."""
40 with chrome.Chrome(clear_enterprise_policy=False,
41 dont_override_profile=True,
42 disable_gaia_services=False,
43 disable_default_apps=False,
44 auto_login=False) as cr:
45 cfm_webview_context = cfm_util.get_cfm_webview_context(
46 cr.browser, EXT_ID)
47
48 cfm_util.wait_for_telemetry_commands(cfm_webview_context)
49 cfm_util.wait_for_oobe_start_page(cfm_webview_context)
50
51 if not cfm_util.is_oobe_start_page(cfm_webview_context):
52 raise error.TestFail('CFM did not reach oobe screen.')
53
54 cfm_util.skip_oobe_screen(cfm_webview_context)
55
56 while repeat:
57 self._run_hangout_session(cfm_webview_context)
58 time.sleep(SHORT_TIMEOUT)
59 repeat -= 1
60