| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 13 #include "content/public/test/browser_test_utils.h" |
| 14 #include "content/public/test/content_browser_test_utils.h" | 14 #include "content/public/test/content_browser_test_utils.h" |
| 15 #include "content/shell/browser/shell.h" | 15 #include "content/shell/browser/shell.h" |
| 16 #include "media/base/media_switches.h" | 16 #include "media/base/media_switches.h" |
| 17 #include "media/base/test_data_util.h" | 17 #include "media/base/test_data_util.h" |
| 18 #include "media/media_features.h" |
| 18 #include "net/test/embedded_test_server/embedded_test_server.h" | 19 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 22 // Common test results. | 23 // Common test results. |
| 23 const char MediaBrowserTest::kEnded[] = "ENDED"; | 24 const char MediaBrowserTest::kEnded[] = "ENDED"; |
| 24 const char MediaBrowserTest::kError[] = "ERROR"; | 25 const char MediaBrowserTest::kError[] = "ERROR"; |
| 25 const char MediaBrowserTest::kFailed[] = "FAILED"; | 26 const char MediaBrowserTest::kFailed[] = "FAILED"; |
| 26 | 27 |
| 27 void MediaBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { | 28 void MediaBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID) | 135 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID) |
| 135 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearHighBitDepthVP9) { | 136 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearHighBitDepthVP9) { |
| 136 PlayVideo("bear-320x180-hi10p-vp9.webm", GetParam()); | 137 PlayVideo("bear-320x180-hi10p-vp9.webm", GetParam()); |
| 137 } | 138 } |
| 138 | 139 |
| 139 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBear12DepthVP9) { | 140 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBear12DepthVP9) { |
| 140 PlayVideo("bear-320x180-hi12p-vp9.webm", GetParam()); | 141 PlayVideo("bear-320x180-hi12p-vp9.webm", GetParam()); |
| 141 } | 142 } |
| 142 #endif | 143 #endif |
| 143 | 144 |
| 144 #if defined(USE_PROPRIETARY_CODECS) | 145 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 145 // Crashes on Mac http://crbug.com/621857 | 146 // Crashes on Mac http://crbug.com/621857 |
| 146 // Fails on Android http://crbug.com/682387 | 147 // Fails on Android http://crbug.com/682387 |
| 147 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 148 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 148 #define MAYBE_VideoBearMp4 DISABLED_VideoBearMp4 | 149 #define MAYBE_VideoBearMp4 DISABLED_VideoBearMp4 |
| 149 #else | 150 #else |
| 150 #define MAYBE_VideoBearMp4 VideoBearMp4 | 151 #define MAYBE_VideoBearMp4 VideoBearMp4 |
| 151 #endif | 152 #endif |
| 152 IN_PROC_BROWSER_TEST_P(MediaTest, MAYBE_VideoBearMp4) { | 153 IN_PROC_BROWSER_TEST_P(MediaTest, MAYBE_VideoBearMp4) { |
| 153 PlayVideo("bear.mp4", GetParam()); | 154 PlayVideo("bear.mp4", GetParam()); |
| 154 } | 155 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 RunVideoSizeTest("bear_rotate_90.mp4", 720, 1280); | 194 RunVideoSizeTest("bear_rotate_90.mp4", 720, 1280); |
| 194 } | 195 } |
| 195 | 196 |
| 196 IN_PROC_BROWSER_TEST_F(MediaTest, VideoBearRotated180) { | 197 IN_PROC_BROWSER_TEST_F(MediaTest, VideoBearRotated180) { |
| 197 RunVideoSizeTest("bear_rotate_180.mp4", 1280, 720); | 198 RunVideoSizeTest("bear_rotate_180.mp4", 1280, 720); |
| 198 } | 199 } |
| 199 | 200 |
| 200 IN_PROC_BROWSER_TEST_F(MediaTest, VideoBearRotated270) { | 201 IN_PROC_BROWSER_TEST_F(MediaTest, VideoBearRotated270) { |
| 201 RunVideoSizeTest("bear_rotate_270.mp4", 720, 1280); | 202 RunVideoSizeTest("bear_rotate_270.mp4", 720, 1280); |
| 202 } | 203 } |
| 203 #endif // defined(USE_PROPRIETARY_CODECS) | 204 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 204 | 205 |
| 205 #if defined(OS_CHROMEOS) | 206 #if defined(OS_CHROMEOS) |
| 206 #if defined(USE_PROPRIETARY_CODECS) | 207 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 207 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) { | 208 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) { |
| 208 PlayVideo("bear_mpeg4_mp3.avi", GetParam()); | 209 PlayVideo("bear_mpeg4_mp3.avi", GetParam()); |
| 209 } | 210 } |
| 210 | 211 |
| 211 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) { | 212 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) { |
| 212 PlayVideo("bear_mpeg4asp_mp3.avi", GetParam()); | 213 PlayVideo("bear_mpeg4asp_mp3.avi", GetParam()); |
| 213 } | 214 } |
| 214 | 215 |
| 215 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Divx) { | 216 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Divx) { |
| 216 PlayVideo("bear_divx_mp3.avi", GetParam()); | 217 PlayVideo("bear_divx_mp3.avi", GetParam()); |
| 217 } | 218 } |
| 218 | 219 |
| 219 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBear3gpAacH264) { | 220 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBear3gpAacH264) { |
| 220 PlayVideo("bear_h264_aac.3gp", GetParam()); | 221 PlayVideo("bear_h264_aac.3gp", GetParam()); |
| 221 } | 222 } |
| 222 | 223 |
| 223 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBear3gpAmrnbMpeg4) { | 224 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBear3gpAmrnbMpeg4) { |
| 224 PlayVideo("bear_mpeg4_amrnb.3gp", GetParam()); | 225 PlayVideo("bear_mpeg4_amrnb.3gp", GetParam()); |
| 225 } | 226 } |
| 226 | 227 |
| 227 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearWavGsmms) { | 228 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearWavGsmms) { |
| 228 PlayAudio("bear_gsm_ms.wav", GetParam()); | 229 PlayAudio("bear_gsm_ms.wav", GetParam()); |
| 229 } | 230 } |
| 230 #endif // defined(USE_PROPRIETARY_CODECS) | 231 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 231 #endif // defined(OS_CHROMEOS) | 232 #endif // defined(OS_CHROMEOS) |
| 232 | 233 |
| 233 IN_PROC_BROWSER_TEST_P(MediaTest, AudioBearFlac) { | 234 IN_PROC_BROWSER_TEST_P(MediaTest, AudioBearFlac) { |
| 234 PlayAudio("bear.flac", GetParam()); | 235 PlayAudio("bear.flac", GetParam()); |
| 235 } | 236 } |
| 236 | 237 |
| 237 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearWavAlaw) { | 238 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearWavAlaw) { |
| 238 PlayAudio("bear_alaw.wav", GetParam()); | 239 PlayAudio("bear_alaw.wav", GetParam()); |
| 239 } | 240 } |
| 240 | 241 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 262 IN_PROC_BROWSER_TEST_F(MediaTest, Navigate) { | 263 IN_PROC_BROWSER_TEST_F(MediaTest, Navigate) { |
| 263 PlayVideo("bear.webm", false); | 264 PlayVideo("bear.webm", false); |
| 264 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); | 265 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
| 265 EXPECT_FALSE(shell()->web_contents()->IsCrashed()); | 266 EXPECT_FALSE(shell()->web_contents()->IsCrashed()); |
| 266 } | 267 } |
| 267 | 268 |
| 268 INSTANTIATE_TEST_CASE_P(File, MediaTest, ::testing::Values(false)); | 269 INSTANTIATE_TEST_CASE_P(File, MediaTest, ::testing::Values(false)); |
| 269 INSTANTIATE_TEST_CASE_P(Http, MediaTest, ::testing::Values(true)); | 270 INSTANTIATE_TEST_CASE_P(Http, MediaTest, ::testing::Values(true)); |
| 270 | 271 |
| 271 } // namespace content | 272 } // namespace content |
| OLD | NEW |