From 82cb80962bc6bf4450561e185f37eb133bc9d8e0 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Sat, 12 May 2018 04:58:47 +0000 Subject: Prepare image comparison in safetynet_compare.py to work in nightly run. Do not open the html in a browser automatically. Change-Id: I7394b86f4a46a701dedb4fa0887515211561aee7 Reviewed-on: https://pdfium-review.googlesource.com/32315 Reviewed-by: Lei Zhang Commit-Queue: Henrique Nakashima --- testing/tools/safetynet_compare.py | 2 +- testing/tools/safetynet_image.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/tools/safetynet_compare.py b/testing/tools/safetynet_compare.py index 3c5cff86be..966910967e 100755 --- a/testing/tools/safetynet_compare.py +++ b/testing/tools/safetynet_compare.py @@ -116,7 +116,7 @@ class CompareRun(object): ('before', 'after'), self.args.num_workers, self.args.png_threshold) - image_comparison.Run() + image_comparison.Run(open_in_browser=not self.args.machine_readable) return 0 diff --git a/testing/tools/safetynet_image.py b/testing/tools/safetynet_image.py index 28df3c582a..319eeb96be 100644 --- a/testing/tools/safetynet_image.py +++ b/testing/tools/safetynet_image.py @@ -52,7 +52,7 @@ class ImageComparison(object): self.num_workers = num_workers self.threshold = threshold_fraction * 100 - def Run(self): + def Run(self, open_in_browser): """Runs the comparison and generates an HTML with the results. Returns: @@ -94,7 +94,9 @@ class ImageComparison(object): f.write('') f.write('') - webbrowser.open(html_path) + if open_in_browser: + webbrowser.open(html_path) + return 0 def _GenerateDiffs(self): -- cgit v1.2.3