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 grit.clique''' | 6 '''Unit tests for grit.clique''' |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 if __name__ == '__main__': | 10 if __name__ == '__main__': |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 <message name="IDS_GREETING" desc="Printed to greet the currently logged i
n user"> | 96 <message name="IDS_GREETING" desc="Printed to greet the currently logged i
n user"> |
97 Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today? | 97 Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today? |
98 </message> | 98 </message> |
99 </messages> | 99 </messages> |
100 <structures> | 100 <structures> |
101 <structure type="dialog" name="IDD_ABOUTBOX" encoding="utf-16" file="grit/
testdata/klonk.rc" /> | 101 <structure type="dialog" name="IDD_ABOUTBOX" encoding="utf-16" file="grit/
testdata/klonk.rc" /> |
102 <structure type="tr_html" name="ID_HTML" file="grit/testdata/simple.html"
/> | 102 <structure type="tr_html" name="ID_HTML" file="grit/testdata/simple.html"
/> |
103 </structures> | 103 </structures> |
104 </release> | 104 </release> |
105 </grit>''')), util.PathFromRoot('.')) | 105 </grit>''')), util.PathFromRoot('.')) |
| 106 resources.SetOutputContext('en', {}) |
106 resources.RunGatherers(True) | 107 resources.RunGatherers(True) |
107 content_list = [] | 108 content_list = [] |
108 for clique_list in resources.UberClique().cliques_.values(): | 109 for clique_list in resources.UberClique().cliques_.values(): |
109 for clique in clique_list: | 110 for clique in clique_list: |
110 content_list.append(clique.GetMessage().GetRealContent()) | 111 content_list.append(clique.GetMessage().GetRealContent()) |
111 self.failUnless('Hello %s, how are you doing today?' in content_list) | 112 self.failUnless('Hello %s, how are you doing today?' in content_list) |
112 self.failUnless('Jack "Black" Daniels' in content_list) | 113 self.failUnless('Jack "Black" Daniels' in content_list) |
113 self.failUnless('Hello!' in content_list) | 114 self.failUnless('Hello!' in content_list) |
114 | 115 |
115 def testCorrectExceptionIfWrongEncodingOnResourceFile(self): | 116 def testCorrectExceptionIfWrongEncodingOnResourceFile(self): |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 return message.GetRealContent().startswith('jjj') | 195 return message.GetRealContent().startswith('jjj') |
195 def ValidateAndModify(self, lang, translation): | 196 def ValidateAndModify(self, lang, translation): |
196 is_ok = self.Validate(translation) | 197 is_ok = self.Validate(translation) |
197 self.ModifyEachTextPart(lang, translation) | 198 self.ModifyEachTextPart(lang, translation) |
198 def ModifyTextPart(self, lang, text): | 199 def ModifyTextPart(self, lang, text): |
199 return 'jjj%s' % text | 200 return 'jjj%s' % text |
200 | 201 |
201 | 202 |
202 if __name__ == '__main__': | 203 if __name__ == '__main__': |
203 unittest.main() | 204 unittest.main() |
OLD | NEW |