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