tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

host_paths_unittest.py (1778B)


      1 #!/usr/bin/env python3
      2 # Copyright 2018 The Chromium Authors
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 
      7 import logging
      8 import os
      9 import unittest
     10 
     11 import pylib.constants as constants
     12 import pylib.constants.host_paths as host_paths
     13 
     14 # This map corresponds to the binprefix of NDK prebuilt toolchains for various
     15 # target CPU architectures. Note that 'x86_64' and 'x64' are the same.
     16 _EXPECTED_NDK_TOOL_SUBDIR_MAP = {
     17  'arm': 'toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/' +
     18         'arm-linux-androideabi-',
     19  'arm64':
     20      'toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/' +
     21      'aarch64-linux-android-',
     22  'x86': 'toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-',
     23  'x86_64':
     24      'toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-',
     25  'x64':
     26      'toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-',
     27   'mips':
     28      'toolchains/mipsel-linux-android-4.9/prebuilt/linux-x86_64/bin/' +
     29      'mipsel-linux-android-'
     30 }
     31 
     32 
     33 class HostPathsTest(unittest.TestCase):
     34  def setUp(self):
     35    logging.getLogger().setLevel(logging.ERROR)
     36 
     37  def test_GetAaptPath(self):
     38    _EXPECTED_AAPT_PATH = os.path.join(constants.ANDROID_SDK_TOOLS, 'aapt')
     39    self.assertEqual(host_paths.GetAaptPath(), _EXPECTED_AAPT_PATH)
     40    self.assertEqual(host_paths.GetAaptPath(), _EXPECTED_AAPT_PATH)
     41 
     42  def test_ToolPath(self):
     43    for cpu_arch, binprefix in _EXPECTED_NDK_TOOL_SUBDIR_MAP.items():
     44      expected_binprefix = os.path.join(constants.ANDROID_NDK_ROOT, binprefix)
     45      expected_path = expected_binprefix + 'foo'
     46      self.assertEqual(host_paths.ToolPath('foo', cpu_arch), expected_path)
     47 
     48 
     49 if __name__ == '__main__':
     50  unittest.main()