OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium 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 unittest | 5 import unittest |
6 | 6 |
7 from webkitpy.layout_tests.models import testharness_results | 7 from webkitpy.layout_tests.models import testharness_results |
8 | 8 |
9 | 9 |
10 class TestHarnessResultCheckerTest(unittest.TestCase): | 10 class TestHarnessResultCheckerTest(unittest.TestCase): |
(...skipping 15 matching lines...) Expand all Loading... |
26 self.assertEqual(data['result'], testharness_results.is_testharness_
output(data['content'])) | 26 self.assertEqual(data['result'], testharness_results.is_testharness_
output(data['content'])) |
27 | 27 |
28 def test_is_testharness_output_passing(self): | 28 def test_is_testharness_output_passing(self): |
29 test_data = [ | 29 test_data = [ |
30 {'content': 'This is a testharness.js-based test.\n Harness: the t
est ran to completion.', 'result': True}, | 30 {'content': 'This is a testharness.js-based test.\n Harness: the t
est ran to completion.', 'result': True}, |
31 {'content': 'This is a testharness.js-based test.\n \n Harness: the
test ran to completion.', 'result': False}, | 31 {'content': 'This is a testharness.js-based test.\n \n Harness: the
test ran to completion.', 'result': False}, |
32 {'content': 'This is a testharness.js-based test.\n PASS: foo bar \n
Harness: the test ran to completion.', 'result': True}, | 32 {'content': 'This is a testharness.js-based test.\n PASS: foo bar \n
Harness: the test ran to completion.', 'result': True}, |
33 {'content': 'This is a testharness.js-based test.\n PASS: foo bar FA
IL \n Harness: the test ran to completion.', 'result': True}, | 33 {'content': 'This is a testharness.js-based test.\n PASS: foo bar FA
IL \n Harness: the test ran to completion.', 'result': True}, |
34 {'content': 'This is a testharness.js-based test.\n PASS: foo bar \n
FAIL \n Harness: the test ran to completion.', 'result': False}, | 34 {'content': 'This is a testharness.js-based test.\n PASS: foo bar \n
FAIL \n Harness: the test ran to completion.', 'result': False}, |
35 {'content': 'This is a testharness.js-based test.\n CONSOLE ERROR: B
LAH \n Harness: the test ran to completion.', 'result': True}, | 35 {'content': 'This is a testharness.js-based test.\n CONSOLE ERROR: B
LAH \n Harness: the test ran to completion.', 'result': True}, |
| 36 {'content': 'This is a testharness.js-based test.\n CONSOLE WARNING:
BLAH \n Harness: the test ran to completion.', 'result': True}, |
36 {'content': 'This is a testharness.js-based test.\n Foo bar \n Harne
ss: the test ran to completion.', 'result': False}, | 37 {'content': 'This is a testharness.js-based test.\n Foo bar \n Harne
ss: the test ran to completion.', 'result': False}, |
37 {'content': 'This is a testharness.js-based test.\n FAIL: bah \n Har
ness: the test ran to completion.', 'result': False}, | 38 {'content': 'This is a testharness.js-based test.\n FAIL: bah \n Har
ness: the test ran to completion.', 'result': False}, |
38 {'content': 'This is a testharness.js-based test.\n TIMEOUT: bah \n
Harness: the test ran to completion.', 'result': False}, | 39 {'content': 'This is a testharness.js-based test.\n TIMEOUT: bah \n
Harness: the test ran to completion.', 'result': False}, |
39 {'content': 'This is a testharness.js-based test.\n NOTRUN: bah \n H
arness: the test ran to completion.', 'result': False}, | 40 {'content': 'This is a testharness.js-based test.\n NOTRUN: bah \n H
arness: the test ran to completion.', 'result': False}, |
40 {'content': 'CONSOLE LOG: error.\nThis is a testharness.js-based tes
t.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n', 'result':
True}, | 41 {'content': 'CONSOLE LOG: error.\nThis is a testharness.js-based tes
t.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n', 'result':
True}, |
41 {'content': 'CONSOLE ERROR: error.\nThis is a testharness.js-based t
est.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n', 'result
': True}, | 42 {'content': 'CONSOLE ERROR: error.\nThis is a testharness.js-based t
est.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n', 'result
': True}, |
| 43 {'content': 'CONSOLE WARNING: error.\nThis is a testharness.js-based
test.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n', 'resu
lt': True}, |
42 {'content': 'RANDOM TEXT.\nThis is a testharness.js-based test.\nPAS
S: things are fine.\n.Harness: the test ran to completion.\n\n', 'result': False
}, | 44 {'content': 'RANDOM TEXT.\nThis is a testharness.js-based test.\nPAS
S: things are fine.\n.Harness: the test ran to completion.\n\n', 'result': False
}, |
43 ] | 45 ] |
44 | 46 |
45 for data in test_data: | 47 for data in test_data: |
46 self.assertEqual(data['result'], testharness_results.is_testharness_
output_passing(data['content'])) | 48 self.assertEqual(data['result'], testharness_results.is_testharness_
output_passing(data['content'])) |
47 | 49 |
48 def test_is_testharness_output_with_console_errors(self): | 50 def test_is_testharness_output_with_console_errors_and_warnings(self): |
49 test_data = [ | 51 test_data = [ |
50 {'content': 'This is a testharness.js-based test.\nCONSOLE ERROR: Th
is is an error.\nTest ran to completion.', 'result': True}, | 52 {'content': 'This is a testharness.js-based test.\nCONSOLE ERROR: Th
is is an error.\nTest ran to completion.', 'result': True}, |
| 53 {'content': 'This is a testharness.js-based test.\nCONSOLE WARNING:
This is a warning.\nTest ran to completion.', 'result': True}, |
51 {'content': 'CONSOLE ERROR: This is an error.\nTest ran to completio
n.', 'result': True}, | 54 {'content': 'CONSOLE ERROR: This is an error.\nTest ran to completio
n.', 'result': True}, |
| 55 {'content': 'CONSOLE WARNING: This is a warning.\nTest ran to comple
tion.', 'result': True}, |
52 {'content': 'This is a testharness.js-based test.\nCONSOLE ERROR: Th
is is an error.', 'result': True}, | 56 {'content': 'This is a testharness.js-based test.\nCONSOLE ERROR: Th
is is an error.', 'result': True}, |
53 {'content': 'CONSOLE ERROR: This is an error.', 'result': True}, | 57 {'content': 'CONSOLE ERROR: This is an error.', 'result': True}, |
| 58 {'content': 'CONSOLE WARNING: This is a warning.', 'result': True}, |
54 {'content': 'This is a testharness.js-based test.\nCONSOLE MESSAGE:
This is not error.', 'result': False}, | 59 {'content': 'This is a testharness.js-based test.\nCONSOLE MESSAGE:
This is not error.', 'result': False}, |
55 {'content': 'This is a testharness.js-based test.\nNo errors here.',
'result': False}, | 60 {'content': 'This is a testharness.js-based test.\nNo errors here.',
'result': False}, |
56 {'content': 'This is not a CONSOLE ERROR, sorry.', 'result': False}, | 61 {'content': 'This is not a CONSOLE ERROR, sorry.', 'result': False}, |
| 62 {'content': 'This is not a CONSOLE WARNING, sorry.', 'result': False
}, |
57 ] | 63 ] |
58 | 64 |
59 for data in test_data: | 65 for data in test_data: |
60 self.assertEqual(data['result'], testharness_results.is_testharness_
output_with_console_errors(data['content'])) | 66 self.assertEqual(data['result'], testharness_results.is_testharness_
output_with_console_errors_or_warnings(data['content'])) |
OLD | NEW |