blob: f77c632fae22b642f6fac3a33dacf2623b507c61 [file] [log] [blame]
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from autotest_lib.client.bin import utils
from autotest_lib.client.common_lib.cros import chrome
from autotest_lib.client.cros.cellular import test_environment
from autotest_lib.client.cros.ui import ui_test_base
from autotest_lib.client.common_lib import error
from telemetry.util import image_util
class ui_SettingsPage(ui_test_base.ui_TestBase):
Collects screenshots of the settings page.
See comments on parent class for overview of how things flow.
def capture_screenshot(self, filepath):
Takes a screenshot of the settings page.
A mask is then drawn over the profile picture. This test runs only
on link at the moment so the dimensions provided are link specific.
Implements the abstract method capture_screenshot.
@param filepath: string, complete path to save screenshot to.
with chrome.Chrome() as cr:
tab = cr.browser.tabs[0]
if not tab.screenshot_supported:
raise error.TestError('Tab did not support taking screenshots')
screenshot = tab.Screenshot()
if screenshot is None:
raise error.TestFailure('Could not capture screenshot')
image_util.WritePngFile(screenshot, filepath)
def run_once(self, mask_points):
# Emulate a modem on the device.
test_env = test_environment.CellularPseudoMMTestEnvironment(
pseudomm_args=({'family': '3GPP'},),
with test_env:
self.mask_points = mask_points
# Check if we should find mobile data in settings
# This should always return true now, since the modem is software
# emulated.
modem_status = utils.system_output('modem status')
if modem_status:'Modem found')
self.tagged_testname += '.mobile'
else:'Modem not found')