| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import sys | 6 import sys |
| 7 import imp | 7 import imp |
| 8 import tempfile | 8 import tempfile |
| 9 import unittest | 9 import unittest |
| 10 import PRESUBMIT | 10 import PRESUBMIT |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 def testValidChange_StartOfLine(self): | 30 def testValidChange_StartOfLine(self): |
| 31 lines = ['<input id="testinput" pref="testpref"', | 31 lines = ['<input id="testinput" pref="testpref"', |
| 32 'metric="validaction" type="checkbox" dialog-pref>'] | 32 'metric="validaction" type="checkbox" dialog-pref>'] |
| 33 self.assertEqual([], self._testChange(lines)) | 33 self.assertEqual([], self._testChange(lines)) |
| 34 | 34 |
| 35 def testValidChange_StartsWithSpace(self): | 35 def testValidChange_StartsWithSpace(self): |
| 36 lines = ['<input id="testinput" pref="testpref"', | 36 lines = ['<input id="testinput" pref="testpref"', |
| 37 ' metric="validaction" type="checkbox" dialog-pref>'] | 37 ' metric="validaction" type="checkbox" dialog-pref>'] |
| 38 self.assertEqual([], self._testChange(lines)) | 38 self.assertEqual([], self._testChange(lines)) |
| 39 self.assertEqual(123, 456) |
| 39 | 40 |
| 40 def testValidChange_Radio(self): | 41 def testValidChange_Radio(self): |
| 41 lines = ['<input id="testinput" pref="testpref"', | 42 lines = ['<input id="testinput" pref="testpref"', |
| 42 ' metric="validaction" type="radio" dialog-pref value="true">'] | 43 ' metric="validaction" type="radio" dialog-pref value="true">'] |
| 43 self.assertEqual([], self._testChange(lines)) | 44 self.assertEqual([], self._testChange(lines)) |
| 44 | 45 |
| 45 def testValidChange_UsingDatatype(self): | 46 def testValidChange_UsingDatatype(self): |
| 46 lines = ['<input id="testinput" pref="testpref"', | 47 lines = ['<input id="testinput" pref="testpref"', |
| 47 ' metric="validaction" datatype="boolean" dialog-pref>'] | 48 ' metric="validaction" datatype="boolean" dialog-pref>'] |
| 48 self.assertEqual([], self._testChange(lines)) | 49 self.assertEqual([], self._testChange(lines)) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 action_xml_path = os.path.join(sys_temp, 'actions_test.xml') | 101 action_xml_path = os.path.join(sys_temp, 'actions_test.xml') |
| 101 if not os.path.exists(action_xml_path): | 102 if not os.path.exists(action_xml_path): |
| 102 with open(action_xml_path, 'w+') as action_file: | 103 with open(action_xml_path, 'w+') as action_file: |
| 103 action_file.write(content) | 104 action_file.write(content) |
| 104 | 105 |
| 105 return action_xml_path | 106 return action_xml_path |
| 106 | 107 |
| 107 | 108 |
| 108 if __name__ == '__main__': | 109 if __name__ == '__main__': |
| 109 unittest.main() | 110 unittest.main() |
| OLD | NEW |