Index: chrome/test/functional/media/media_test_runner.py |
diff --git a/chrome/test/functional/media/media_test_runner.py b/chrome/test/functional/media/media_test_runner.py |
index 9c353d69cd2bb61f37bcd23ae4a3ea6f8e7b4b42..33742c711aaf2095413d2ddb8c0883cba40e6383 100755 |
--- a/chrome/test/functional/media/media_test_runner.py |
+++ b/chrome/test/functional/media/media_test_runner.py |
@@ -109,7 +109,9 @@ def main(): |
default='', |
help=('Media file to be played using player.html. ' |
'The relative path needs to be specified starting ' |
- 'from data/html/ directory.')) |
+ 'from data/html/ directory.' |
dennis_jeffrey
2011/06/13 22:51:49
Nit: put a space right before the closing quote.
imasaki1
2011/06/13 23:43:09
Done.
|
+ 'The data should have the following format:' |
dennis_jeffrey
2011/06/13 22:51:49
Nit: put a space right before the closing quote.
imasaki1
2011/06/13 23:43:09
Done.
|
+ 'tag(video|audio)|filename|nickname|video_title')) |
parser.add_option('-a', '--reference_build', dest='reference_build', |
help='Include reference build run', default=False, |
action='store_true') |
@@ -123,6 +125,11 @@ def main(): |
' from http://www.annacavender.com/track/' |
' and put into reference_build_dir).'), |
default=False, action='store_true') |
+ parser.add_option('-g', '--track-file', dest='track_file', |
+ help=('Track file in vtt format (binary should be' |
+ ' downloaded from http://www.annacavender.com/track/' |
+ ' and put into reference_build_dir).')) |
+ |
options, args = parser.parse_args() |
if args: |
parser.print_help() |
@@ -130,7 +137,13 @@ def main(): |
test_data_list = [] |
if options.media_file: |
- test_data_list.append(['video', options.media_file, options.media_file]) |
+ opts = options.media_file.split('|') |
+ # media file should have the following format: |
dennis_jeffrey
2011/06/13 22:51:49
nit: "media file" --> "The media file"
imasaki1
2011/06/13 23:43:09
Done.
|
+ # tag(video|audio)|filename|nickname|video_title. |
+ # Otherwise, it exits. |
Nirnimesh
2011/06/13 22:07:37
remove this line
imasaki1
2011/06/13 23:43:09
Done.
|
+ if len(opts) != 4: |
Nirnimesh
2011/06/13 22:07:37
print out some helpful error message
imasaki1
2011/06/13 23:43:09
Done.
|
+ sys.exit(1) |
+ test_data_list.append(opts) |
elif options.input_matrix_filename is None: |
file = open(options.input_filename, 'rb') |
test_data_list = csv.reader(file) |
@@ -160,7 +173,7 @@ def main(): |
reference_build_list = [False, True] |
else: |
reference_build_list = [False] |
- if options.track: |
+ if options.track_file or options.track: |
# TODO(imasaki@chromium.org): change here after track functionality is |
# available on Chrome. Currently, track patch is still under development. |
# So, I need to download the binary from |
@@ -170,7 +183,7 @@ def main(): |
# This is a loop for iterating through all videos defined above (list |
# or matrix). Each video has associated tag and nickname for display |
# purpose. |
- for tag, filename, nickname in test_data_list: |
+ for tag, filename, nickname, title in test_data_list: |
# This inner loop iterates twice. The first iteration of the loop |
# disables the media cache, and the second iteration enables the media |
# cache. Other parameters remain the same on both loop iterations. |
@@ -178,6 +191,16 @@ def main(): |
# to --media-cache-size=1 or adding t parameter in query parameter of |
# URL in which player.js (data/media/html/player.js) disables the |
# media cache). |
+ # |
+ # The default name for track vtt file is the name of the video tile |
dennis_jeffrey
2011/06/13 22:51:49
"tile" -->
"title"
imasaki1
2011/06/13 23:43:09
Done.
|
+ # in the case --track-file is not set. The track file should be in |
+ # the same directory as video files. |
+ # For example, bear_en.vtt used |
dennis_jeffrey
2011/06/13 22:51:49
Remove "used"?
imasaki1
2011/06/13 23:43:09
Done.
|
+ if options.track and not options.track_file: |
+ # TODO(imasaki@chromium.org): add more languages. |
+ lang = 'en' |
+ options.track_file = os.path.join(os.path.dirname(filename), |
+ title + '_' + lang + '.vtt') |
for reference_build in reference_build_list: |
parent_envs = copy.deepcopy(os.environ) |
if options.input_matrix_filename is None: |
@@ -215,6 +238,9 @@ def main(): |
if options.reference_build_dir: |
envs[MediaTestEnvNames.REFERENCE_BUILD_DIR_ENV_NAME] = ( |
options.reference_build_dir) |
+ if options.track_file: |
+ envs[MediaTestEnvNames.TRACK_FILE_ENV_NAME] = ( |
+ options.track_file) |
envs.update(parent_envs) |
if options.suite is None and options.test_prog_name is not None: |
# Suite is not used - run test program directly. |
@@ -233,7 +259,7 @@ def main(): |
chrome_flag = '' |
if options.disable_media_cache: |
chrome_flag += CHROME_FLAGS['disable_cache'] |
- if options.track: |
+ if options.track_file: |
if options.disable_media_cache: |
chrome_flag += ' ' |
chrome_flag += CHROME_FLAGS['track'] |