| 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/test_data_util.h" | 17 #include "media/base/test_data_util.h" |
| 17 #include "net/test/embedded_test_server/embedded_test_server.h" | 18 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 // Common test results. | 22 // Common test results. |
| 22 const char MediaBrowserTest::kEnded[] = "ENDED"; | 23 const char MediaBrowserTest::kEnded[] = "ENDED"; |
| 23 const char MediaBrowserTest::kError[] = "ERROR"; | 24 const char MediaBrowserTest::kError[] = "ERROR"; |
| 24 const char MediaBrowserTest::kFailed[] = "FAILED"; | 25 const char MediaBrowserTest::kFailed[] = "FAILED"; |
| 25 | 26 |
| 26 void MediaBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { | 27 void MediaBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { |
| 27 command_line->AppendSwitch( | 28 command_line->AppendSwitch( |
| 28 switches::kDisableGestureRequirementForMediaPlayback); | 29 switches::kDisableGestureRequirementForMediaPlayback); |
| 30 command_line->AppendSwitch(switches::kEnableVp9InMp4); |
| 29 } | 31 } |
| 30 | 32 |
| 31 void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, | 33 void MediaBrowserTest::RunMediaTestPage(const std::string& html_page, |
| 32 const base::StringPairs& query_params, | 34 const base::StringPairs& query_params, |
| 33 const std::string& expected_title, | 35 const std::string& expected_title, |
| 34 bool http) { | 36 bool http) { |
| 35 GURL gurl; | 37 GURL gurl; |
| 36 std::string query = media::GetURLQueryString(query_params); | 38 std::string query = media::GetURLQueryString(query_params); |
| 37 std::unique_ptr<net::EmbeddedTestServer> http_test_server; | 39 std::unique_ptr<net::EmbeddedTestServer> http_test_server; |
| 38 if (http) { | 40 if (http) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // Crashes on Mac only. http://crbug.com/621857 | 145 // Crashes on Mac only. http://crbug.com/621857 |
| 144 #if defined(OS_MACOSX) | 146 #if defined(OS_MACOSX) |
| 145 #define MAYBE_VideoBearMp4 DISABLED_VideoBearMp4 | 147 #define MAYBE_VideoBearMp4 DISABLED_VideoBearMp4 |
| 146 #else | 148 #else |
| 147 #define MAYBE_VideoBearMp4 VideoBearMp4 | 149 #define MAYBE_VideoBearMp4 VideoBearMp4 |
| 148 #endif | 150 #endif |
| 149 IN_PROC_BROWSER_TEST_P(MediaTest, MAYBE_VideoBearMp4) { | 151 IN_PROC_BROWSER_TEST_P(MediaTest, MAYBE_VideoBearMp4) { |
| 150 PlayVideo("bear.mp4", GetParam()); | 152 PlayVideo("bear.mp4", GetParam()); |
| 151 } | 153 } |
| 152 | 154 |
| 155 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearMp4Vp9) { |
| 156 PlayVideo("bear-320x240-v_frag-vp9.mp4", GetParam()); |
| 157 } |
| 158 |
| 153 // Android devices usually only support baseline, main and high. | 159 // Android devices usually only support baseline, main and high. |
| 154 #if !defined(OS_ANDROID) | 160 #if !defined(OS_ANDROID) |
| 155 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearHighBitDepthMp4) { | 161 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearHighBitDepthMp4) { |
| 156 PlayVideo("bear-320x180-hi10p.mp4", GetParam()); | 162 PlayVideo("bear-320x180-hi10p.mp4", GetParam()); |
| 157 } | 163 } |
| 158 #endif // !defined(OS_ANDROID) | 164 #endif // !defined(OS_ANDROID) |
| 159 | 165 |
| 160 // Crashes on Mac only. http://crbug.com/621857 | 166 // Crashes on Mac only. http://crbug.com/621857 |
| 161 #if defined(OS_MACOSX) | 167 #if defined(OS_MACOSX) |
| 162 #define MAYBE_VideoBearSilentMp4 DISABLED_VideoBearSilentMp4 | 168 #define MAYBE_VideoBearSilentMp4 DISABLED_VideoBearSilentMp4 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 IN_PROC_BROWSER_TEST_F(MediaTest, Navigate) { | 261 IN_PROC_BROWSER_TEST_F(MediaTest, Navigate) { |
| 256 PlayVideo("bear.webm", false); | 262 PlayVideo("bear.webm", false); |
| 257 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); | 263 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
| 258 EXPECT_FALSE(shell()->web_contents()->IsCrashed()); | 264 EXPECT_FALSE(shell()->web_contents()->IsCrashed()); |
| 259 } | 265 } |
| 260 | 266 |
| 261 INSTANTIATE_TEST_CASE_P(File, MediaTest, ::testing::Values(false)); | 267 INSTANTIATE_TEST_CASE_P(File, MediaTest, ::testing::Values(false)); |
| 262 INSTANTIATE_TEST_CASE_P(Http, MediaTest, ::testing::Values(true)); | 268 INSTANTIATE_TEST_CASE_P(Http, MediaTest, ::testing::Values(true)); |
| 263 | 269 |
| 264 } // namespace content | 270 } // namespace content |
| OLD | NEW |