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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py

Issue 2644783003: Regenerate MANIFEST.json when WPT tests are run (Closed)
Patch Set: Regenerate MANIFEST.json from template in run-webkit-tests Created 3 years, 9 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) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 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 13 matching lines...) Expand all
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 from webkitpy.common.config.builders import BUILDERS 29 from webkitpy.common.config.builders import BUILDERS
30 from webkitpy.common.checkout.git_mock import MockGit 30 from webkitpy.common.checkout.git_mock import MockGit
31 from webkitpy.common.net.buildbot_mock import MockBuildBot 31 from webkitpy.common.net.buildbot_mock import MockBuildBot
32 from webkitpy.common.net.web_mock import MockWeb 32 from webkitpy.common.net.web_mock import MockWeb
33 from webkitpy.common.system.system_host_mock import MockSystemHost 33 from webkitpy.common.system.system_host_mock import MockSystemHost
34 from webkitpy.common.webkit_finder import WebKitFinder
34 35
35 # New-style ports need to move down into webkitpy.common. 36 # New-style ports need to move down into webkitpy.common.
36 from webkitpy.layout_tests.builder_list import BuilderList 37 from webkitpy.layout_tests.builder_list import BuilderList
37 from webkitpy.layout_tests.port.factory import PortFactory 38 from webkitpy.layout_tests.port.factory import PortFactory
38 from webkitpy.layout_tests.port.test import add_unit_tests_to_mock_filesystem 39 from webkitpy.layout_tests.port.test import add_unit_tests_to_mock_filesystem
39 40
40 41
41 class MockHost(MockSystemHost): 42 class MockHost(MockSystemHost):
42 43
43 def __init__(self, 44 def __init__(self,
44 log_executive=False, 45 log_executive=False,
45 web=None, 46 web=None,
46 git=None, 47 git=None,
47 os_name=None, 48 os_name=None,
48 os_version=None, 49 os_version=None,
49 time_return_val=123): 50 time_return_val=123):
50 super(MockHost, self).__init__( 51 super(MockHost, self).__init__(
51 log_executive=log_executive, 52 log_executive=log_executive,
52 os_name=os_name, 53 os_name=os_name,
53 os_version=os_version, 54 os_version=os_version,
54 time_return_val=time_return_val) 55 time_return_val=time_return_val)
55 56
56 add_unit_tests_to_mock_filesystem(self.filesystem) 57 add_unit_tests_to_mock_filesystem(self.filesystem)
58 self._add_base_manifest_to_mock_filesystem(self.filesystem)
57 self.web = web or MockWeb() 59 self.web = web or MockWeb()
58 self._git = git 60 self._git = git
59 61
60 self.buildbot = MockBuildBot() 62 self.buildbot = MockBuildBot()
61 63
62 # Note: We're using a real PortFactory here. Tests which don't wish to depend 64 # Note: We're using a real PortFactory here. Tests which don't wish to depend
63 # on the list of known ports should override this with a MockPortFactory . 65 # on the list of known ports should override this with a MockPortFactory .
64 self.port_factory = PortFactory(self) 66 self.port_factory = PortFactory(self)
65 67
66 self.builders = BuilderList(BUILDERS) 68 self.builders = BuilderList(BUILDERS)
67 69
68 def git(self, path=None): 70 def git(self, path=None):
69 if path: 71 if path:
70 return MockGit(cwd=path, filesystem=self.filesystem, executive=self. executive) 72 return MockGit(cwd=path, filesystem=self.filesystem, executive=self. executive)
71 if not self._git: 73 if not self._git:
72 self._git = MockGit(filesystem=self.filesystem, executive=self.execu tive) 74 self._git = MockGit(filesystem=self.filesystem, executive=self.execu tive)
73 # Various pieces of code (wrongly) call filesystem.chdir(checkout_root). 75 # Various pieces of code (wrongly) call filesystem.chdir(checkout_root).
74 # Making the checkout_root exist in the mock filesystem makes that chdir not raise. 76 # Making the checkout_root exist in the mock filesystem makes that chdir not raise.
75 self.filesystem.maybe_make_directory(self._git.checkout_root) 77 self.filesystem.maybe_make_directory(self._git.checkout_root)
76 return self._git 78 return self._git
79
80 def _add_base_manifest_to_mock_filesystem(self, filesystem):
81 webkit_finder = WebKitFinder(filesystem)
82 wpt_dir = webkit_finder.path_from_webkit_base('LayoutTests', 'external', 'wpt')
83 filesystem.maybe_make_directory(wpt_dir)
84
85 manifest_base_path = webkit_finder.path_from_webkit_base(
86 'LayoutTests', 'external', 'WPT_BASE_MANIFEST.json')
foolip 2017/02/28 04:49:17 Had an idea while looking at this line. Would it b
qyearsley 2017/02/28 18:54:45 This sounds reasonable to me -- I'd be fine with t
87 filesystem.files[manifest_base_path] = '{}'
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698