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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/dom_distiller_js/protoc_plugins/json_values_converter_tests.py
diff --git a/third_party/dom_distiller_js/protoc_plugins/json_values_converter_tests.py b/third_party/dom_distiller_js/protoc_plugins/json_values_converter_tests.py
new file mode 100755
index 0000000000000000000000000000000000000000..5b5b56b8f56ead4c0282c652f97a53ab5226743f
--- /dev/null
+++ b/third_party/dom_distiller_js/protoc_plugins/json_values_converter_tests.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# Copyright (c) 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Tests for json_values_converter.py.
+
+It tests json_values_converter.py.
+"""
+
+import argparse
+import os
+import sys
+
+
+def CompareFiles(file1, file2):
+ return file(file1, 'r').read() == file(file2, 'r').read()
+
+def TouchStamp(stamp_path):
+ dir_name = os.path.dirname(stamp_path)
+ if not os.path.isdir(dir_name):
+ os.makedirs()
+
+ with open(stamp_path, 'a'):
+ os.utime(stamp_path, None)
+
+def main(argv):
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--stamp',
+ help='Path to touch on success.')
+ parser.add_argument('files', nargs='+',
+ help='Files to compare.')
+
+ args = parser.parse_args()
+
+ passed = True
+ for i, j in zip(args.files[::2], args.files[1::2]):
+ passed = passed and CompareFiles(i, j)
+
+ if passed and args.stamp:
+ TouchStamp(args.stamp)
+
+ return not passed
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))

Powered by Google App Engine
This is Rietveld 408576698