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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/models/testharness_results_unittest.py

Issue 546133003: Reformat webkitpy.layout_tests w/ format-webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
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):
11 11
12 def test_is_testharness_output(self): 12 def test_is_testharness_output(self):
13 test_data = [ 13 test_data = [
14 {'content': 'foo', 'result': False}, 14 {'content': 'foo', 'result': False},
15 {'content': '', 'result': False}, 15 {'content': '', 'result': False},
16 {'content': ' ', 'result': False}, 16 {'content': ' ', 'result': False},
17 {'content': 'This is a testharness.js-based test.\nHarness: the test ran to completion.', 'result': True}, 17 {'content': 'This is a testharness.js-based test.\nHarness: the test ran to completion.', 'result': True},
18 {'content': '\n \r This is a testharness.js-based test. \n \r \n \r Harness: the test ran to completion. \n\n', 'result': True}, 18 {'content': '\n \r This is a testharness.js-based test. \n \r \n \r Harness: the test ran to completion. \n\n',
19 'result': True},
19 {'content': ' This \nis a testharness.js-based test.\nHarness: the test ran to completion.', 'result': False}, 20 {'content': ' This \nis a testharness.js-based test.\nHarness: the test ran to completion.', 'result': False},
20 {'content': 'This is a testharness.js-based test. Harness: the test ran to completion.', 'result': False}, 21 {'content': 'This is a testharness.js-based test. Harness: the test ran to completion.', 'result': False},
21 {'content': 'This is a testharness.js-based test.\nFoo bar \n Harnes s: the test ran to completion.', 'result': True}, 22 {'content': 'This is a testharness.js-based test.\nFoo bar \n Harnes s: the test ran to completion.', 'result': True},
22 {'content': 'This is a testharness.js-based test.\nFAIL: bah \n Harn ess: the test ran to completion.\n\n\n', 'result': True}, 23 {'content': 'This is a testharness.js-based test.\nFAIL: bah \n Harn ess: the test ran to completion.\n\n\n',
24 'result': True},
23 ] 25 ]
24 26
25 for data in test_data: 27 for data in test_data:
26 self.assertEqual(data['result'], testharness_results.is_testharness_ output(data['content'])) 28 self.assertEqual(data['result'], testharness_results.is_testharness_ output(data['content']))
27 29
28 def test_is_testharness_output_passing(self): 30 def test_is_testharness_output_passing(self):
29 test_data = [ 31 test_data = [
30 {'content': 'This is a testharness.js-based test.\n Harness: the t est ran to completion.', 'result': True}, 32 {'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}, 33 {'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}, 34 {'content': 'This is a testharness.js-based test.\n PASS: foo bar \n Harness: the test ran to completion.',
33 {'content': 'This is a testharness.js-based test.\n PASS: foo bar FA IL \n Harness: the test ran to completion.', 'result': True}, 35 '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}, 36 {'content': 'This is a testharness.js-based test.\n PASS: foo bar FA IL \n Harness: the test ran to completion.',
35 {'content': 'This is a testharness.js-based test.\n CONSOLE ERROR: B LAH \n Harness: the test ran to completion.', 'result': True}, 37 'result': True},
38 {'content': 'This is a testharness.js-based test.\n PASS: foo bar \n FAIL \n Harness: the test ran to completion.',
39 'result': False},
40 {'content': 'This is a testharness.js-based test.\n CONSOLE ERROR: B LAH \n Harness: the test ran to completion.',
41 'result': True},
36 {'content': 'This is a testharness.js-based test.\n Foo bar \n Harne ss: the test ran to completion.', 'result': False}, 42 {'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}, 43 {'content': 'This is a testharness.js-based test.\n FAIL: bah \n Har ness: the test ran to completion.',
38 {'content': 'This is a testharness.js-based test.\n TIMEOUT: bah \n Harness: the test ran to completion.', 'result': False}, 44 'result': False},
39 {'content': 'This is a testharness.js-based test.\n NOTRUN: bah \n H arness: the test ran to completion.', 'result': False}, 45 {'content': 'This is a testharness.js-based test.\n TIMEOUT: bah \n Harness: the test ran to completion.',
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}, 46 'result': False},
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}, 47 {'content': 'This is a testharness.js-based test.\n NOTRUN: bah \n H arness: the test ran to completion.',
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 }, 48 'result': False},
49 {'content': 'CONSOLE LOG: error.\nThis is a testharness.js-based tes t.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n',
50 'result': True},
51 {'content': 'CONSOLE ERROR: error.\nThis is a testharness.js-based t est.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n',
52 'result': True},
53 {'content': 'RANDOM TEXT.\nThis is a testharness.js-based test.\nPAS S: things are fine.\n.Harness: the test ran to completion.\n\n',
54 'result': False},
43 ] 55 ]
44 56
45 for data in test_data: 57 for data in test_data:
46 self.assertEqual(data['result'], testharness_results.is_testharness_ output_passing(data['content'])) 58 self.assertEqual(data['result'], testharness_results.is_testharness_ output_passing(data['content']))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698