146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)# Copyright 2014 The Chromium Authors. All rights reserved. 2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)# Use of this source code is governed by a BSD-style license that can be 3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)# found in the LICENSE file. 4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)import optparse 6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 76e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)import tvcm 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)from telemetry.web_components import web_components_project 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)def Main(port, args): 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) parser = optparse.OptionParser() 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) _, args = parser.parse_args(args) 14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) project = web_components_project.WebComponentsProject() 16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) server = tvcm.DevServer( 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) port=port, project=project) 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) def IsTestModuleResourcePartOfTelemetry(module_resource): 20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return module_resource.absolute_path.startswith(project.telemetry_path) 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) server.test_module_resource_filter = IsTestModuleResourcePartOfTelemetry 23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return server.serve_forever() 24