| OLD | NEW |
| 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 sys | 5 import sys |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 | 9 |
| 10 def _AddToPathIfNeeded(path): | 10 def _AddToPathIfNeeded(path): |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 all_filenames = set() | 29 all_filenames = set() |
| 30 for source_path in source_paths: | 30 for source_path in source_paths: |
| 31 for dirpath, _, filenames in os.walk(source_path): | 31 for dirpath, _, filenames in os.walk(source_path): |
| 32 for f in filenames: | 32 for f in filenames: |
| 33 if f.startswith('.'): | 33 if f.startswith('.'): |
| 34 continue | 34 continue |
| 35 x = os.path.abspath(os.path.join(dirpath, f)) | 35 x = os.path.abspath(os.path.join(dirpath, f)) |
| 36 all_filenames.add(x) | 36 all_filenames.add(x) |
| 37 return all_filenames | 37 return all_filenames |
| 38 | 38 |
| 39 |
| 40 def _IsFilenameACmdline(x): |
| 41 if x.endswith('_cmdline.html'): |
| 42 return True |
| 43 return False |
| 44 |
| 45 |
| 39 def _IsFilenameATest(x): | 46 def _IsFilenameATest(x): |
| 40 if x.endswith('_test.js'): | 47 if x.endswith('_test.js'): |
| 41 return True | 48 return True |
| 42 | 49 |
| 43 if x.endswith('_test.html'): | 50 if x.endswith('_test.html'): |
| 44 return True | 51 return True |
| 45 | 52 |
| 46 if x.endswith('_unittest.js'): | 53 if x.endswith('_unittest.js'): |
| 47 return True | 54 return True |
| 48 | 55 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 _IsFilenameATest(x) and pred(x)] | 145 _IsFilenameATest(x) and pred(x)] |
| 139 test_module_filenames.sort() | 146 test_module_filenames.sort() |
| 140 | 147 |
| 141 return [os.path.relpath(x, self.tracing_root_path) | 148 return [os.path.relpath(x, self.tracing_root_path) |
| 142 for x in test_module_filenames] | 149 for x in test_module_filenames] |
| 143 | 150 |
| 144 def FindAllMetricsModuleRelPaths(self): | 151 def FindAllMetricsModuleRelPaths(self): |
| 145 all_filenames = _FindAllFilesRecursive([self.tracing_src_path]) | 152 all_filenames = _FindAllFilesRecursive([self.tracing_src_path]) |
| 146 all_metrics_module_filenames = [] | 153 all_metrics_module_filenames = [] |
| 147 for x in all_filenames: | 154 for x in all_filenames: |
| 148 if x.startswith(self.metrics_path) and not _IsFilenameATest(x): | 155 if (x.startswith(self.metrics_path) and not _IsFilenameATest(x) and |
| 156 not _IsFilenameACmdline(x)): |
| 149 all_metrics_module_filenames.append(x) | 157 all_metrics_module_filenames.append(x) |
| 150 all_metrics_module_filenames.sort() | 158 all_metrics_module_filenames.sort() |
| 151 return [os.path.relpath(x, self.tracing_root_path) | 159 return [os.path.relpath(x, self.tracing_root_path) |
| 152 for x in all_metrics_module_filenames] | 160 for x in all_metrics_module_filenames] |
| 153 | 161 |
| 154 def FindAllD8TestModuleRelPaths(self): | 162 def FindAllD8TestModuleRelPaths(self): |
| 155 return self.FindAllTestModuleRelPaths(pred=self.IsD8CompatibleFile) | 163 return self.FindAllTestModuleRelPaths(pred=self.IsD8CompatibleFile) |
| 156 | 164 |
| 157 def GetConfigNames(self): | 165 def GetConfigNames(self): |
| 158 config_files = [ | 166 config_files = [ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 176 choices = self.GetConfigNames() | 184 choices = self.GetConfigNames() |
| 177 parser.add_argument( | 185 parser.add_argument( |
| 178 '--config', dest='config_name', | 186 '--config', dest='config_name', |
| 179 choices=choices, default=self.GetDefaultConfigName(), | 187 choices=choices, default=self.GetDefaultConfigName(), |
| 180 help='Picks a browser config. Valid choices: %s' % ', '.join(choices)) | 188 help='Picks a browser config. Valid choices: %s' % ', '.join(choices)) |
| 181 return choices | 189 return choices |
| 182 | 190 |
| 183 def GetModuleNameForConfigName(self, config_name): | 191 def GetModuleNameForConfigName(self, config_name): |
| 184 return 'tracing.ui.extras.%s_config' % config_name | 192 return 'tracing.ui.extras.%s_config' % config_name |
| 185 | 193 |
| OLD | NEW |