OLD | NEW |
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 admin template gatherer.''' | 6 '''Unit tests for the admin template gatherer.''' |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 if __name__ == '__main__': | 10 if __name__ == '__main__': |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 <structure type="admin_template" name="IDAT_GOOGLE_DESKTOP_SEARCH" | 78 <structure type="admin_template" name="IDAT_GOOGLE_DESKTOP_SEARCH" |
79 file="GoogleDesktop.adm" exclude_from_rc="true" /> | 79 file="GoogleDesktop.adm" exclude_from_rc="true" /> |
80 <structure type="txt" name="BINGOBONGO" | 80 <structure type="txt" name="BINGOBONGO" |
81 file="README.txt" exclude_from_rc="true" /> | 81 file="README.txt" exclude_from_rc="true" /> |
82 </structures> | 82 </structures> |
83 </release> | 83 </release> |
84 <outputs> | 84 <outputs> |
85 <output filename="de_res.rc" type="rc_all" lang="de" /> | 85 <output filename="de_res.rc" type="rc_all" lang="de" /> |
86 </outputs> | 86 </outputs> |
87 </grit>'''), util.PathFromRoot('grit/testdata')) | 87 </grit>'''), util.PathFromRoot('grit/testdata')) |
| 88 grd.SetOutputContext('en', {}) |
88 grd.RunGatherers(recursive=True) | 89 grd.RunGatherers(recursive=True) |
89 return grd | 90 return grd |
90 | 91 |
91 def testInGrd(self): | 92 def testInGrd(self): |
92 grd = self.MakeGrd() | 93 grd = self.MakeGrd() |
93 cliques = grd.children[0].children[0].children[0].GetCliques() | 94 cliques = grd.children[0].children[0].children[0].GetCliques() |
94 self.VerifyCliquesFromAdmFile(cliques) | 95 self.VerifyCliquesFromAdmFile(cliques) |
95 | 96 |
96 def testFileIsOutput(self): | 97 def testFileIsOutput(self): |
97 grd = self.MakeGrd() | 98 grd = self.MakeGrd() |
98 dirname = tempfile.mkdtemp() | 99 dirname = tempfile.mkdtemp() |
99 try: | 100 try: |
100 tool = build.RcBuilder() | 101 tool = build.RcBuilder() |
101 tool.o = grit_runner.Options() | 102 tool.o = grit_runner.Options() |
102 tool.output_directory = dirname | 103 tool.output_directory = dirname |
103 tool.res = grd | 104 tool.res = grd |
104 tool.Process() | 105 tool.Process() |
105 | 106 |
106 self.failUnless(os.path.isfile( | 107 self.failUnless(os.path.isfile( |
107 os.path.join(dirname, 'de_GoogleDesktop.adm'))) | 108 os.path.join(dirname, 'de_GoogleDesktop.adm'))) |
108 self.failUnless(os.path.isfile( | 109 self.failUnless(os.path.isfile( |
109 os.path.join(dirname, 'de_README.txt'))) | 110 os.path.join(dirname, 'de_README.txt'))) |
110 finally: | 111 finally: |
111 for f in os.listdir(dirname): | 112 for f in os.listdir(dirname): |
112 os.unlink(os.path.join(dirname, f)) | 113 os.unlink(os.path.join(dirname, f)) |
113 os.rmdir(dirname) | 114 os.rmdir(dirname) |
114 | 115 |
115 if __name__ == '__main__': | 116 if __name__ == '__main__': |
116 unittest.main() | 117 unittest.main() |
OLD | NEW |