| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 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.format.policy_templates.writers.ios_plist_writer''' | 6 '''Unit tests for grit.format.policy_templates.writers.ios_plist_writer''' |
| 7 | 7 |
| 8 | 8 |
| 9 import base64 | 9 import base64 |
| 10 import functools | 10 import functools |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 self._VerifyGeneratedOutput(templates, expected) | 174 self._VerifyGeneratedOutput(templates, expected) |
| 175 | 175 |
| 176 def testStringList(self): | 176 def testStringList(self): |
| 177 templates = self._MakeTemplate('StringListPolicy', 'list', '["a", "b"]') | 177 templates = self._MakeTemplate('StringListPolicy', 'list', '["a", "b"]') |
| 178 expected = { | 178 expected = { |
| 179 'StringListPolicy': [ "a", "b" ], | 179 'StringListPolicy': [ "a", "b" ], |
| 180 } | 180 } |
| 181 self._VerifyGeneratedOutput(templates, expected) | 181 self._VerifyGeneratedOutput(templates, expected) |
| 182 | 182 |
| 183 def testStringEnumList(self): |
| 184 templates = self._MakeTemplate('StringEnumListPolicy', |
| 185 'string-enum-list', '["a", "b"]', |
| 186 ''' |
| 187 'items': [ |
| 188 { 'name': 'Foo', 'value': 'a', 'caption': '' }, |
| 189 { 'name': 'Bar', 'value': 'b', 'caption': '' }, |
| 190 ], |
| 191 ''') |
| 192 |
| 193 expected = { |
| 194 'StringEnumListPolicy': [ "a", "b" ], |
| 195 } |
| 196 self._VerifyGeneratedOutput(templates, expected) |
| 197 |
| 183 def testListOfDictionary(self): | 198 def testListOfDictionary(self): |
| 184 templates = self._MakeTemplate( | 199 templates = self._MakeTemplate( |
| 185 'ManagedBookmarks', 'dict', | 200 'ManagedBookmarks', 'dict', |
| 186 ''' | 201 ''' |
| 187 [ | 202 [ |
| 188 { | 203 { |
| 189 "name": "Google Search", | 204 "name": "Google Search", |
| 190 "url": "www.google.com", | 205 "url": "www.google.com", |
| 191 }, | 206 }, |
| 192 { | 207 { |
| 193 "name": "Youtube", | 208 "name": "Youtube", |
| 194 "url": "www.youtube.com", | 209 "url": "www.youtube.com", |
| 195 } | 210 } |
| 196 ] | 211 ] |
| 197 ''') | 212 ''') |
| 198 expected = { | 213 expected = { |
| 199 'ManagedBookmarks': [ | 214 'ManagedBookmarks': [ |
| 200 { "name": "Google Search", "url": "www.google.com" }, | 215 { "name": "Google Search", "url": "www.google.com" }, |
| 201 { "name": "Youtube", "url": "www.youtube.com" }, | 216 { "name": "Youtube", "url": "www.youtube.com" }, |
| 202 ], | 217 ], |
| 203 } | 218 } |
| 204 self._VerifyGeneratedOutput(templates, expected) | 219 self._VerifyGeneratedOutput(templates, expected) |
| 205 | 220 |
| 206 | 221 |
| 207 if __name__ == '__main__': | 222 if __name__ == '__main__': |
| 208 unittest.main() | 223 unittest.main() |
| OLD | NEW |