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

Unified Diff: chrome/test/functional/media_test_matrix_unittest.py

Issue 6673078: Initial checkin of media test matrix class, which will be used for media perf test later. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Modified based on CR comments. Created 9 years, 9 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: chrome/test/functional/media_test_matrix_unittest.py
diff --git a/chrome/test/functional/media_test_matrix_unittest.py b/chrome/test/functional/media_test_matrix_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..37e8b0d82cbc65d8e053718113b80023773a0cbc
--- /dev/null
+++ b/chrome/test/functional/media_test_matrix_unittest.py
@@ -0,0 +1,54 @@
+#!/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 random
+import unittest
+from media_test_matrix import MediaTestMatrix
+
+
+class MediaTestMatrixTest(unittest.TestCase):
+ """Unit test for MediaTestMatrix class."""
+
+ def __ReadCSVFile(self):
+ """Reads CSV file for test and returns a media test matrix object.
+
+ Returns:
+ a media test matrix.
+ """
+ matrix = MediaTestMatrix()
+ # Pyauto.DataDir() method is not used to avoid dependency to pyauto.
+ data_file = os.path.join('..', 'data', 'media', 'media_matrix_data.csv')
+ matrix.ReadData(data_file)
+ return matrix
+
+ def testGenerateAllMediaInfosInCompactForm(self):
+ matrix = self.__readCSVFile()
+ # Get video data only case.
+ media_test_matrix_list = matrix.GenerateAllMediaInfosInCompactForm(True)
+ self.assertEqual(len(media_test_matrix_list), 249)
dennis_jeffrey 2011/03/18 23:51:41 In all assert function calls, I believe there's an
imasaki1 2011/03/19 01:00:38 Done.
+ media_test_matrix_list = matrix.GenerateAllMediaInfosInCompactForm(False)
+ # Get all media data.
dennis_jeffrey 2011/03/18 23:51:41 Move this comment right before line 33 above.
imasaki1 2011/03/19 01:00:38 Done.
+ self.assertEqual(len(media_test_matrix_list), 466)
+ mobile_test_info = MediaTestMatrix.LookForMediaInfoInCompactFormByNickName(
+ media_test_matrix_list, 'mobile0.webm')
+ self.assertEqual(len(media_test_matrix_list), 1)
+ self.assertEqual(mobile_test_info[1], 'mobile0.webm')
+
+ def testGenerateAllMediaInfos(self):
+ matrix = self.__readCSVFile()
+ # Get video data only case.
+ media_test_matrix_list = matrix.GenerateAllMediaInfos(True)
+ self.assertEqual(len(media_test_matrix_list), 249)
+ # Get all media data.
+ media_test_matrix_list = matrix.GenerateAllMediaInfos(False)
+ self.assertEqual(len(media_test_matrix_list), 466)
+ (info, url, link, tag, is_video, nickname) = (
+ matrix.GenerateRandomMediaInfo())
+ self.assertTrue(info is not None)
dennis_jeffrey 2011/03/18 23:51:41 Should we assert on any of the other return values
imasaki1 2011/03/19 01:00:38 Done.
+
+if __name__ == '__main__':
+ unittest.main()
« chrome/test/functional/media_test_matrix.py ('K') | « chrome/test/functional/media_test_matrix.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698