pak_util_unittest.py 704 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python3
  2. # Copyright 2021 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. import os
  6. import shutil
  7. import sys
  8. import tempfile
  9. import unittest
  10. import pak_util
  11. class PackUtilTest(unittest.TestCase):
  12. def test_extract(self):
  13. tempdir = tempfile.mkdtemp()
  14. old_argv = sys.argv
  15. grit_root_dir = os.path.abspath(os.path.dirname(__file__))
  16. sys.argv = [
  17. 'pak_util_unittest.py', 'extract',
  18. os.path.join(grit_root_dir, 'grit/testdata/resources.pak'), '-o',
  19. tempdir
  20. ]
  21. pak_util.main()
  22. sys.argv = old_argv
  23. shutil.rmtree(tempdir, ignore_errors=True)