| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """Presubmit script validating field trial configs. | 4 """Presubmit script validating field trial configs. |
| 5 | 5 |
| 6 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 6 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 7 for more details on the presubmit API built into depot_tools. | 7 for more details on the presubmit API built into depot_tools. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import json | 10 import json |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 VALID_GROUP_KEYS = ['group_name', | 13 VALID_GROUP_KEYS = ['group_name', |
| 14 'params', | 14 'params', |
| 15 'enable_features', | 15 'enable_features', |
| 16 'disable_features'] | 16 'disable_features', |
| 17 '//0', |
| 18 '//1', |
| 19 '//2', |
| 20 '//3', |
| 21 '//4', |
| 22 '//5', |
| 23 '//6', |
| 24 '//7', |
| 25 '//8', |
| 26 '//9'] |
| 17 | 27 |
| 18 def PrettyPrint(contents): | 28 def PrettyPrint(contents): |
| 19 """Pretty prints a fieldtrial configuration. | 29 """Pretty prints a fieldtrial configuration. |
| 20 | 30 |
| 21 Args: | 31 Args: |
| 22 contents: File contents as a string. | 32 contents: File contents as a string. |
| 23 | 33 |
| 24 Returns: | 34 Returns: |
| 25 Pretty printed file contents. | 35 Pretty printed file contents. |
| 26 """ | 36 """ |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return CommonChecks(input_api, output_api) | 143 return CommonChecks(input_api, output_api) |
| 134 | 144 |
| 135 | 145 |
| 136 def main(argv): | 146 def main(argv): |
| 137 content = open(argv[1]).read() | 147 content = open(argv[1]).read() |
| 138 pretty = PrettyPrint(content) | 148 pretty = PrettyPrint(content) |
| 139 open(argv[1],'w').write(pretty) | 149 open(argv[1],'w').write(pretty) |
| 140 | 150 |
| 141 if __name__ == "__main__": | 151 if __name__ == "__main__": |
| 142 sys.exit(main(sys.argv)) | 152 sys.exit(main(sys.argv)) |
| OLD | NEW |