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/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
9 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
10 #include "content/public/test/content_browser_test_utils.h" | 10 #include "content/public/test/content_browser_test_utils.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 std::string final_title = RunTest(gurl, expected_title); | 47 std::string final_title = RunTest(gurl, expected_title); |
48 EXPECT_EQ(expected_title, final_title); | 48 EXPECT_EQ(expected_title, final_title); |
49 } | 49 } |
50 | 50 |
51 std::string MediaBrowserTest::RunTest(const GURL& gurl, | 51 std::string MediaBrowserTest::RunTest(const GURL& gurl, |
52 const std::string& expected_title) { | 52 const std::string& expected_title) { |
53 VLOG(0) << "Running test URL: " << gurl; | 53 VLOG(0) << "Running test URL: " << gurl; |
54 TitleWatcher title_watcher(shell()->web_contents(), | 54 TitleWatcher title_watcher(shell()->web_contents(), |
55 base::ASCIIToUTF16(expected_title)); | 55 base::ASCIIToUTF16(expected_title)); |
56 AddWaitForTitles(&title_watcher); | 56 AddWaitForTitles(&title_watcher); |
57 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16(expected_title)); | |
scherkus (not reviewing)
2014/08/06 23:06:42
we already pass this into the TitleWatcher constru
suderman
2014/08/07 00:31:31
The title when the video terminates must match the
scherkus (not reviewing)
2014/08/07 00:38:48
I get that part, but on line 56 we already add |ex
suderman
2014/08/07 00:49:36
Ah, okay. I wasn't aware that the title_watcher au
| |
57 NavigateToURL(shell(), gurl); | 58 NavigateToURL(shell(), gurl); |
58 base::string16 result = title_watcher.WaitAndGetTitle(); | 59 base::string16 result = title_watcher.WaitAndGetTitle(); |
59 return base::UTF16ToASCII(result); | 60 return base::UTF16ToASCII(result); |
60 } | 61 } |
61 | 62 |
62 void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { | 63 void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { |
63 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEnded)); | 64 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEnded)); |
64 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kError)); | 65 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kError)); |
65 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kFailed)); | 66 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kFailed)); |
66 } | 67 } |
(...skipping 23 matching lines...) Expand all Loading... | |
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 std::string& tag, | 94 void PlayMedia(const std::string& tag, |
94 const std::string& media_file, | 95 const std::string& media_file, |
95 bool http) { | 96 bool http) { |
96 media::QueryParams query_params; | 97 media::QueryParams query_params; |
97 query_params.push_back(std::make_pair(tag, media_file)); | 98 query_params.push_back(std::make_pair(tag, media_file)); |
98 RunMediaTestPage("player.html", query_params, kEnded, http); | 99 RunMediaTestPage("player.html", query_params, kEnded, http); |
99 } | 100 } |
101 | |
102 void PlayVideoSize(const char* media_file, bool http, const char* expected) { | |
scherkus (not reviewing)
2014/08/06 23:06:42
nit: PlayVideoSize isn't really the best name
how
suderman
2014/08/07 00:31:31
Done.
| |
103 media::QueryParams query_params; | |
104 query_params.push_back(std::make_pair("video", media_file)); | |
105 RunMediaTestPage("player.html", query_params, expected, http); | |
106 } | |
100 }; | 107 }; |
101 | 108 |
102 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearTheora) { | 109 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearTheora) { |
103 PlayVideo("bear.ogv", GetParam()); | 110 PlayVideo("bear.ogv", GetParam()); |
104 } | 111 } |
105 | 112 |
106 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearSilentTheora) { | 113 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearSilentTheora) { |
107 PlayVideo("bear_silent.ogv", GetParam()); | 114 PlayVideo("bear_silent.ogv", GetParam()); |
108 } | 115 } |
109 | 116 |
(...skipping 25 matching lines...) Expand all Loading... | |
135 // While we support the big endian (be) PCM codecs on Chromium, Quicktime seems | 142 // While we support the big endian (be) PCM codecs on Chromium, Quicktime seems |
136 // to be the only creator of this format and only for .mov files. | 143 // to be the only creator of this format and only for .mov files. |
137 // TODO(dalecurtis/ihf): Find or create some .wav test cases for "be" format. | 144 // TODO(dalecurtis/ihf): Find or create some .wav test cases for "be" format. |
138 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS16be) { | 145 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS16be) { |
139 PlayVideo("bear_pcm_s16be.mov", GetParam()); | 146 PlayVideo("bear_pcm_s16be.mov", GetParam()); |
140 } | 147 } |
141 | 148 |
142 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS24be) { | 149 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS24be) { |
143 PlayVideo("bear_pcm_s24be.mov", GetParam()); | 150 PlayVideo("bear_pcm_s24be.mov", GetParam()); |
144 } | 151 } |
152 | |
153 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated0) { | |
154 PlayVideoSize("bear_rotate_0.mp4", GetParam(), "1280 720"); | |
155 } | |
156 | |
157 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated90) { | |
158 PlayVideoSize("bear_rotate_90.mp4", GetParam(), "720 1280"); | |
159 } | |
160 | |
161 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated180) { | |
162 PlayVideoSize("bear_rotate_180.mp4", GetParam(), "1280 720"); | |
163 } | |
164 | |
165 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated270) { | |
166 PlayVideoSize("bear_rotate_270.mp4", GetParam(), "720 1280"); | |
167 } | |
145 #endif // defined(USE_PROPRIETARY_CODECS) | 168 #endif // defined(USE_PROPRIETARY_CODECS) |
146 | 169 |
147 #if defined(OS_CHROMEOS) | 170 #if defined(OS_CHROMEOS) |
148 #if defined(USE_PROPRIETARY_CODECS) | 171 #if defined(USE_PROPRIETARY_CODECS) |
149 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) { | 172 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) { |
150 PlayVideo("bear_mpeg4_mp3.avi", GetParam()); | 173 PlayVideo("bear_mpeg4_mp3.avi", GetParam()); |
151 } | 174 } |
152 | 175 |
153 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) { | 176 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) { |
154 PlayVideo("bear_mpeg4asp_mp3.avi", GetParam()); | 177 PlayVideo("bear_mpeg4asp_mp3.avi", GetParam()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 } | 272 } |
250 | 273 |
251 #if defined(OS_CHROMEOS) | 274 #if defined(OS_CHROMEOS) |
252 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { | 275 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { |
253 RunColorFormatTest("yuv420p.avi", kEnded); | 276 RunColorFormatTest("yuv420p.avi", kEnded); |
254 } | 277 } |
255 #endif // defined(OS_CHROMEOS) | 278 #endif // defined(OS_CHROMEOS) |
256 #endif // defined(USE_PROPRIETARY_CODECS) | 279 #endif // defined(USE_PROPRIETARY_CODECS) |
257 | 280 |
258 } // namespace content | 281 } // namespace content |
OLD | NEW |