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

Side by Side Diff: grit/tool/build_unittest.py

Issue 691873002: Add support to override output_all_resource_defines from command line. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: fix .grd, add testOutputAllResourceDefinesFalse Created 6 years, 1 month 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
« no previous file with comments | « grit/tool/build.py ('k') | grit_info.py » ('j') | grit_info.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 the 'grit build' tool. 6 '''Unit tests for the 'grit build' tool.
7 ''' 7 '''
8 8
9 import codecs 9 import codecs
10 import os 10 import os
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 'IDR_STRUCTURE_IN_FALSE_IF_NOT_WHITELISTED', 171 'IDR_STRUCTURE_IN_FALSE_IF_NOT_WHITELISTED',
172 'IDR_INCLUDE_NOT_WHITELISTED', 172 'IDR_INCLUDE_NOT_WHITELISTED',
173 ] 173 ]
174 for output_file in (header, map_cc): 174 for output_file in (header, map_cc):
175 self._verifyWhitelistedOutput( 175 self._verifyWhitelistedOutput(
176 output_file, 176 output_file,
177 whitelisted_ids, 177 whitelisted_ids,
178 non_whitelisted_ids, 178 non_whitelisted_ids,
179 ) 179 )
180 180
181 def testOutputAllResourceDefinesTrue(self):
182 output_dir = tempfile.mkdtemp()
183 builder = build.RcBuilder()
184 class DummyOpts(object):
185 def __init__(self):
186 self.input = util.PathFromRoot('grit/testdata/whitelist_resources.grd')
187 self.verbose = False
188 self.extra_verbose = False
189 whitelist_file = util.PathFromRoot('grit/testdata/whitelist.txt')
190 builder.Run(DummyOpts(), ['-o', output_dir,
191 '-w', whitelist_file,
192 '--output-all-resource-defines',])
193 header = os.path.join(output_dir, 'whitelist_test_resources.h')
194 map_cc = os.path.join(output_dir, 'whitelist_test_resources_map.cc')
195
196 whitelisted_ids = [
197 'IDR_STRUCTURE_WHITELISTED',
198 'IDR_STRUCTURE_NOT_WHITELISTED',
199 'IDR_STRUCTURE_IN_TRUE_IF_WHITELISTED',
200 'IDR_STRUCTURE_IN_TRUE_IF_NOT_WHITELISTED',
201 'IDR_STRUCTURE_IN_FALSE_IF_WHITELISTED',
202 'IDR_STRUCTURE_IN_FALSE_IF_NOT_WHITELISTED',
203 'IDR_INCLUDE_WHITELISTED',
204 'IDR_INCLUDE_NOT_WHITELISTED',
205 ]
206 non_whitelisted_ids = []
207 for output_file in (header, map_cc):
208 self._verifyWhitelistedOutput(
209 output_file,
210 whitelisted_ids,
211 non_whitelisted_ids,
212 )
213
214 def testOutputAllResourceDefinesFalse(self):
215 output_dir = tempfile.mkdtemp()
216 builder = build.RcBuilder()
217 class DummyOpts(object):
218 def __init__(self):
219 self.input = util.PathFromRoot('grit/testdata/whitelist_resources.grd')
220 self.verbose = False
221 self.extra_verbose = False
222 whitelist_file = util.PathFromRoot('grit/testdata/whitelist.txt')
223 builder.Run(DummyOpts(), ['-o', output_dir,
224 '-w', whitelist_file,
225 '--no-output-all-resource-defines',])
226 header = os.path.join(output_dir, 'whitelist_test_resources.h')
227 map_cc = os.path.join(output_dir, 'whitelist_test_resources_map.cc')
228
229 whitelisted_ids = [
230 'IDR_STRUCTURE_WHITELISTED',
231 'IDR_STRUCTURE_IN_TRUE_IF_WHITELISTED',
232 'IDR_INCLUDE_WHITELISTED',
233 ]
234 non_whitelisted_ids = [
235 'IDR_STRUCTURE_NOT_WHITELISTED',
236 'IDR_STRUCTURE_IN_TRUE_IF_NOT_WHITELISTED',
237 'IDR_STRUCTURE_IN_FALSE_IF_WHITELISTED',
238 'IDR_STRUCTURE_IN_FALSE_IF_NOT_WHITELISTED',
239 'IDR_INCLUDE_NOT_WHITELISTED',
240 ]
241 for output_file in (header, map_cc):
242 self._verifyWhitelistedOutput(
243 output_file,
244 whitelisted_ids,
245 non_whitelisted_ids,
246 )
247
181 248
182 if __name__ == '__main__': 249 if __name__ == '__main__':
183 unittest.main() 250 unittest.main()
OLDNEW
« no previous file with comments | « grit/tool/build.py ('k') | grit_info.py » ('j') | grit_info.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698