Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/factory.py

Issue 378113003: Modifications to layout test framework so that it can work with browser_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed get_port_class_name() override. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 """Returns an object implementing the Port interface. If 97 """Returns an object implementing the Port interface. If
98 port_name is None, this routine attempts to guess at the most 98 port_name is None, this routine attempts to guess at the most
99 appropriate port on this platform.""" 99 appropriate port on this platform."""
100 port_name = port_name or self._default_port(options) 100 port_name = port_name or self._default_port(options)
101 101
102 # FIXME(steveblock): There's no longer any need to pass '--platform 102 # FIXME(steveblock): There's no longer any need to pass '--platform
103 # chromium' on the command line so we can remove this logic. 103 # chromium' on the command line so we can remove this logic.
104 if port_name == 'chromium': 104 if port_name == 'chromium':
105 port_name = self._host.platform.os_name 105 port_name = self._host.platform.os_name
106 106
107 for port_class in self.PORT_CLASSES: 107 if 'browser_test' in port_name:
108 module_name, class_name = port_class.rsplit('.', 1) 108 module_name, class_name = port_name.rsplit('.', 1)
109 module = __import__(module_name, globals(), locals(), [], -1) 109 module = __import__(module_name, globals(), locals(), [], -1)
110 cls = module.__dict__[class_name] 110 port_class_name = module.get_port_class_name(class_name)
111 if port_name.startswith(cls.port_name): 111 if port_class_name != None:
112 port_name = cls.determine_full_port_name(self._host, options, po rt_name) 112 cls = module.__dict__[port_class_name]
113 port_name = cls.determine_full_port_name(self._host, options, cl ass_name)
113 return cls(self._host, port_name, options=options, **kwargs) 114 return cls(self._host, port_name, options=options, **kwargs)
115 else:
116 for port_class in self.PORT_CLASSES:
117 module_name, class_name = port_class.rsplit('.', 1)
118 module = __import__(module_name, globals(), locals(), [], -1)
119 cls = module.__dict__[class_name]
120 if port_name.startswith(cls.port_name):
121 port_name = cls.determine_full_port_name(self._host, options , port_name)
122 return cls(self._host, port_name, options=options, **kwargs)
114 raise NotImplementedError('unsupported platform: "%s"' % port_name) 123 raise NotImplementedError('unsupported platform: "%s"' % port_name)
115 124
116 def all_port_names(self, platform=None): 125 def all_port_names(self, platform=None):
117 """Return a list of all valid, fully-specified, "real" port names. 126 """Return a list of all valid, fully-specified, "real" port names.
118 127
119 This is the list of directories that are used as actual baseline_paths() 128 This is the list of directories that are used as actual baseline_paths()
120 by real ports. This does not include any "fake" names like "test" 129 by real ports. This does not include any "fake" names like "test"
121 or "mock-mac", and it does not include any directories that are not. 130 or "mock-mac", and it does not include any directories that are not.
122 131
123 If platform is not specified, we will glob-match all ports""" 132 If platform is not specified, we will glob-match all ports"""
124 platform = platform or '*' 133 platform = platform or '*'
125 return fnmatch.filter(builders.all_port_names(), platform) 134 return fnmatch.filter(builders.all_port_names(), platform)
126 135
127 def get_from_builder_name(self, builder_name): 136 def get_from_builder_name(self, builder_name):
128 port_name = builders.port_name_for_builder_name(builder_name) 137 port_name = builders.port_name_for_builder_name(builder_name)
129 assert port_name, "unrecognized builder name '%s'" % builder_name 138 assert port_name, "unrecognized builder name '%s'" % builder_name
130 return self.get(port_name, _builder_options(builder_name)) 139 return self.get(port_name, _builder_options(builder_name))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698