Index: client/site_tests/factory_ExternalStorage/factory_ExternalStorage.py |
diff --git a/client/site_tests/factory_ExternalStorage/factory_ExternalStorage.py b/client/site_tests/factory_ExternalStorage/factory_ExternalStorage.py |
index 51d1cf365b35e927990f0b4db4d7db401df23d6f..022d032008b2b24aff66bf66f17f43b891d1c4d7 100644 |
--- a/client/site_tests/factory_ExternalStorage/factory_ExternalStorage.py |
+++ b/client/site_tests/factory_ExternalStorage/factory_ExternalStorage.py |
@@ -5,17 +5,8 @@ |
# DESCRIPTION : |
# |
-# This is an example factory test that does not really do anything -- |
-# it displays a message in the center of the testing area, as |
-# communicated by arguments to run_once(). This test makes use of the |
-# factory_test library to display its UI, and to monitor keyboard |
-# events for test-switching triggers. This test can be terminated by |
-# typing SHIFT-Q. |
+# This is a factory test to test external SD and USB ports. |
-from autotest_lib.client.bin import test |
-from autotest_lib.client.bin import utils |
-from autotest_lib.client.common_lib import error |
-from autotest_lib.client.common_lib import factory_test |
import gobject |
import gtk |
@@ -23,6 +14,12 @@ import pango |
import os |
import sys |
+from autotest_lib.client.bin import factory |
+from autotest_lib.client.bin import factory_ui_lib as ful |
+from autotest_lib.client.bin import test |
+from autotest_lib.client.bin import utils |
+from autotest_lib.client.common_lib import error |
+ |
_STATE_WAIT_INSERT = 1 |
_STATE_WAIT_REMOVE = 2 |
@@ -45,9 +42,9 @@ class factory_ExternalStorage(test.test): |
def key_release_callback(self, widget, event): |
char = event.keyval in range(32,127) and chr(event.keyval) or None |
- factory_test.XXX_log('key_release_callback %s(%s)' % |
+ factory.log('key_release_callback %s(%s)' % |
(event.keyval, char)) |
- factory_test.test_switch_on_trigger(event) |
+ self._ft_state.exit_on_trigger(event) |
return True |
def register_callbacks(self, window): |
@@ -60,7 +57,7 @@ class factory_ExternalStorage(test.test): |
diff = new_devices - self._devices |
if diff: |
self._devices = new_devices |
- factory_test.XXX_log('found new devs : %s' % diff) |
+ factory.log('found new devs : %s' % diff) |
self._target_device = diff.pop() |
devpath = '/dev/%s' % self._target_device |
self._prompt.set_test('testing drive %s...', devpath) |
@@ -81,13 +78,14 @@ class factory_ExternalStorage(test.test): |
def run_once(self, test_widget_size=None, trigger_set=None, |
result_file_path=None, test_tag_prefix=None, test_count=None): |
- factory_test.XXX_log('factory_ExternalStorage %s %s' % |
- (test_tag_prefix, test_count)) |
+ factory.log('%s run_once' % self.__class__) |
test_tag = '%s_%s' % (test_tag_prefix, test_count) |
+ factory.log('test_tag = %s' % test_tag) |
- factory_test.init(trigger_set=trigger_set, |
- result_file_path=result_file_path) |
+ self._ft_state = ful.State( |
+ trigger_set=trigger_set, |
+ result_file_path=result_file_path) |
label = gtk.Label('') |
label.modify_font(pango.FontDescription('courier new condensed 20')) |
@@ -105,9 +103,9 @@ class factory_ExternalStorage(test.test): |
self._devices = find_all_storage_dev() |
gobject.timeout_add(250, self.rescan_storage, test_tag) |
- factory_test.run_test_widget( |
+ self._ft_state.run_test_widget( |
test_widget=test_widget, |
test_widget_size=test_widget_size, |
window_registration_callback=self.register_callbacks) |
- factory_test.XXX_log('exiting factory_ExternalStorage') |
+ factory.log('%s run_once finished' % self.__class__) |