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

Side by Side Diff: third_party/dom_distiller_js/protoc_plugins/json_values_converter_tests.py

Issue 2034373002: Generate the proto JSON converter for DOM distiller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows-specific fixes Created 4 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Tests for json_values_converter.py.
7
8 It tests json_values_converter.py.
9 """
10
11 import argparse
12 import os
13 import sys
14
15
16 def CompareFiles(file1, file2):
17 return file(file1, 'r').read() == file(file2, 'r').read()
18
19 def TouchStamp(stamp_path):
20 dir_name = os.path.dirname(stamp_path)
21 if not os.path.isdir(dir_name):
22 os.makedirs()
23
24 with open(stamp_path, 'a'):
25 os.utime(stamp_path, None)
26
27 def main(argv):
28 parser = argparse.ArgumentParser()
29 parser.add_argument('--stamp',
30 help='Path to touch on success.')
31 parser.add_argument('files', nargs='+',
32 help='Files to compare.')
33
34 args = parser.parse_args()
35
36 passed = True
37 for i, j in zip(args.files[::2], args.files[1::2]):
38 passed = passed and CompareFiles(i, j)
39
40 if passed and args.stamp:
41 TouchStamp(args.stamp)
42
43 return not passed
44
45 if __name__ == '__main__':
46 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698