| Index: tools/grit/grit/node/include_unittest.py
|
| diff --git a/tools/grit/grit/node/include_unittest.py b/tools/grit/grit/node/include_unittest.py
|
| index e5544281fd0ad76dc9a988e1bd4281ee33d5349c..2b29e11815179880aed331ba4a221af5b6d78aab 100755
|
| --- a/tools/grit/grit/node/include_unittest.py
|
| +++ b/tools/grit/grit/node/include_unittest.py
|
| @@ -11,8 +11,8 @@ if __name__ == '__main__':
|
| sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
|
|
|
| import os
|
| -import StringIO
|
| import unittest
|
| +import zlib
|
|
|
| from grit.node import misc
|
| from grit.node import include
|
| @@ -69,6 +69,21 @@ class IncludeNodeUnittest(unittest.TestCase):
|
| util.normpath(
|
| os.path.join(ur'../', ur'flugel/kugel.pdf')))
|
|
|
| + def testCompressGzip(self):
|
| + root = util.ParseGrdForUnittest('''
|
| + <includes>
|
| + <include name="TEST_TXT" file="test_text.txt"
|
| + compress="gzip" type="BINDATA"/>
|
| + </includes>''', base_dir = util.PathFromRoot('grit/testdata'))
|
| + inc, = root.GetChildrenOfType(include.IncludeNode)
|
| + throwaway, compressed = inc.GetDataPackPair(lang='en', encoding=1)
|
| +
|
| + # compressed[1:] ensures we skip the special inserted first byte.
|
| + decompressed_data = zlib.decompress(compressed[1:], 16 + zlib.MAX_WBITS)
|
| + self.assertEqual(util.ReadFile(util.PathFromRoot('grit/testdata')
|
| + + "/test_text.txt", util.BINARY),
|
| + decompressed_data)
|
| +
|
|
|
| if __name__ == '__main__':
|
| unittest.main()
|
|
|