OLD | NEW |
(Empty) | |
| 1 #! /usr/bin/env python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import unittest |
| 8 |
| 9 from pylib import constants |
| 10 from pylib.utils import device_dependencies |
| 11 |
| 12 |
| 13 class DevicePathComponentsForTest(unittest.TestCase): |
| 14 |
| 15 def testCheckedInFile(self): |
| 16 test_path = os.path.join(constants.DIR_SOURCE_ROOT, 'foo', 'bar', 'baz.txt') |
| 17 output_directory = os.path.join( |
| 18 constants.DIR_SOURCE_ROOT, 'out-foo', 'Release') |
| 19 self.assertEquals( |
| 20 [None, 'foo', 'bar', 'baz.txt'], |
| 21 device_dependencies.DevicePathComponentsFor( |
| 22 test_path, output_directory)) |
| 23 |
| 24 def testOutputDirectoryFile(self): |
| 25 test_path = os.path.join(constants.DIR_SOURCE_ROOT, 'out-foo', 'Release', |
| 26 'icudtl.dat') |
| 27 output_directory = os.path.join( |
| 28 constants.DIR_SOURCE_ROOT, 'out-foo', 'Release') |
| 29 self.assertEquals( |
| 30 [None, 'icudtl.dat'], |
| 31 device_dependencies.DevicePathComponentsFor( |
| 32 test_path, output_directory)) |
| 33 |
| 34 def testOutputDirectorySubdirFile(self): |
| 35 test_path = os.path.join(constants.DIR_SOURCE_ROOT, 'out-foo', 'Release', |
| 36 'test_dir', 'icudtl.dat') |
| 37 output_directory = os.path.join( |
| 38 constants.DIR_SOURCE_ROOT, 'out-foo', 'Release') |
| 39 self.assertEquals( |
| 40 [None, 'test_dir', 'icudtl.dat'], |
| 41 device_dependencies.DevicePathComponentsFor( |
| 42 test_path, output_directory)) |
| 43 |
| 44 def testOutputDirectoryPakFile(self): |
| 45 test_path = os.path.join(constants.DIR_SOURCE_ROOT, 'out-foo', 'Release', |
| 46 'foo.pak') |
| 47 output_directory = os.path.join( |
| 48 constants.DIR_SOURCE_ROOT, 'out-foo', 'Release') |
| 49 self.assertEquals( |
| 50 [None, 'paks', 'foo.pak'], |
| 51 device_dependencies.DevicePathComponentsFor( |
| 52 test_path, output_directory)) |
| 53 |
| 54 |
| 55 if __name__ == '__main__': |
| 56 unittest.main() |
OLD | NEW |