| 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/string_number_conversions.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/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 PlayMedia("audio", media_file, http); | 71 PlayMedia("audio", media_file, http); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Play specified video over http:// or file:// depending on |http| setting. | 74 // Play specified video over http:// or file:// depending on |http| setting. |
| 75 void PlayVideo(const std::string& media_file, bool http) { | 75 void PlayVideo(const std::string& media_file, bool http) { |
| 76 PlayMedia("video", media_file, http); | 76 PlayMedia("video", media_file, http); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Run specified color format test with the expected result. | 79 // Run specified color format test with the expected result. |
| 80 void RunColorFormatTest(const std::string& media_file, | 80 void RunColorFormatTest(const std::string& media_file, |
| 81 const std::string& expected_title) { | 81 const std::string& expected) { |
| 82 base::FilePath test_file_path = | 82 base::FilePath test_file_path = |
| 83 media::GetTestDataFilePath("blackwhite.html"); | 83 media::GetTestDataFilePath("blackwhite.html"); |
| 84 std::string final_title = RunTest( | 84 RunTest(GetFileUrlWithQuery(test_file_path, media_file), expected); |
| 85 GetFileUrlWithQuery(test_file_path, media_file), expected_title); | |
| 86 EXPECT_EQ(expected_title, final_title); | |
| 87 } | 85 } |
| 88 | 86 |
| 89 void PlayMedia(const std::string& tag, | 87 void PlayMedia(const std::string& tag, |
| 90 const std::string& media_file, | 88 const std::string& media_file, |
| 91 bool http) { | 89 bool http) { |
| 92 base::StringPairs query_params; | 90 base::StringPairs query_params; |
| 93 query_params.push_back(std::make_pair(tag, media_file)); | 91 query_params.push_back(std::make_pair(tag, media_file)); |
| 94 RunMediaTestPage("player.html", query_params, kEnded, http); | 92 RunMediaTestPage("player.html", query_params, kEnded, http); |
| 95 } | 93 } |
| 96 | 94 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 241 |
| 244 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv444pTheora) { | 242 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv444pTheora) { |
| 245 RunColorFormatTest("yuv444p.ogv", kEnded); | 243 RunColorFormatTest("yuv444p.ogv", kEnded); |
| 246 } | 244 } |
| 247 | 245 |
| 248 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pVp8) { | 246 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pVp8) { |
| 249 RunColorFormatTest("yuv420p.webm", kEnded); | 247 RunColorFormatTest("yuv420p.webm", kEnded); |
| 250 } | 248 } |
| 251 | 249 |
| 252 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv444pVp9) { | 250 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv444pVp9) { |
| 253 RunColorFormatTest("yuv444p.webm", kEnded); | 251 RunColorFormatTest("yuv444p.webm", "ENDED"); |
| 254 } | 252 } |
| 255 | 253 |
| 256 #if defined(USE_PROPRIETARY_CODECS) | 254 #if defined(USE_PROPRIETARY_CODECS) |
| 257 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pH264) { | 255 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pH264) { |
| 258 RunColorFormatTest("yuv420p.mp4", kEnded); | 256 RunColorFormatTest("yuv420p.mp4", kEnded); |
| 259 } | 257 } |
| 260 | 258 |
| 261 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pRec709H264) { | 259 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pRec709H264) { |
| 262 RunColorFormatTest("yuv420p_rec709.mp4", kEnded); | 260 RunColorFormatTest("yuv420p_rec709.mp4", kEnded); |
| 263 } | 261 } |
| 264 | 262 |
| 265 IN_PROC_BROWSER_TEST_F(MediaTest, Yuvj420pH264) { | 263 IN_PROC_BROWSER_TEST_F(MediaTest, Yuvj420pH264) { |
| 266 // TODO(watk): Re-enable this when JPEG color range support is fixed. | 264 RunColorFormatTest("yuvj420p.mp4", kEnded); |
| 267 // crbug.com/507455 | |
| 268 // RunColorFormatTest("yuvj420p.mp4", kEnded); | |
| 269 } | 265 } |
| 270 | 266 |
| 271 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv422pH264) { | 267 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv422pH264) { |
| 272 RunColorFormatTest("yuv422p.mp4", kEnded); | 268 RunColorFormatTest("yuv422p.mp4", kEnded); |
| 273 } | 269 } |
| 274 | 270 |
| 275 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv444pH264) { | 271 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv444pH264) { |
| 276 RunColorFormatTest("yuv444p.mp4", kEnded); | 272 RunColorFormatTest("yuv444p.mp4", kEnded); |
| 277 } | 273 } |
| 278 | 274 |
| 279 #if defined(OS_CHROMEOS) | 275 #if defined(OS_CHROMEOS) |
| 280 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { | 276 IN_PROC_BROWSER_TEST_F(MediaTest, Yuv420pMpeg4) { |
| 281 RunColorFormatTest("yuv420p.avi", kEnded); | 277 RunColorFormatTest("yuv420p.avi", kEnded); |
| 282 } | 278 } |
| 283 #endif // defined(OS_CHROMEOS) | 279 #endif // defined(OS_CHROMEOS) |
| 284 #endif // defined(USE_PROPRIETARY_CODECS) | 280 #endif // defined(USE_PROPRIETARY_CODECS) |
| 285 | 281 |
| 286 } // namespace content | 282 } // namespace content |
| OLD | NEW |