Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: tools/grit/grit/format/data_pack_unittest.py

Issue 1968993002: Compressing .pak resources with new option: "type=GZIPPABLE_BINDATA" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Python formatting Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/grit/grit/exception.py ('k') | tools/grit/grit/format/gzip_string.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/format/data_pack_unittest.py
diff --git a/tools/grit/grit/format/data_pack_unittest.py b/tools/grit/grit/format/data_pack_unittest.py
index f6e9edcfcb6c99799e76d8c4230c3fddb66793aa..d677531e78abea18659539adc3317cf82f7638b9 100755
--- a/tools/grit/grit/format/data_pack_unittest.py
+++ b/tools/grit/grit/format/data_pack_unittest.py
@@ -13,6 +13,7 @@ if __name__ == '__main__':
import unittest
+from grit import exception
from grit.format import data_pack
@@ -32,6 +33,39 @@ class FormatDataPackUnittest(unittest.TestCase):
output = data_pack.WriteDataPackToString(input, data_pack.UTF8)
self.failUnless(output == expected)
+ def testIncludeWithReservedHeader(self):
+ from grit import util
+ from grit.node import misc, include, empty
+ root = misc.GritNode()
+ root.StartParsing(u'grit', None)
+ root.HandleAttribute(u'latest_public_release', u'0')
+ root.HandleAttribute(u'current_release', u'1')
+ root.HandleAttribute(u'base_dir', ur'..\resource')
+ release = misc.ReleaseNode()
+ release.StartParsing(u'release', root)
+ release.HandleAttribute(u'seq', u'1')
+ root.AddChild(release)
+ includes = empty.IncludesNode()
+ includes.StartParsing(u'includes', release)
+ release.AddChild(includes)
+ include_node = include.IncludeNode()
+ include_node.StartParsing(u'include', includes)
+ include_node.HandleAttribute(u'name', u'test')
+ include_node.HandleAttribute(u'type', u'BINDATA')
+ include_node.HandleAttribute(u'file', u'doesntmatter')
+ includes.AddChild(include_node)
+ include_node.EndParsing()
+ root.EndParsing()
+
+ ReadFile_copy = util.ReadFile
+ try:
+ util.ReadFile = lambda a, b: include.IncludeNode.RESERVED_HEADER
+ with self.assertRaises(exception.ReservedHeaderCollision):
+ data_pack.Format(root)
+
+ finally:
+ util.ReadFile = ReadFile_copy
+
def testRePackUnittest(self):
expected_with_whitelist = {
1: 'Never gonna', 10: 'give you up', 20: 'Never gonna let',
« no previous file with comments | « tools/grit/grit/exception.py ('k') | tools/grit/grit/format/gzip_string.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698