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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater_unittest.py

Issue 2639283005: Add NOEXPORT=true commit message whenever import script is run. (Closed)
Patch Set: Add test for NOEXPORT tag movement Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 unittest 5 import unittest
6 6
7 from webkitpy.common.host_mock import MockHost 7 from webkitpy.common.host_mock import MockHost
8 from webkitpy.common.system.executive_mock import MockExecutive 8 from webkitpy.common.system.executive_mock import MockExecutive
9 from webkitpy.w3c.deps_updater import DepsUpdater 9 from webkitpy.w3c.deps_updater import DepsUpdater
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 updater._has_changes = lambda: True 68 updater._has_changes = lambda: True
69 updater._commit_changes('dummy message') 69 updater._commit_changes('dummy message')
70 self.assertEqual( 70 self.assertEqual(
71 host.executive.calls, 71 host.executive.calls,
72 [['git', 'commit', '--all', '-F', '-']]) 72 [['git', 'commit', '--all', '-F', '-']])
73 73
74 def test_commit_message(self): 74 def test_commit_message(self):
75 updater = DepsUpdater(MockHost()) 75 updater = DepsUpdater(MockHost())
76 self.assertEqual( 76 self.assertEqual(
77 updater._commit_message('aaaa', '1111'), 77 updater._commit_message('aaaa', '1111'),
78 'Import 1111\n\nUsing update-w3c-deps in Chromium aaaa.\n\n') 78 'Import 1111\n\n'
79 'Using update-w3c-deps in Chromium aaaa.\n\n'
80 'NOEXPORT=true')
79 81
80 def test_cl_description_with_empty_environ(self): 82 def test_cl_description_with_empty_environ(self):
81 host = MockHost() 83 host = MockHost()
82 host.executive = MockExecutive(output='Last commit message\n') 84 host.executive = MockExecutive(output='Last commit message\n')
83 updater = DepsUpdater(host) 85 updater = DepsUpdater(host)
84 description = updater._cl_description() 86 description = updater._cl_description()
85 self.assertEqual( 87 self.assertEqual(
86 description, 88 description,
87 ('Last commit message\n' 89 ('Last commit message\n'
88 'TBR=qyearsley@chromium.org\n' 90 'TBR=qyearsley@chromium.org\n'
89 'NOEXPORT=true')) 91 'NOEXPORT=true'))
90 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']]) 92 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']])
91 93
92 def test_cl_description_with_environ_variables(self): 94 def test_cl_description_with_environ_variables(self):
93 host = MockHost() 95 host = MockHost()
94 host.executive = MockExecutive(output='Last commit message\n') 96 host.executive = MockExecutive(output='Last commit message\n')
95 updater = DepsUpdater(host) 97 updater = DepsUpdater(host)
96 updater.host.environ['BUILDBOT_MASTERNAME'] = 'my.master' 98 updater.host.environ['BUILDBOT_MASTERNAME'] = 'my.master'
97 updater.host.environ['BUILDBOT_BUILDERNAME'] = 'b' 99 updater.host.environ['BUILDBOT_BUILDERNAME'] = 'b'
98 updater.host.environ['BUILDBOT_BUILDNUMBER'] = '123' 100 updater.host.environ['BUILDBOT_BUILDNUMBER'] = '123'
99 description = updater._cl_description() 101 description = updater._cl_description()
100 self.assertEqual( 102 self.assertEqual(
101 description, 103 description,
102 ('Last commit message\n' 104 ('Last commit message\n'
103 'Build: https://build.chromium.org/p/my.master/builders/b/builds/12 3\n\n' 105 'Build: https://build.chromium.org/p/my.master/builders/b/builds/12 3\n\n'
104 'TBR=qyearsley@chromium.org\n' 106 'TBR=qyearsley@chromium.org\n'
105 'NOEXPORT=true')) 107 'NOEXPORT=true'))
106 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']]) 108 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']])
107 109
110 def test_cl_description_moves_noexport_tag(self):
111 host = MockHost()
112 host.executive = MockExecutive(output='Summary\n\nNOEXPORT=true')
113 updater = DepsUpdater(host)
114 description = updater._cl_description()
115 self.assertEqual(
116 description,
117 ('Summary\n\n'
118 'TBR=qyearsley@chromium.org\n'
119 'NOEXPORT=true'))
120
108 def test_generate_manifest_command_not_found(self): 121 def test_generate_manifest_command_not_found(self):
109 # If we're updating csswg-test, then the manifest file won't be found. 122 # If we're updating csswg-test, then the manifest file won't be found.
110 host = MockHost() 123 host = MockHost()
111 host.filesystem.files = {} 124 host.filesystem.files = {}
112 updater = DepsUpdater(host) 125 updater = DepsUpdater(host)
113 updater._generate_manifest( 126 updater._generate_manifest(
114 '/mock-checkout/third_party/WebKit/LayoutTests/external/csswg-test') 127 '/mock-checkout/third_party/WebKit/LayoutTests/external/csswg-test')
115 self.assertEqual(host.executive.calls, []) 128 self.assertEqual(host.executive.calls, [])
116 129
117 def test_generate_manifest_successful_run(self): 130 def test_generate_manifest_successful_run(self):
(...skipping 11 matching lines...) Expand all
129 '--work', 142 '--work',
130 '--tests-root', 143 '--tests-root',
131 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt' 144 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'
132 ], 145 ],
133 [ 146 [
134 'git', 147 'git',
135 'add', 148 'add',
136 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt/ MANIFEST.json' 149 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt/ MANIFEST.json'
137 ] 150 ]
138 ]) 151 ])
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698