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

Side by Side Diff: client/site_tests/graphics_WindowManagerGraphicsCapture/graphics_WindowManagerGraphicsCapture.py

Issue 1972001: graphics_WindowManagerGraphicsCapture test taking screenshots and comparing them to reference images (Closed) Base URL: ssh://git@chromiumos-git/autotest.git
Patch Set: comment fixes Created 10 years, 7 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
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS 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 import logging, os, re 5 import logging, os, re
6 6
7 import os, time 7 import os, time
8 from autotest_lib.client.bin import site_login, site_ui_test 8 from autotest_lib.client.bin import site_login, site_ui_test
9 from autotest_lib.client.common_lib import error, utils 9 from autotest_lib.client.common_lib import error, utils
10 10
11 class graphics_WindowManagerGraphicsCapture(site_ui_test.UITest): 11 class graphics_WindowManagerGraphicsCapture(site_ui_test.UITest):
12 version = 1 12 version = 1
13 13
14 def setup(self): 14 def setup(self):
15 self.job.setup_dep(['glbench']) 15 self.job.setup_dep(['glbench'])
16 16
17 def run_once(self, script = 'autox_script.json', is_control = False): 17 def run_once(self, script = 'autox_script.json', is_control = False):
18 dep = 'glbench' 18 dep = 'glbench'
19 dep_dir = os.path.join(self.autodir, 'deps', dep) 19 dep_dir = os.path.join(self.autodir, 'deps', dep)
20 self.job.install_pkg(dep, 'dep', dep_dir) 20 self.job.install_pkg(dep, 'dep', dep_dir)
21 21
22 screenshot1_reference = os.path.join(self.bindir,
23 "screenshot1_reference")
24 screenshot1_generated = os.path.join(self.resultsdir,
25 "screenshot1_generated")
26 screenshot1_resized = os.path.join(self.resultsdir,
27 "screenshot1_generated_resized")
28 screenshot2_reference = os.path.join(self.bindir,
29 "screenshot2_reference")
30 screenshot2_generated = os.path.join(self.resultsdir,
31 "screenshot2_generated")
32 screenshot2_resized = os.path.join(self.resultsdir,
33 "screenshot2_generated_resized")
34
22 exefile = os.path.join(self.autodir, 'deps/glbench/windowmanagertest') 35 exefile = os.path.join(self.autodir, 'deps/glbench/windowmanagertest')
23
24 # Enable running in window manager 36 # Enable running in window manager
25 exefile = ('chvt 1 && DISPLAY=:0 XAUTHORITY=/home/chronos/.Xauthority ' 37 exefile = ('chvt 1 && DISPLAY=:0 XAUTHORITY=/home/chronos/.Xauthority '
26 + exefile) 38 + exefile)
27 39
28 options = "--seconds_to_run 10" 40 # Delay before screenshot: 1 second has caused failures
29 cmd = "%s %s" % (exefile, options) 41 options = ' --screenshot1_sec 2'
30 logging.info("command launched: %s" % cmd) 42 options += ' --screenshot2_sec 1'
31 self.results = utils.system_output(cmd, retain_output=True) 43 options += ' --cooldown_sec 1'
44 options += ' --screenshot1_cmd "screenshot %s"' % screenshot1_generated
45 options += ' --screenshot2_cmd "screenshot %s"' % screenshot2_generated
46
47 utils.system(exefile + " " + options)
48
49 utils.system("convert -resize '100x100!' %s %s" %
50 (screenshot1_generated, screenshot1_resized))
51 utils.system("convert -resize '100x100!' %s %s" %
52 (screenshot2_generated, screenshot2_resized))
53 os.remove(screenshot1_generated)
54 os.remove(screenshot2_generated)
55
56 utils.system("perceptualdiff -verbose %s %s"
57 % (screenshot1_reference, screenshot1_resized))
58 utils.system("perceptualdiff -verbose %s %s"
59 % (screenshot2_reference, screenshot2_resized))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698