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