aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/tests/gyp_to_android_tests.py
blob: 434afd11cebddbf5b30d2ae0d464d76bd2e7a81c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python

# Copyright 2014 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""
Test gyp_to_android.py
"""

import os
import shutil
import sys
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,
                                      test_variables.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)


def main():
  loader = unittest.TestLoader()
  suite = loader.loadTestsFromTestCase(AndroidMkCreationTest)
  unittest.TextTestRunner(verbosity=2).run(suite)

if __name__ == "__main__":
  main()