OLD | NEW |
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, shutil | 5 import logging, os, shutil |
6 from autotest_lib.client.bin import utils | 6 from autotest_lib.client.bin import utils |
7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
8 from autotest_lib.client.cros import httpd, ui, ui_test | 8 from autotest_lib.client.cros import cros_ui_test, httpd, ui |
9 | 9 |
10 class desktopui_V8Bench(ui_test.UITest): | 10 class desktopui_V8Bench(cros_ui_test.UITest): |
11 version = 1 | 11 version = 1 |
12 | 12 |
13 def initialize(self, creds='$default'): | 13 def initialize(self, creds='$default'): |
14 self._test_url = 'http://localhost:8000/run.html' | 14 self._test_url = 'http://localhost:8000/run.html' |
15 self._testServer = httpd.HTTPListener(8000, docroot=self.srcdir) | 15 self._testServer = httpd.HTTPListener(8000, docroot=self.srcdir) |
16 self._testServer.run() | 16 self._testServer.run() |
17 ui_test.UITest.initialize(self, creds) | 17 cros_ui_test.UITest.initialize(self, creds) |
18 | 18 |
19 | 19 |
20 def setup(self, tarball='v8_v5.tar.bz2'): | 20 def setup(self, tarball='v8_v5.tar.bz2'): |
21 shutil.rmtree(self.srcdir, ignore_errors=True) | 21 shutil.rmtree(self.srcdir, ignore_errors=True) |
22 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) | 22 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) |
23 utils.extract_tarball_to_dir(tarball, self.srcdir) | 23 utils.extract_tarball_to_dir(tarball, self.srcdir) |
24 os.chdir(self.srcdir) | 24 os.chdir(self.srcdir) |
25 utils.system('patch -p1 < ../v8.patch') | 25 utils.system('patch -p1 < ../v8.patch') |
26 | 26 |
27 | 27 |
28 def cleanup(self): | 28 def cleanup(self): |
29 self._testServer.stop() | 29 self._testServer.stop() |
30 ui_test.UITest.cleanup(self) | 30 cros_ui_test.UITest.cleanup(self) |
31 | 31 |
32 | 32 |
33 def run_once(self, timeout=60): | 33 def run_once(self, timeout=60): |
34 latch = self._testServer.add_wait_url('/v8/scores') | 34 latch = self._testServer.add_wait_url('/v8/scores') |
35 | 35 |
36 session = ui.ChromeSession(self._test_url) | 36 session = ui.ChromeSession(self._test_url) |
37 logging.debug('Chrome session started.') | 37 logging.debug('Chrome session started.') |
38 latch.wait(timeout) | 38 latch.wait(timeout) |
39 session.close() | 39 session.close() |
40 | 40 |
41 if not latch.is_set(): | 41 if not latch.is_set(): |
42 raise error.TestFail('Never received callback from browser.') | 42 raise error.TestFail('Never received callback from browser.') |
43 | 43 |
44 self.write_perf_keyval(self._testServer.get_form_entries()) | 44 self.write_perf_keyval(self._testServer.get_form_entries()) |
OLD | NEW |