OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Runs DomDistillers jstests. | 6 """Runs DomDistillers jstests. |
7 | 7 |
8 This uses ChromeDriver (https://sites.google.com/a/chromium.org/chromedriver/) t
o run the jstests. | 8 This uses ChromeDriver (https://sites.google.com/a/chromium.org/chromedriver/) t
o run the jstests. |
9 This requires that the ChromeDriver executable is on the PATH and that Selenium
WebDriver is | 9 This requires that the ChromeDriver executable is on the PATH and that Selenium
WebDriver is |
10 installed. | 10 installed. |
(...skipping 15 matching lines...) Expand all Loading... |
26 start = time.time() | 26 start = time.time() |
27 | 27 |
28 test_runner = "return com.dom_distiller.client.JsTestEntry.run()"; | 28 test_runner = "return com.dom_distiller.client.JsTestEntry.run()"; |
29 test_html = os.path.abspath(os.path.join(os.path.dirname(__file__), "war", "test
.html")) | 29 test_html = os.path.abspath(os.path.join(os.path.dirname(__file__), "war", "test
.html")) |
30 | 30 |
31 driver = webdriver.Chrome() | 31 driver = webdriver.Chrome() |
32 driver.get("file://" + test_html) | 32 driver.get("file://" + test_html) |
33 result = driver.execute_script(test_runner) | 33 result = driver.execute_script(test_runner) |
34 driver.quit() | 34 driver.quit() |
35 end = time.time() | 35 end = time.time() |
36 print result['log'] | 36 print result['log'].encode('utf-8') |
37 print 'Tests run: %d, Failures: %d, Skipped: %d, Time elapsed: %0.3f sec' % (res
ult['numTests'], | 37 print 'Tests run: %d, Failures: %d, Skipped: %d, Time elapsed: %0.3f sec' % (res
ult['numTests'], |
38 result['failed'], result['skipped'], end - start) | 38 result['failed'], result['skipped'], end - start) |
39 sys.exit(0 if result['success'] else 1) | 39 sys.exit(0 if result['success'] else 1) |
OLD | NEW |