# Copyright (c) 2011 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.

AUTHOR = "ChromeOS Team"
NAME = "cellular_ZeroSignal"
PURPOSE = "Verify cell modem properly deals with signal changes."
CRITERIA = """Modem can loses registeration after signal is lost."""
ATTRIBUTES = "suite:cell_emulator"
SUITE = "cell_emulator"
TIME = "SHORT"
TEST_CATEGORY = "Functional"
TEST_CLASS = "network"
TEST_TYPE = "client"

DOC = """
  Tests that a modem loses registration when the signal stregth goes
  to zero and that it reregisters on a new technology when the a
  technology has a signal.
"""

from autotest_lib.client.cros.cellular import cellular
from autotest_lib.client.cros.cellular import labconfig


config = labconfig.Configuration(args)
technologies = config.get_technologies()
gsm_technologies = [tech for tech in technologies
    if cellular.TechnologyToFamily[tech] == cellular.TechnologyFamily.UMTS]

job.run_test('cellular_Signal',
             config=config,
             technologies=gsm_technologies,
             wait_for_disc=True,
             verify_set_power=True,
             tag='GSM.SetPower.Wait')

job.run_test('cellular_Signal',
             config=config,
             technologies=gsm_technologies,
             wait_for_disc=False,
             verify_set_power=True,
             tag='GSM.SetPower.NoWait')

# TODO(jglasgow): run tests for CDMA technologies