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

Side by Side Diff: chrome/common/extensions/PRESUBMIT_test.py

Issue 10834214: Fix extension docs presubmit. One, not all, of the subdirs should have matching static docs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import unittest 6 import unittest
7 import os.path 7 import os.path
8 import PRESUBMIT 8 import PRESUBMIT
9 9
10 10
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 FakeAffectedFile( 252 FakeAffectedFile(
253 local_path='chrome/common/extensions/docs/static/index.html')]) 253 local_path='chrome/common/extensions/docs/static/index.html')])
254 self.assertTrue(PRESUBMIT.NonGeneratedFilesEdited(input_api)) 254 self.assertTrue(PRESUBMIT.NonGeneratedFilesEdited(input_api))
255 255
256 def testNonGeneratedFilesEdited_ZeroNonGeneratedFiles(self): 256 def testNonGeneratedFilesEdited_ZeroNonGeneratedFiles(self):
257 input_api = FakeInputApi(affected_files=[ 257 input_api = FakeInputApi(affected_files=[
258 FakeAffectedFile(local_path='chrome/common/extensions/docs/one.html'), 258 FakeAffectedFile(local_path='chrome/common/extensions/docs/one.html'),
259 FakeAffectedFile(local_path='chrome/common/extensions/docs/two.html')]) 259 FakeAffectedFile(local_path='chrome/common/extensions/docs/two.html')])
260 self.assertFalse(PRESUBMIT.NonGeneratedFilesEdited(input_api)) 260 self.assertFalse(PRESUBMIT.NonGeneratedFilesEdited(input_api))
261 261
262 def testStaticDocBuilt_ChangesMatch(self): 262 def testStaticDocBuilt_ChangesMatchApps(self):
263 static_file = FakeAffectedFile( 263 static_file = FakeAffectedFile(
264 local_path='chrome/common/extensions/docs/static/index.html', 264 local_path='chrome/common/extensions/docs/static/index.html',
265 changed_contents=[(3, 'foo!'), (4, 'bar!')]) 265 changed_contents=[(3, 'foo!'), (4, 'bar!')])
266 generated_apps_file = FakeAffectedFile( 266 generated_apps_file = FakeAffectedFile(
267 local_path='chrome/common/extensions/docs/apps/index.html', 267 local_path='chrome/common/extensions/docs/apps/index.html',
268 changed_contents=[(13, 'foo!'), (14, 'bar!')]) 268 changed_contents=[(13, 'foo!'), (14, 'bar!')])
269 input_api = FakeInputApi(affected_files=[
270 generated_apps_file,
271 static_file])
272
273 self.assertTrue(PRESUBMIT.StaticDocBuilt(static_file, input_api))
274
275 def testStaticDocBuilt_ChangesMatchExtensions(self):
276 static_file = FakeAffectedFile(
277 local_path='chrome/common/extensions/docs/static/index.html',
278 changed_contents=[(3, 'foo!'), (4, 'bar!')])
269 generated_extensions_file = FakeAffectedFile( 279 generated_extensions_file = FakeAffectedFile(
270 local_path='chrome/common/extensions/docs/extensions/index.html', 280 local_path='chrome/common/extensions/docs/extensions/index.html',
271 changed_contents=[(13, 'foo!'), (14, 'bar!')]) 281 changed_contents=[(13, 'foo!'), (14, 'bar!')])
272 input_api = FakeInputApi(affected_files=[ 282 input_api = FakeInputApi(affected_files=[
273 generated_apps_file,
274 generated_extensions_file, 283 generated_extensions_file,
275 static_file]) 284 static_file])
276 285
277 self.assertTrue(PRESUBMIT.StaticDocBuilt(static_file, input_api)) 286 self.assertTrue(PRESUBMIT.StaticDocBuilt(static_file, input_api))
278 287
279 def testStaticDocBuilt_OnlyStaticChanged(self): 288 def testStaticDocBuilt_OnlyStaticChanged(self):
280 static_file = FakeAffectedFile( 289 static_file = FakeAffectedFile(
281 local_path='chrome/common/extensions/docs/static/index.html', 290 local_path='chrome/common/extensions/docs/static/index.html',
282 changed_contents=[(3, 'foo!'), (4, 'bar!')]) 291 changed_contents=[(3, 'foo!'), (4, 'bar!')])
283 other_static_file = FakeAffectedFile( 292 other_static_file = FakeAffectedFile(
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 local_path='chrome/common/extensions/docs/examples/foo/bar.jpg') 452 local_path='chrome/common/extensions/docs/examples/foo/bar.jpg')
444 zip_file = FakeAffectedFile( 453 zip_file = FakeAffectedFile(
445 local_path='chrome/common/extensions/docs/examples/baz.zip') 454 local_path='chrome/common/extensions/docs/examples/baz.zip')
446 input_api = FakeInputApi(affected_files=[sample_file, zip_file]) 455 input_api = FakeInputApi(affected_files=[sample_file, zip_file])
447 456
448 self.assertFalse(PRESUBMIT.SampleZipped(sample_file, input_api)) 457 self.assertFalse(PRESUBMIT.SampleZipped(sample_file, input_api))
449 458
450 459
451 if __name__ == '__main__': 460 if __name__ == '__main__':
452 unittest.main() 461 unittest.main()
OLDNEW
« chrome/common/extensions/PRESUBMIT.py ('K') | « chrome/common/extensions/PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698