network_3GSuspendResume: restructure test to report results for autoconnect

restructure the test and the control file so that results are reported
separately for autoconnect=True and autoconnect=False.  This will make
it easier to diagnose test failures.

BUG=chromium-os:17556
TEST=run network_3GSuspendResume

Change-Id: I03a078d3b85975d61ffb7990673ac03065cd3398
Reviewed-on: http://gerrit.chromium.org/gerrit/4310
Tested-by: Jason Glasgow <jglasgow@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
diff --git a/client/site_tests/network_3GSuspendResume/control b/client/site_tests/network_3GSuspendResume/control
index c435a1a..057cac7 100644
--- a/client/site_tests/network_3GSuspendResume/control
+++ b/client/site_tests/network_3GSuspendResume/control
@@ -21,6 +21,8 @@
     Verify that 3g can be enabled under all suspend/resume situations.
 """
 
-job.run_test('network_3GSuspendResume')
-
-job.run_test('network_3GSuspendResume', scenario_group='autoconnect')
+# Run all scenarios twice, first with autoconnect off, then with it on
+job.run_test('network_3GSuspendResume',
+                autoconnect=False, tag='autoconnect_off')
+job.run_test('network_3GSuspendResume',
+                autoconnect=True, tag='autoconnect_on')
diff --git a/client/site_tests/network_3GSuspendResume/network_3GSuspendResume.py b/client/site_tests/network_3GSuspendResume/network_3GSuspendResume.py
index 634ce68..9f75ca9 100644
--- a/client/site_tests/network_3GSuspendResume/network_3GSuspendResume.py
+++ b/client/site_tests/network_3GSuspendResume/network_3GSuspendResume.py
@@ -31,14 +31,11 @@
             'scenario_suspend_3g_enabled',
             'scenario_suspend_3g_disabled',
             'scenario_suspend_3g_disabled_twice',
+            'scenario_autoconnect',
         ],
         'stress': [
             'scenario_suspend_3g_random',
         ],
-        'autoconnect': [
-            'scenario_autoconnect',
-        ]
-
     }
 
     modem_status_outputs = [
@@ -265,29 +262,25 @@
         #     raise error.TestFail('Cellular service was not connectable at '
         #                          'the end of %s' % function_name)
 
-    def run_once(self, scenario_group='all'):
+    def run_once(self, scenario_group='all', autoconnect=False):
         # Replace the test type with the list of tests
         if scenario_group not in network_3GSuspendResume.scenarios.keys():
             scenario_group = 'all'
         logging.info('Running scenario group: %s' % scenario_group)
         scenarios = network_3GSuspendResume.scenarios[scenario_group]
 
-        # Run all scenarios twice, first with autoconnect off, then with
-        # autoconnect on
-        for autoconnect in [False, True]:
+        self.flim = flimflam.FlimFlam(dbus.SystemBus())
+        device = self.__get_cellular_device()
+        if not device:
+            raise error.TestFail('Cannot find cellular device.')
+        self.set_powered(device, 1)
 
-            self.flim = flimflam.FlimFlam(dbus.SystemBus())
-            device = self.__get_cellular_device()
-            if not device:
-                raise error.TestFail('Cannot find cellular device.')
-            self.set_powered(device, 1)
+        service = self.flim.FindCellularService(30)
+        if not service:
+            raise error.TestFail('Cannot find cellular service.')
 
-            service = self.flim.FindCellularService(30)
-            if not service:
-                raise error.TestFail('Cannot find cellular service.')
+        service.SetProperty('AutoConnect', dbus.Boolean(autoconnect))
 
-            service.SetProperty('AutoConnect', dbus.Boolean(autoconnect))
-
-            logging.info('Running scenarios with autoconnect %s.' % autoconnect)
-            for t in scenarios:
-                self.run_scenario(t)
+        logging.info('Running scenarios with autoconnect %s.' % autoconnect)
+        for t in scenarios:
+            self.run_scenario(t)