| OLD | NEW |
| 1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 | 6 |
| 7 # DESCRIPTION : factory test of ambient light sensor. Test that ALS reacts to | 7 # DESCRIPTION : factory test of ambient light sensor. Test that ALS reacts to |
| 8 # both darkening by covering w/ finger as well as brightening. | 8 # both darkening by covering w/ finger as well as brightening. |
| 9 # Roughly speaking: | 9 # Roughly speaking: |
| 10 # indoor ambient lighting: 20-100 | 10 # indoor ambient lighting: 20-100 |
| 11 # sunlight direct: 30k-60k | 11 # sunlight direct: 30k-60k |
| 12 # flashlight direct: 5k-10k | 12 # flashlight direct: 5k-10k |
| 13 | 13 |
| 14 | 14 |
| 15 import gobject | 15 import gobject |
| 16 import gtk | 16 import gtk |
| 17 import logging | 17 import logging |
| 18 import math | 18 import math |
| 19 import os | 19 import os |
| 20 import sys | 20 import sys |
| 21 import time | 21 import time |
| 22 | 22 |
| 23 from autotest_lib.client.bin import factory | 23 from autotest_lib.client.bin import factory |
| 24 from autotest_lib.client.bin import factory_ui_lib as ful | 24 from autotest_lib.client.bin import factory_ui_lib as ful |
| 25 from autotest_lib.client.bin import test | 25 from autotest_lib.client.bin import test |
| 26 from autotest_lib.client.common_lib import error | 26 from autotest_lib.client.bin import factory_error as error |
| 27 from autotest_lib.client.common_lib import utils | 27 from autotest_lib.client.common_lib import utils |
| 28 | 28 |
| 29 _LABEL_STATUS_SIZE = (140, 30) | 29 _LABEL_STATUS_SIZE = (140, 30) |
| 30 _LABEL_RESPONSE_STR = ful.USER_PASS_FAIL_SELECT_STR + '\n' | 30 _LABEL_RESPONSE_STR = ful.USER_PASS_FAIL_SELECT_STR + '\n' |
| 31 | 31 |
| 32 _SUBTEST_LIST = ['Light sensor dark', 'Light sensor light'] | 32 _SUBTEST_LIST = ['Light sensor dark', 'Light sensor light'] |
| 33 _SUBTEST_CFG = {'Light sensor dark':{'min':4}, | 33 _SUBTEST_CFG = {'Light sensor dark':{'min':4}, |
| 34 'Light sensor light':{'max':1000}} | 34 'Light sensor light':{'max':1000}} |
| 35 | 35 |
| 36 class tsl2563(): | 36 class tsl2563(): |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ful.run_test_widget(self.job, vbox, | 207 ful.run_test_widget(self.job, vbox, |
| 208 window_registration_callback=self.register_callbacks) | 208 window_registration_callback=self.register_callbacks) |
| 209 | 209 |
| 210 failed_set = set(name for name, status in self._status_map.items() | 210 failed_set = set(name for name, status in self._status_map.items() |
| 211 if status is not ful.PASSED) | 211 if status is not ful.PASSED) |
| 212 if failed_set: | 212 if failed_set: |
| 213 raise error.TestFail('some subtests failed (%s)' % | 213 raise error.TestFail('some subtests failed (%s)' % |
| 214 ', '.join(failed_set)) | 214 ', '.join(failed_set)) |
| 215 | 215 |
| 216 factory.log('%s run_once finished' % self.__class__) | 216 factory.log('%s run_once finished' % self.__class__) |
| OLD | NEW |