| OLD | NEW | 
|    1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 # Use of this source code is governed by a BSD-style license that can be |    2 # Use of this source code is governed by a BSD-style license that can be | 
|    3 # found in the LICENSE file. |    3 # found in the LICENSE file. | 
|    4  |    4  | 
|    5 import glob |    5 import glob | 
|    6 import logging |    6 import logging | 
|    7 import os |    7 import os | 
|    8  |    8  | 
|    9 from pylib import android_commands |    9 from pylib import android_commands | 
|   10 from pylib import constants |   10 from pylib import constants | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  186         'content/test/data/browser_plugin_focus_child.html', |  186         'content/test/data/browser_plugin_focus_child.html', | 
|  187         'content/test/data/rwhv_compositing_animation.html', |  187         'content/test/data/rwhv_compositing_animation.html', | 
|  188         'content/test/data/click-noreferrer-links.html', |  188         'content/test/data/click-noreferrer-links.html', | 
|  189         'content/test/data/browser_plugin_focus.html', |  189         'content/test/data/browser_plugin_focus.html', | 
|  190         'content/test/data/media', |  190         'content/test/data/media', | 
|  191         'third_party/webgl_conformance', |  191         'third_party/webgl_conformance', | 
|  192     ] |  192     ] | 
|  193   return [] |  193   return [] | 
|  194  |  194  | 
|  195  |  195  | 
|  196 def _GetOptionalDataFilesForTestSuite(test_suite_basename): |  | 
|  197   """Returns a list of data files/dirs that are pushed if present. |  | 
|  198  |  | 
|  199   Args: |  | 
|  200     test_suite_basename: The test suite basename for which to return file paths. |  | 
|  201  |  | 
|  202   Returns: |  | 
|  203     A list of test file and directory paths. |  | 
|  204   """ |  | 
|  205   if test_suite_basename == 'content_browsertests': |  | 
|  206     # See http://crbug.com/105104 for why these are needed. |  | 
|  207     return [ |  | 
|  208     ] |  | 
|  209   return [] |  | 
|  210  |  | 
|  211  |  | 
|  212 def _TestSuiteRequiresMockTestServer(test_suite_basename): |  196 def _TestSuiteRequiresMockTestServer(test_suite_basename): | 
|  213   """Returns True if the test suite requires mock test server.""" |  197   """Returns True if the test suite requires mock test server.""" | 
|  214   tests_require_net_test_server = ['unit_tests', 'net_unittests', |  198   tests_require_net_test_server = ['unit_tests', 'net_unittests', | 
|  215                                    'content_unittests', |  199                                    'content_unittests', | 
|  216                                    'content_browsertests'] |  200                                    'content_browsertests'] | 
|  217   return (test_suite_basename in |  201   return (test_suite_basename in | 
|  218           tests_require_net_test_server) |  202           tests_require_net_test_server) | 
|  219  |  203  | 
|  220  |  204  | 
|  221 class TestRunner(base_test_runner.BaseTestRunner): |  205 class TestRunner(base_test_runner.BaseTestRunner): | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  268           device, |  252           device, | 
|  269           test_suite, |  253           test_suite, | 
|  270           timeout, |  254           timeout, | 
|  271           self._cleanup_test_files, |  255           self._cleanup_test_files, | 
|  272           self.tool, |  256           self.tool, | 
|  273           symbols_dir) |  257           symbols_dir) | 
|  274  |  258  | 
|  275   #override |  259   #override | 
|  276   def InstallTestPackage(self): |  260   def InstallTestPackage(self): | 
|  277     self.test_package.StripAndCopyExecutable() |  261     self.test_package.StripAndCopyExecutable() | 
|  278     self.test_package.PushDataAndPakFiles() |  | 
|  279  |  262  | 
|  280   #override |  263   #override | 
|  281   def PushDataDeps(self): |  264   def PushDataDeps(self): | 
 |  265     self.test_package.PushDataAndPakFiles() | 
|  282     self.tool.CopyFiles() |  266     self.tool.CopyFiles() | 
|  283     test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_basename) |  267     test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_basename) | 
|  284     if test_data: |  268     if test_data: | 
|  285       # Make sure SD card is ready. |  269       # Make sure SD card is ready. | 
|  286       self.adb.WaitForSdCardReady(20) |  270       self.adb.WaitForSdCardReady(20) | 
|  287       for data in test_data: |  271       self.CopyTestData(test_data, self.adb.GetExternalStorage()) | 
|  288         self.CopyTestData([data], self.adb.GetExternalStorage()) |  | 
|  289     optional_test_data = _GetOptionalDataFilesForTestSuite( |  | 
|  290         self.test_package.test_suite_basename) |  | 
|  291     if optional_test_data: |  | 
|  292       self.adb.WaitForSdCardReady(20) |  | 
|  293       for data in optional_test_data: |  | 
|  294         if os.path.exists(data): |  | 
|  295           self.CopyTestData([data], self.adb.GetExternalStorage()) |  | 
|  296     if self.test_package.test_suite_basename == 'webkit_unit_tests': |  272     if self.test_package.test_suite_basename == 'webkit_unit_tests': | 
|  297       self.PushWebKitUnitTestsData() |  273       self.PushWebKitUnitTestsData() | 
|  298  |  274  | 
|  299   def PushWebKitUnitTestsData(self): |  275   def PushWebKitUnitTestsData(self): | 
|  300     """Pushes the webkit_unit_tests data files to the device. |  276     """Pushes the webkit_unit_tests data files to the device. | 
|  301  |  277  | 
|  302     The path of this directory is different when the suite is being run as |  278     The path of this directory is different when the suite is being run as | 
|  303     part of a WebKit check-out. |  279     part of a WebKit check-out. | 
|  304     """ |  280     """ | 
|  305     webkit_src = os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', |  281     webkit_src = os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  367       self.LaunchChromeTestServerSpawner() |  343       self.LaunchChromeTestServerSpawner() | 
|  368     self.tool.SetupEnvironment() |  344     self.tool.SetupEnvironment() | 
|  369  |  345  | 
|  370   #override |  346   #override | 
|  371   def TearDown(self): |  347   def TearDown(self): | 
|  372     """Cleans up the test enviroment for the test suite.""" |  348     """Cleans up the test enviroment for the test suite.""" | 
|  373     self.tool.CleanUpEnvironment() |  349     self.tool.CleanUpEnvironment() | 
|  374     if self._cleanup_test_files: |  350     if self._cleanup_test_files: | 
|  375       self.adb.RemovePushedFiles() |  351       self.adb.RemovePushedFiles() | 
|  376     super(TestRunner, self).TearDown() |  352     super(TestRunner, self).TearDown() | 
| OLD | NEW |