| 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 | 4 |
| 5 import json | 5 import json |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 import fieldtrial_to_struct | 8 import fieldtrial_to_struct |
| 9 | 9 |
| 10 def _hex(ch): | 10 def _hex(ch): |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 for feature in experiment.get('disable_features', []): | 88 for feature in experiment.get('disable_features', []): |
| 89 disable_features.append(feature + '<' + study_name) | 89 disable_features.append(feature + '<' + study_name) |
| 90 | 90 |
| 91 if not len(studies): | 91 if not len(studies): |
| 92 return [] | 92 return [] |
| 93 _CheckForDuplicateFeatures(enable_features, disable_features) | 93 _CheckForDuplicateFeatures(enable_features, disable_features) |
| 94 args = ['--force-fieldtrials=%s' % '/'.join(studies)] | 94 args = ['--force-fieldtrials=%s' % '/'.join(studies)] |
| 95 if len(params): | 95 if len(params): |
| 96 args.append('--force-fieldtrial-params=%s' % ','.join(params)) | 96 args.append('--force-fieldtrial-params=%s' % ','.join(params)) |
| 97 if len(enable_features): | 97 if len(enable_features): |
| 98 args.append('--enable-features="%s"' % ','.join(enable_features)) | 98 args.append('--enable-features=%s' % ','.join(enable_features)) |
| 99 if len(disable_features): | 99 if len(disable_features): |
| 100 args.append('--disable-features="%s"' % ','.join(disable_features)) | 100 args.append('--disable-features=%s' % ','.join(disable_features)) |
| 101 return args | 101 return args |
| 102 | 102 |
| 103 def main(): | 103 def main(): |
| 104 if len(sys.argv) < 3: | 104 if len(sys.argv) < 3: |
| 105 print 'Usage: fieldtrial_util.py [config_path] [platform]' | 105 print 'Usage: fieldtrial_util.py [config_path] [platform]' |
| 106 exit(-1) | 106 exit(-1) |
| 107 | 107 |
| 108 supported_platforms = ['android', 'chromeos', 'ios', 'linux', 'mac', 'win'] | 108 supported_platforms = ['android', 'chromeos', 'ios', 'linux', 'mac', 'win'] |
| 109 if sys.argv[2] not in supported_platforms: | 109 if sys.argv[2] not in supported_platforms: |
| 110 print ('\'%s\' is an unknown platform. Supported platforms: %s' % | 110 print ('\'%s\' is an unknown platform. Supported platforms: %s' % |
| 111 (sys.argv[2], supported_platforms)) | 111 (sys.argv[2], supported_platforms)) |
| 112 exit(-1) | 112 exit(-1) |
| 113 | 113 |
| 114 print GenerateArgs(sys.argv[1], sys.argv[2]) | 114 print GenerateArgs(sys.argv[1], sys.argv[2]) |
| 115 | 115 |
| 116 if __name__ == '__main__': | 116 if __name__ == '__main__': |
| 117 main() | 117 main() |
| OLD | NEW |