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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/models/testharness_results_unittest.py

Issue 332583002: Add PRESUBMIT checks for not required testharness expected files. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix imports 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 side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/layout_tests/models/testharness_results_unittest.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/models/testharness_results_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/testharness_results_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..6ec58cf1171d6229875fd3e70de949b629248211
--- /dev/null
+++ b/Tools/Scripts/webkitpy/layout_tests/models/testharness_results_unittest.py
@@ -0,0 +1,46 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+from webkitpy.layout_tests.models import testharness_results
+
+
+class TestHarnessResultCheckerTest(unittest.TestCase):
+
+ def test_is_testharness_output(self):
+ test_data = [
+ {'content': 'foo', 'result': False},
+ {'content': '', 'result': False},
+ {'content': ' ', 'result': False},
+ {'content': 'This is a testharness.js-based test.\nHarness: the test ran to completion.', 'result': True},
+ {'content': '\n \r This is a testharness.js-based test. \n \r \n \rHarness: the test ran to completion. \n\n', 'result': True},
+ {'content': ' This \nis a testharness.js-based test.\nHarness: the test ran to completion.', 'result': False},
+ {'content': 'This is a testharness.js-based test. Harness: the test ran to completion.', 'result': False},
+ {'content': 'This is a testharness.js-based test.\nFoo bar \n Harness: the test ran to completion.', 'result': True},
+ {'content': 'This is a testharness.js-based test.\nFAIL: bah \n Harness: the test ran to completion.\n\n\n', 'result': True},
+ ]
+
+ for data in test_data:
+ self.assertEqual(data['result'], testharness_results.is_testharness_output(data['content']))
+
+ def test_is_testharness_output_passing(self):
+ test_data = [
+ {'content': 'This is a testharness.js-based test.\n Harness: the test ran to completion.', 'result': True},
+ {'content': 'This is a testharness.js-based test.\n \n Harness: the test ran to completion.', 'result': False},
+ {'content': 'This is a testharness.js-based test.\n PASS: foo bar \n Harness: the test ran to completion.', 'result': True},
+ {'content': 'This is a testharness.js-based test.\n PASS: foo bar FAIL \n Harness: the test ran to completion.', 'result': True},
+ {'content': 'This is a testharness.js-based test.\n PASS: foo bar \nFAIL \n Harness: the test ran to completion.', 'result': False},
+ {'content': 'This is a testharness.js-based test.\n CONSOLE ERROR: BLAH \n Harness: the test ran to completion.', 'result': True},
+ {'content': 'This is a testharness.js-based test.\n Foo bar \n Harness: the test ran to completion.', 'result': False},
+ {'content': 'This is a testharness.js-based test.\n FAIL: bah \n Harness: the test ran to completion.', 'result': False},
+ {'content': 'This is a testharness.js-based test.\n TIMEOUT: bah \n Harness: the test ran to completion.', 'result': False},
+ {'content': 'This is a testharness.js-based test.\n NOTRUN: bah \n Harness: the test ran to completion.', 'result': False},
+ {'content': 'CONSOLE LOG: error.\nThis is a testharness.js-based test.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n', 'result': True},
+ {'content': 'CONSOLE ERROR: error.\nThis is a testharness.js-based test.\nPASS: things are fine.\nHarness: the test ran to completion.\n\n', 'result': True},
+ {'content': 'RANDOM TEXT.\nThis is a testharness.js-based test.\nPASS: things are fine.\n.Harness: the test ran to completion.\n\n', 'result': False},
+ ]
+
+ for data in test_data:
+ self.assertEqual(data['result'], testharness_results.is_testharness_output_passing(data['content']))
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/models/testharness_results.py ('k') | Tools/Scripts/webkitpy/layout_tests/port/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698