OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/media/media_browsertest.h" | 5 #include "content/browser/media/media_browsertest.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 gurl = GetFileUrlWithQuery(test_file_path, query); | 48 gurl = GetFileUrlWithQuery(test_file_path, query); |
49 } | 49 } |
50 RunTest(gurl, expected); | 50 RunTest(gurl, expected); |
51 } | 51 } |
52 | 52 |
53 void MediaBrowserTest::RunTest(const GURL& gurl, const char* expected) { | 53 void MediaBrowserTest::RunTest(const GURL& gurl, const char* expected) { |
54 const base::string16 expected_title = base::ASCIIToUTF16(expected); | 54 const base::string16 expected_title = base::ASCIIToUTF16(expected); |
55 DVLOG(1) << "Running test URL: " << gurl; | 55 DVLOG(1) << "Running test URL: " << gurl; |
56 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 56 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
57 AddWaitForTitles(&title_watcher); | 57 AddWaitForTitles(&title_watcher); |
| 58 title_watcher.AlsoWaitForTitle(expected_title); |
58 NavigateToURL(shell(), gurl); | 59 NavigateToURL(shell(), gurl); |
59 | 60 |
60 base::string16 final_title = title_watcher.WaitAndGetTitle(); | 61 base::string16 final_title = title_watcher.WaitAndGetTitle(); |
61 EXPECT_EQ(expected_title, final_title); | 62 EXPECT_EQ(expected_title, final_title); |
62 } | 63 } |
63 | 64 |
64 void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { | 65 void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { |
65 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEnded)); | 66 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEnded)); |
66 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kError)); | 67 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kError)); |
67 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kFailed)); | 68 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kFailed)); |
(...skipping 20 matching lines...) Expand all Loading... |
88 void RunColorFormatTest(const char* media_file, const char* expected) { | 89 void RunColorFormatTest(const char* media_file, const char* expected) { |
89 base::FilePath test_file_path = GetTestFilePath("media", "blackwhite.html"); | 90 base::FilePath test_file_path = GetTestFilePath("media", "blackwhite.html"); |
90 RunTest(GetFileUrlWithQuery(test_file_path, media_file), expected); | 91 RunTest(GetFileUrlWithQuery(test_file_path, media_file), expected); |
91 } | 92 } |
92 | 93 |
93 void PlayMedia(const char* tag, const char* media_file, bool http) { | 94 void PlayMedia(const char* tag, const char* media_file, bool http) { |
94 std::vector<StringPair> query_params; | 95 std::vector<StringPair> query_params; |
95 query_params.push_back(std::make_pair(tag, media_file)); | 96 query_params.push_back(std::make_pair(tag, media_file)); |
96 RunMediaTestPage("player.html", &query_params, kEnded, http); | 97 RunMediaTestPage("player.html", &query_params, kEnded, http); |
97 } | 98 } |
| 99 |
| 100 void PlayVideoSize(const char* media_file, bool http, const char* expected) { |
| 101 std::vector<StringPair> query_params; |
| 102 query_params.push_back(std::make_pair("video", media_file)); |
| 103 RunMediaTestPage("player.html", &query_params, expected, http); |
| 104 } |
98 }; | 105 }; |
99 | 106 |
100 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearTheora) { | 107 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearTheora) { |
101 PlayVideo("bear.ogv", GetParam()); | 108 PlayVideo("bear.ogv", GetParam()); |
102 } | 109 } |
103 | 110 |
104 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearSilentTheora) { | 111 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearSilentTheora) { |
105 PlayVideo("bear_silent.ogv", GetParam()); | 112 PlayVideo("bear_silent.ogv", GetParam()); |
106 } | 113 } |
107 | 114 |
(...skipping 25 matching lines...) Expand all Loading... |
133 // While we support the big endian (be) PCM codecs on Chromium, Quicktime seems | 140 // While we support the big endian (be) PCM codecs on Chromium, Quicktime seems |
134 // to be the only creator of this format and only for .mov files. | 141 // to be the only creator of this format and only for .mov files. |
135 // TODO(dalecurtis/ihf): Find or create some .wav test cases for "be" format. | 142 // TODO(dalecurtis/ihf): Find or create some .wav test cases for "be" format. |
136 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS16be) { | 143 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS16be) { |
137 PlayVideo("bear_pcm_s16be.mov", GetParam()); | 144 PlayVideo("bear_pcm_s16be.mov", GetParam()); |
138 } | 145 } |
139 | 146 |
140 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS24be) { | 147 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS24be) { |
141 PlayVideo("bear_pcm_s24be.mov", GetParam()); | 148 PlayVideo("bear_pcm_s24be.mov", GetParam()); |
142 } | 149 } |
| 150 |
| 151 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated0) { |
| 152 PlayVideoSize("bear_rotate_0.mp4", GetParam(), "1280 720"); |
| 153 } |
| 154 |
| 155 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated90) { |
| 156 PlayVideoSize("bear_rotate_90.mp4", GetParam(), "1280 720"); |
| 157 } |
| 158 |
| 159 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated180) { |
| 160 PlayVideoSize("bear_rotate_180.mp4", GetParam(), "1280 720"); |
| 161 } |
| 162 |
| 163 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated270) { |
| 164 PlayVideoSize("bear_rotate_270.mp4", GetParam(), "1280 720"); |
| 165 } |
143 #endif | 166 #endif |
144 | 167 |
145 #if defined(OS_CHROMEOS) | 168 #if defined(OS_CHROMEOS) |
146 #if defined(USE_PROPRIETARY_CODECS) | 169 #if defined(USE_PROPRIETARY_CODECS) |
147 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) { | 170 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) { |
148 PlayVideo("bear_mpeg4_mp3.avi", GetParam()); | 171 PlayVideo("bear_mpeg4_mp3.avi", GetParam()); |
149 } | 172 } |
150 | 173 |
151 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) { | 174 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) { |
152 PlayVideo("bear_mpeg4asp_mp3.avi", GetParam()); | 175 PlayVideo("bear_mpeg4asp_mp3.avi", GetParam()); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 271 } |
249 | 272 |
250 #if defined(OS_CHROMEOS) | 273 #if defined(OS_CHROMEOS) |
251 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { | 274 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { |
252 RunColorFormatTest("yuv420p.avi", "ENDED"); | 275 RunColorFormatTest("yuv420p.avi", "ENDED"); |
253 } | 276 } |
254 #endif // defined(OS_CHROMEOS) | 277 #endif // defined(OS_CHROMEOS) |
255 #endif // defined(USE_PROPRIETARY_CODECS) | 278 #endif // defined(USE_PROPRIETARY_CODECS) |
256 | 279 |
257 } // namespace content | 280 } // namespace content |
OLD | NEW |