blob: e911a01eb04bb0c2c04106570b829f1d37081c99 [file] [log] [blame]
# Copyright 2019 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.
from autotest_lib.client.bin import utils
from autotest_lib.client.common_lib import error
from autotest_lib.client.cros.enterprise import enterprise_policy_base
from telemetry.core import exceptions
class policy_PromptForDownloadLocation(
Test effect of policy_PromptForDownloadLocation policy on Chrome OS.
This test will set the policy, navigate to a test download link, then
check if the file is downloaded or not.
version = 1
POLICY_NAME = 'PromptForDownloadLocation'
def run_once(self, case=None):
Setup and run the test configured for the specified test case.
@param case: Name of the test case to run.
self.setup_case(user_policies={self.POLICY_NAME: case})
# The url is a test URL and doesn't actually load anything, causing
# a Timeout. This is expected and OK.
except exceptions.TimeoutException:
# Check the downloads directory for the file.
files = utils.system_output('ls /home/chronos/user/Downloads/')
if case:
if 'download' in files:
raise error.TestError(
'Download did not prompt for location when it should have.')
if 'download' not in files:
raise error.TestError(
'Download prompted for location when it should not have.')