| Index: platform_tools/android/tests/android_framework_gyp_tests.py
|
| diff --git a/platform_tools/android/tests/gyp_to_android_tests.py b/platform_tools/android/tests/android_framework_gyp_tests.py
|
| similarity index 64%
|
| copy from platform_tools/android/tests/gyp_to_android_tests.py
|
| copy to platform_tools/android/tests/android_framework_gyp_tests.py
|
| index cb2a3e0c8ce44125d43022af2ac382c355ae513f..0b52c6b0383b235f313d1703c55535aa4eecc740 100644
|
| --- a/platform_tools/android/tests/gyp_to_android_tests.py
|
| +++ b/platform_tools/android/tests/android_framework_gyp_tests.py
|
| @@ -16,28 +16,10 @@ import tempfile
|
| import test_variables
|
| import unittest
|
|
|
| -# Path to gyp_to_android
|
| -sys.path.append(test_variables.BIN_DIR)
|
| -
|
| -import gyp_to_android
|
| -
|
| -class AndroidMkCreationTest(unittest.TestCase):
|
| -
|
| - def setUp(self):
|
| - # Create a temporary directory for storing the output (Android.mk)
|
| - self.__tmp_dir = tempfile.mkdtemp()
|
| -
|
| - def test_create(self):
|
| - gyp_to_android.main(self.__tmp_dir)
|
| -
|
| - # Now there should be a file named 'Android.mk' inside __tmp_dir
|
| - path_to_android_mk = os.path.join(self.__tmp_dir, 'Android.mk')
|
| - self.assertTrue(os.path.exists(path_to_android_mk))
|
| -
|
| - def tearDown(self):
|
| - # Remove self.__tmp_dir, which is no longer needed.
|
| - shutil.rmtree(self.__tmp_dir)
|
| +# Path to android_framework_gyp
|
| +sys.path.append(test_variables.GYP_GEN_DIR)
|
|
|
| +import android_framework_gyp
|
|
|
| GYPD_SUFFIX = ".gypd"
|
| GYP_SUFFIX = ".gyp"
|
| @@ -58,32 +40,28 @@ class CleanGypdTest(unittest.TestCase):
|
| self.create_file('%s%s' % (str(i), OTHER_SUFFIX))
|
|
|
| def create_file(self, basename):
|
| - """
|
| - Create a file named 'basename' in self.__tmp_dir.
|
| + """Create a file named 'basename' in self.__tmp_dir.
|
| """
|
| f = tempfile.mkstemp(dir=self.__tmp_dir)
|
| os.rename(f[1], os.path.join(self.__tmp_dir, basename))
|
| self.assert_file_exists(basename)
|
|
|
| def assert_file_exists(self, basename):
|
| - """
|
| - Assert that 'basename' exists in self.__tmp_dir.
|
| + """Assert that 'basename' exists in self.__tmp_dir.
|
| """
|
| full_name = os.path.join(self.__tmp_dir, basename)
|
| self.assertTrue(os.path.exists(full_name))
|
|
|
| def assert_file_does_not_exist(self, basename):
|
| - """
|
| - Assert that 'basename' does not exist in self.__tmp_dir.
|
| + """Assert that 'basename' does not exist in self.__tmp_dir.
|
| """
|
| full_name = os.path.join(self.__tmp_dir, basename)
|
| self.assertFalse(os.path.exists(full_name))
|
|
|
| def test_clean(self):
|
| + """Test that clean_gypd_files() deletes .gypd files, and leaves others.
|
| """
|
| - Test that clean_gypd_files() deletes .gypd files, and leaves others.
|
| - """
|
| - gyp_to_android.clean_gypd_files(self.__tmp_dir)
|
| + android_framework_gyp.clean_gypd_files(self.__tmp_dir)
|
| for i in range(self.__num_files):
|
| self.assert_file_exists('%s%s' % (str(i), GYPI_SUFFIX))
|
| self.assert_file_exists('%s%s' % (str(i), GYP_SUFFIX))
|
| @@ -97,8 +75,7 @@ class CleanGypdTest(unittest.TestCase):
|
|
|
| def main():
|
| loader = unittest.TestLoader()
|
| - suite = loader.loadTestsFromTestCase(AndroidMkCreationTest)
|
| - suite.addTest(loader.loadTestsFromTestCase(CleanGypdTest))
|
| + suite = loader.loadTestsFromTestCase(CleanGypdTest)
|
| unittest.TextTestRunner(verbosity=2).run(suite)
|
|
|
| if __name__ == "__main__":
|
|
|