| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "content/browser/media/media_browsertest.h" | 6 #include "content/browser/media/media_browsertest.h" |
| 7 #include "content/public/common/content_switches.h" | 7 #include "content/public/common/content_switches.h" |
| 8 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 8 | 9 |
| 9 // Common media types. | 10 // Common media types. |
| 10 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 11 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
| 11 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; | 12 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; |
| 12 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; | 13 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 class MediaSourceTest : public content::MediaBrowserTest { | 17 class MediaSourceTest : public content::MediaBrowserTest { |
| 17 public: | 18 public: |
| 18 void TestSimplePlayback(const char* media_file, const char* media_type, | 19 void TestSimplePlayback(const char* media_file, const char* media_type, |
| 19 const char* expectation) { | 20 const char* expectation) { |
| 21 // TODO(xhwang): Update this to check for unprefixed MSE API when |
| 22 // http://crbug.com/307107 is fixed. |
| 23 if (!WebKit::WebRuntimeFeatures::isWebKitMediaSourceEnabled()) { |
| 24 LOG(INFO) << "Could not run test - prefixed MSE not supported."; |
| 25 return; |
| 26 } |
| 27 |
| 20 std::vector<StringPair> query_params; | 28 std::vector<StringPair> query_params; |
| 21 query_params.push_back(std::make_pair("mediafile", media_file)); | 29 query_params.push_back(std::make_pair("mediafile", media_file)); |
| 22 query_params.push_back(std::make_pair("mediatype", media_type)); | 30 query_params.push_back(std::make_pair("mediatype", media_type)); |
| 23 RunMediaTestPage("media_source_player.html", &query_params, expectation, | 31 RunMediaTestPage("media_source_player.html", &query_params, expectation, |
| 24 true); | 32 true); |
| 25 } | 33 } |
| 26 | 34 |
| 27 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 28 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 36 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 29 command_line->AppendSwitch( | 37 command_line->AppendSwitch( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 44 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); | 52 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); |
| 45 } | 53 } |
| 46 | 54 |
| 47 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { | 55 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { |
| 48 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); | 56 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); |
| 49 } | 57 } |
| 50 | 58 |
| 51 // Flaky test crbug.com/246308 | 59 // Flaky test crbug.com/246308 |
| 52 // Test changed to skip checks resulting in flakiness. Proper fix still needed. | 60 // Test changed to skip checks resulting in flakiness. Proper fix still needed. |
| 53 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { | 61 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { |
| 62 // TODO(xhwang): Update this to check for unprefixed MSE API when |
| 63 // http://crbug.com/307107 is fixed. |
| 64 if (!WebKit::WebRuntimeFeatures::isWebKitMediaSourceEnabled()) { |
| 65 LOG(INFO) << "Could not run test - prefixed MSE not supported."; |
| 66 return; |
| 67 } |
| 54 RunMediaTestPage("mse_config_change.html", NULL, kEnded, true); | 68 RunMediaTestPage("mse_config_change.html", NULL, kEnded, true); |
| 55 } | 69 } |
| 56 | 70 |
| 57 } // namespace content | 71 } // namespace content |
| OLD | NEW |