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

Unified Diff: media/tools/layout_tests/layouttests_unittest.py

Issue 7693018: Intial checkin of layout test analyzer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Minor modification after doublecheck. Created 9 years, 4 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: media/tools/layout_tests/layouttests_unittest.py
diff --git a/media/tools/layout_tests/layouttests_unittest.py b/media/tools/layout_tests/layouttests_unittest.py
new file mode 100755
index 0000000000000000000000000000000000000000..2db0fa425d2b0ded1aeeb84721aa22a411afdd18
--- /dev/null
+++ b/media/tools/layout_tests/layouttests_unittest.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+# Copyright (c) 2011 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 os
+import unittest
+
+from layouttests import LayoutTests
+from test_expectations import TestExpectations
+
+
+class TestLayoutTests(unittest.TestCase):
+ """Unit tests for the LayoutTests class."""
+
+ def testJoinWithTestExpectation(self):
+ layouttests = LayoutTests(csv_file_path=os.path.join('testname',
+ 'media.csv'))
+ test_expectations = TestExpectations()
+ test_info_map = layouttests.JoinWithTestExpectation(test_expectations)
+
+ mediaTestInResult = False
dennis_jeffrey 2011/08/26 19:01:26 Remove this line; this variable is unused.
imasaki1 2011/08/26 22:28:44 Done.
+ self.assertTrue(any(['media/' in k for k in test_info_map.keys()]),
+ msg=('Analyzer result should contain at least one '
+ 'media test cases since we only retrieved media '
dennis_jeffrey 2011/08/26 19:01:26 Rather than asserting we find at least one media t
imasaki1 2011/08/26 22:28:44 I agree but, Currently, test expectation file is d
+ 'related test'))
+
+ def testGetTestDescriptionsFromSVN(self):
+ desc1 = LayoutTests.GetTestDescriptionFromSVN(
+ 'media/track/track-webvtt-tc004-magicheader.html')
+ self.assertEquals(desc1,
+ ('Tests that the magic file header "WEBVTT" leads to the'
+ ' file properly recognized as a WebVTT file.'),
+ msg='Extracted test description is wrong')
+ desc2 = LayoutTests.GetTestDescriptionFromSVN('jquery/data.html')
+ self.assertEquals(desc2, 'UNKNOWN',
+ msg='Extracted test description is wrong')
+
+ def testGetParentDirectoryList(self):
+ testname_list = ['hoge1/hoge2/hoge3.html', 'hoge1/x.html',
+ 'hoge1/hoge2/hoge4.html']
+ expected_result = ['hoge1/', 'hoge1/hoge2/']
+ self.assertEquals(LayoutTests.GetParentDirectoryList(testname_list),
+ expected_result)
+
+
+if __name__ == '__main__':
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698