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

Side by Side Diff: chrome/common/extensions/api/PRESUBMIT.py

Issue 21022018: Sessions API - previously Session Restore API. Supports restoring currently open foreign windows an… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete test. Created 7 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/common/extensions/api/_api_features.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 def _GetJSONParseError(input_api, contents): 5 def _GetJSONParseError(input_api, contents):
6 try: 6 try:
7 json_comment_eater = input_api.os_path.join( 7 json_comment_eater = input_api.os_path.join(
8 input_api.PresubmitLocalPath(), 8 input_api.PresubmitLocalPath(),
9 '..', '..', '..', '..', 'tools', 9 '..', '..', '..', '..', 'tools',
10 'json_comment_eater', 'json_comment_eater.py') 10 'json_comment_eater', 'json_comment_eater.py')
(...skipping 10 matching lines...) Expand all
21 21
22 def _GetParseErrors(input_api, output_api): 22 def _GetParseErrors(input_api, output_api):
23 # Run unit tests. 23 # Run unit tests.
24 results = [] 24 results = []
25 if input_api.AffectedFiles( 25 if input_api.AffectedFiles(
26 file_filter=lambda f: 'PRESUBMIT' in f.LocalPath()): 26 file_filter=lambda f: 'PRESUBMIT' in f.LocalPath()):
27 results = input_api.canned_checks.RunUnitTestsInDirectory( 27 results = input_api.canned_checks.RunUnitTestsInDirectory(
28 input_api, output_api, '.', whitelist=[r'^PRESUBMIT_test\.py$']) 28 input_api, output_api, '.', whitelist=[r'^PRESUBMIT_test\.py$'])
29 29
30 for affected_file in input_api.AffectedFiles( 30 for affected_file in input_api.AffectedFiles(
31 file_filter=lambda f: f.LocalPath().endswith('.json')): 31 file_filter=lambda f: f.LocalPath().endswith('.json'),
32 include_deletes=False):
32 filename = affected_file.AbsoluteLocalPath() 33 filename = affected_file.AbsoluteLocalPath()
33 contents = input_api.ReadFile(filename) 34 contents = input_api.ReadFile(filename)
34 parse_error = _GetJSONParseError(input_api, contents) 35 parse_error = _GetJSONParseError(input_api, contents)
35 if parse_error: 36 if parse_error:
36 results.append(output_api.PresubmitError( 37 results.append(output_api.PresubmitError(
37 'Features file %s could not be parsed: %s' % 38 'Features file %s could not be parsed: %s' %
38 (affected_file.LocalPath(), parse_error))) 39 (affected_file.LocalPath(), parse_error)))
39 # TODO(yoz): Also ensure IDL files are parseable. 40 # TODO(yoz): Also ensure IDL files are parseable.
40 return results 41 return results
41 42
42 43
43 def CheckChangeOnUpload(input_api, output_api): 44 def CheckChangeOnUpload(input_api, output_api):
44 return _GetParseErrors(input_api, output_api) 45 return _GetParseErrors(input_api, output_api)
45 46
46 47
47 def CheckChangeOnCommit(input_api, output_api): 48 def CheckChangeOnCommit(input_api, output_api):
48 return _GetParseErrors(input_api, output_api) 49 return _GetParseErrors(input_api, output_api)
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/common/extensions/api/_api_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698