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..e945939353bd13c96f1164fb7913c9668e3b2a68 100644 |
--- a/client/site_tests/factory_ExternalStorage/factory_ExternalStorage.py |
+++ b/client/site_tests/factory_ExternalStorage/factory_ExternalStorage.py |
@@ -12,10 +12,6 @@ |
# events for test-switching triggers. This test can be terminated by |
# typing SHIFT-Q. |
-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 +19,12 @@ import pango |
import os |
import sys |
+from autotest_lib.client.bin import factory |
+from autotest_lib.client.bin import factory_test |
+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 +47,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 +62,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 +83,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 = factory_test.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 +108,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__) |