[autotest] Extract _get_control_file_text_for_suite method

BUG=chromium:672348
TEST=None

Change-Id: Ie313f9ad5c6d112ab0c9f1d7b03669ced079b106
Reviewed-on: https://chromium-review.googlesource.com/453266
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
diff --git a/server/cros/dynamic_suite/suite.py b/server/cros/dynamic_suite/suite.py
index d749293..d913927 100644
--- a/server/cros/dynamic_suite/suite.py
+++ b/server/cros/dynamic_suite/suite.py
@@ -525,17 +525,7 @@
         @returns a dictionary of ControlData objects that based on given
                  parameters.
         """
-        if _should_batch_with(self._cf_getter):
-            suite_info = self._cf_getter.get_suite_info(suite_name=suite_name)
-            files = suite_info.keys()
-            filtered_files = self._filter_cf_paths(files)
-            control_file_texts = self._batch_get_control_file_texts(
-                    suite_info, filtered_files)
-        else:
-            files = self._cf_getter.get_control_file_list(suite_name=suite_name)
-            filtered_files = self._filter_cf_paths(files)
-            control_file_texts = self._nonbatch_get_control_file_texts(
-                    filtered_files)
+        control_file_texts = self._get_control_file_texts_for_suite(suite_name)
         return _parse_control_file_texts(
                 control_file_texts=control_file_texts,
                 forgiving_parser=forgiving_parser,
@@ -574,6 +564,24 @@
             yield path, self._cf_getter.get_control_file_contents(path)
 
 
+    def _get_control_file_texts_for_suite(self, suite_name):
+        """Get control file content for given suite.
+
+        @param suite_name: If specified, this method will attempt to restrain
+                           the search space to just this suite's control files.
+        """
+        if _should_batch_with(self._cf_getter):
+            suite_info = self._cf_getter.get_suite_info(suite_name=suite_name)
+            files = suite_info.keys()
+            filtered_files = self._filter_cf_paths(files)
+            return self._batch_get_control_file_texts(
+                    suite_info, filtered_files)
+        else:
+            files = self._cf_getter.get_control_file_list(suite_name=suite_name)
+            filtered_files = self._filter_cf_paths(files)
+            return self._nonbatch_get_control_file_texts(filtered_files)
+
+
 class _BatchControlFileRetriever(_ControlFileRetriever):
     """Subclass that can retrieve suite control files in batch."""