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

Side by Side Diff: tools/grit/grit/node/misc_unittest.py

Issue 6685061: Compile the devtools grd file into a .pak file so we (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and fix win Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/grit/grit/node/misc.py ('k') | tools/grit/resource_ids » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''Unit tests for misc.GritNode''' 6 '''Unit tests for misc.GritNode'''
7 7
8 8
9 import os 9 import os
10 import sys 10 import sys
(...skipping 11 matching lines...) Expand all
22 22
23 class GritNodeUnittest(unittest.TestCase): 23 class GritNodeUnittest(unittest.TestCase):
24 def testUniqueNameAttribute(self): 24 def testUniqueNameAttribute(self):
25 try: 25 try:
26 restree = grd_reader.Parse( 26 restree = grd_reader.Parse(
27 util.PathFromRoot('grit/test/data/duplicate-name-input.xml')) 27 util.PathFromRoot('grit/test/data/duplicate-name-input.xml'))
28 self.fail('Expected parsing exception because of duplicate names.') 28 self.fail('Expected parsing exception because of duplicate names.')
29 except grit.exception.Parsing: 29 except grit.exception.Parsing:
30 pass # Expected case 30 pass # Expected case
31 31
32 def testReadFirstIdsFromFile(self):
33 test_resource_ids = os.path.join(os.path.dirname(__file__), '..', 'test',
34 'data', 'resource_ids')
35 id_dict = misc._ReadFirstIdsFromFile(
36 test_resource_ids,
37 {
38 'FOO': '/bar',
39 'SHARED_INTERMEDIATE_DIR': '/out/Release/obj/gen',
40 },
41 '')
42 self.assertEqual({}, id_dict.get('bar/file.grd', None))
43 self.assertEqual({},
44 id_dict.get('out/Release/obj/gen/devtools/devtools.grd', None))
45
32 46
33 class IfNodeUnittest(unittest.TestCase): 47 class IfNodeUnittest(unittest.TestCase):
34 def testIffyness(self): 48 def testIffyness(self):
35 grd = grd_reader.Parse(StringIO.StringIO(''' 49 grd = grd_reader.Parse(StringIO.StringIO('''
36 <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> 50 <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
37 <release seq="3"> 51 <release seq="3">
38 <messages> 52 <messages>
39 <if expr="'bingo' in defs"> 53 <if expr="'bingo' in defs">
40 <message name="IDS_BINGO"> 54 <message name="IDS_BINGO">
41 Bingo! 55 Bingo!
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 try: 201 try:
188 formatter = node.ItemFormatter('rc_all') 202 formatter = node.ItemFormatter('rc_all')
189 formatter.Format(node, 'xyz-pseudo') 203 formatter.Format(node, 'xyz-pseudo')
190 except: 204 except:
191 self.fail('Should not have gotten exception since pseudo is allowed') 205 self.fail('Should not have gotten exception since pseudo is allowed')
192 206
193 207
194 if __name__ == '__main__': 208 if __name__ == '__main__':
195 unittest.main() 209 unittest.main()
196 210
OLDNEW
« no previous file with comments | « tools/grit/grit/node/misc.py ('k') | tools/grit/resource_ids » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698