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/string_number_conversions.h" | |
7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
8 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
9 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
10 #include "content/public/test/content_browser_test_utils.h" | 11 #include "content/public/test/content_browser_test_utils.h" |
11 #include "content/shell/browser/shell.h" | 12 #include "content/shell/browser/shell.h" |
12 #include "media/base/test_data_util.h" | 13 #include "media/base/test_data_util.h" |
13 #include "net/test/spawned_test_server/spawned_test_server.h" | 14 #include "net/test/spawned_test_server/spawned_test_server.h" |
14 | 15 |
15 // TODO(wolenetz): Fix Media.YUV* tests on MSVS 2012 x64. crbug.com/180074 | 16 // TODO(wolenetz): Fix Media.YUV* tests on MSVS 2012 x64. crbug.com/180074 |
16 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) && _MSC_VER == 1700 | 17 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) && _MSC_VER == 1700 |
(...skipping 30 matching lines...) Expand all Loading... | |
47 std::string final_title = RunTest(gurl, expected_title); | 48 std::string final_title = RunTest(gurl, expected_title); |
48 EXPECT_EQ(expected_title, final_title); | 49 EXPECT_EQ(expected_title, final_title); |
49 } | 50 } |
50 | 51 |
51 std::string MediaBrowserTest::RunTest(const GURL& gurl, | 52 std::string MediaBrowserTest::RunTest(const GURL& gurl, |
52 const std::string& expected_title) { | 53 const std::string& expected_title) { |
53 VLOG(0) << "Running test URL: " << gurl; | 54 VLOG(0) << "Running test URL: " << gurl; |
54 TitleWatcher title_watcher(shell()->web_contents(), | 55 TitleWatcher title_watcher(shell()->web_contents(), |
55 base::ASCIIToUTF16(expected_title)); | 56 base::ASCIIToUTF16(expected_title)); |
56 AddWaitForTitles(&title_watcher); | 57 AddWaitForTitles(&title_watcher); |
58 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16(expected_title)); | |
57 NavigateToURL(shell(), gurl); | 59 NavigateToURL(shell(), gurl); |
58 base::string16 result = title_watcher.WaitAndGetTitle(); | 60 base::string16 result = title_watcher.WaitAndGetTitle(); |
59 return base::UTF16ToASCII(result); | 61 return base::UTF16ToASCII(result); |
60 } | 62 } |
61 | 63 |
62 void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { | 64 void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) { |
63 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEnded)); | 65 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEnded)); |
64 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kError)); | 66 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kError)); |
65 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kFailed)); | 67 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kFailed)); |
66 } | 68 } |
(...skipping 23 matching lines...) Expand all Loading... | |
90 RunTest(GetFileUrlWithQuery(test_file_path, media_file), expected); | 92 RunTest(GetFileUrlWithQuery(test_file_path, media_file), expected); |
91 } | 93 } |
92 | 94 |
93 void PlayMedia(const std::string& tag, | 95 void PlayMedia(const std::string& tag, |
94 const std::string& media_file, | 96 const std::string& media_file, |
95 bool http) { | 97 bool http) { |
96 media::QueryParams query_params; | 98 media::QueryParams query_params; |
97 query_params.push_back(std::make_pair(tag, media_file)); | 99 query_params.push_back(std::make_pair(tag, media_file)); |
98 RunMediaTestPage("player.html", query_params, kEnded, http); | 100 RunMediaTestPage("player.html", query_params, kEnded, http); |
99 } | 101 } |
102 | |
103 void RunVideoSizeTest(const char* media_file, bool http, | |
104 int width, int height) { | |
105 std::string expected; | |
106 expected += base::IntToString(width); | |
107 expected += " "; | |
108 expected += base::IntToString(height); | |
109 media::QueryParams query_params; | |
110 query_params.push_back(std::make_pair("video", media_file)); | |
111 RunMediaTestPage("player.html", query_params, expected, http); | |
112 } | |
100 }; | 113 }; |
101 | 114 |
102 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearTheora) { | 115 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearTheora) { |
103 PlayVideo("bear.ogv", GetParam()); | 116 PlayVideo("bear.ogv", GetParam()); |
104 } | 117 } |
105 | 118 |
106 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearSilentTheora) { | 119 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearSilentTheora) { |
107 PlayVideo("bear_silent.ogv", GetParam()); | 120 PlayVideo("bear_silent.ogv", GetParam()); |
108 } | 121 } |
109 | 122 |
(...skipping 25 matching lines...) Expand all Loading... | |
135 // While we support the big endian (be) PCM codecs on Chromium, Quicktime seems | 148 // 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. | 149 // 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. | 150 // TODO(dalecurtis/ihf): Find or create some .wav test cases for "be" format. |
138 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS16be) { | 151 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS16be) { |
139 PlayVideo("bear_pcm_s16be.mov", GetParam()); | 152 PlayVideo("bear_pcm_s16be.mov", GetParam()); |
140 } | 153 } |
141 | 154 |
142 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS24be) { | 155 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMovPcmS24be) { |
143 PlayVideo("bear_pcm_s24be.mov", GetParam()); | 156 PlayVideo("bear_pcm_s24be.mov", GetParam()); |
144 } | 157 } |
158 | |
159 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated0) { | |
scherkus (not reviewing)
2014/08/07 00:38:48
these should be _P -> _F and remove the GetParam()
suderman
2014/08/07 00:49:36
Done.
| |
160 RunVideoSizeTest("bear_rotate_0.mp4", GetParam(), 1280, 720); | |
161 } | |
162 | |
163 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated90) { | |
164 RunVideoSizeTest("bear_rotate_90.mp4", GetParam(), 720, 1280); | |
165 } | |
166 | |
167 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated180) { | |
168 RunVideoSizeTest("bear_rotate_180.mp4", GetParam(), 1280, 720); | |
169 } | |
170 | |
171 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearRotated270) { | |
172 RunVideoSizeTest("bear_rotate_270.mp4", GetParam(), 720, 1280); | |
173 } | |
145 #endif // defined(USE_PROPRIETARY_CODECS) | 174 #endif // defined(USE_PROPRIETARY_CODECS) |
146 | 175 |
147 #if defined(OS_CHROMEOS) | 176 #if defined(OS_CHROMEOS) |
148 #if defined(USE_PROPRIETARY_CODECS) | 177 #if defined(USE_PROPRIETARY_CODECS) |
149 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) { | 178 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) { |
150 PlayVideo("bear_mpeg4_mp3.avi", GetParam()); | 179 PlayVideo("bear_mpeg4_mp3.avi", GetParam()); |
151 } | 180 } |
152 | 181 |
153 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) { | 182 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) { |
154 PlayVideo("bear_mpeg4asp_mp3.avi", GetParam()); | 183 PlayVideo("bear_mpeg4asp_mp3.avi", GetParam()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 } | 278 } |
250 | 279 |
251 #if defined(OS_CHROMEOS) | 280 #if defined(OS_CHROMEOS) |
252 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { | 281 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { |
253 RunColorFormatTest("yuv420p.avi", kEnded); | 282 RunColorFormatTest("yuv420p.avi", kEnded); |
254 } | 283 } |
255 #endif // defined(OS_CHROMEOS) | 284 #endif // defined(OS_CHROMEOS) |
256 #endif // defined(USE_PROPRIETARY_CODECS) | 285 #endif // defined(USE_PROPRIETARY_CODECS) |
257 | 286 |
258 } // namespace content | 287 } // namespace content |
OLD | NEW |