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 | 8 |
9 // Common media types. | 9 // Common media types. |
10 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 10 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
11 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; | 11 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; |
12 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; | 12 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 class MediaSourceTest : public content::MediaBrowserTest { | 16 class MediaSourceTest : public content::MediaBrowserTest { |
17 public: | 17 public: |
18 void TestSimplePlayback(const char* media_file, const char* media_type, | 18 void TestSimplePlayback(const char* media_file, const char* media_type, |
19 const char* expectation) { | 19 const char* expectation) { |
20 std::vector<StringPair> query_params; | 20 std::vector<StringPair> query_params; |
21 query_params.push_back(std::make_pair("mediafile", media_file)); | 21 query_params.push_back(std::make_pair("mediafile", media_file)); |
22 query_params.push_back(std::make_pair("mediatype", media_type)); | 22 query_params.push_back(std::make_pair("mediatype", media_type)); |
23 RunMediaTestPage("media_source_player.html", &query_params, expectation, | 23 RunMediaTestPage("media_source_player.html", &query_params, expectation, |
24 true); | 24 true); |
25 } | 25 } |
26 | 26 |
27 #if defined(OS_ANDROID) | 27 #if defined(OS_ANDROID) |
28 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 28 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
29 // TODO(scherkus): Remove after enabled by default http://crbug.com/233420 | |
30 command_line->AppendSwitch(switches::kEnableWebKitMediaSource); | |
31 command_line->AppendSwitch( | 29 command_line->AppendSwitch( |
32 switches::kDisableGestureRequirementForMediaPlayback); | 30 switches::kDisableGestureRequirementForMediaPlayback); |
33 } | 31 } |
34 #endif | 32 #endif |
35 }; | 33 }; |
36 | 34 |
37 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoAudio_WebM) { | 35 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoAudio_WebM) { |
38 TestSimplePlayback("bear-320x240.webm", kWebMAudioVideo, kEnded); | 36 TestSimplePlayback("bear-320x240.webm", kWebMAudioVideo, kEnded); |
39 } | 37 } |
40 | 38 |
41 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoOnly_WebM) { | 39 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoOnly_WebM) { |
42 TestSimplePlayback("bear-320x240-video-only.webm", kWebMVideoOnly, kEnded); | 40 TestSimplePlayback("bear-320x240-video-only.webm", kWebMVideoOnly, kEnded); |
43 } | 41 } |
44 | 42 |
45 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_WebM) { | 43 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_WebM) { |
46 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); | 44 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); |
47 } | 45 } |
48 | 46 |
49 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { | 47 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { |
50 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); | 48 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); |
51 } | 49 } |
52 | 50 |
53 // Flaky test crbug.com/246308 | 51 // Flaky test crbug.com/246308 |
54 // Test changed to skip checks resulting in flakiness. Proper fix still needed. | 52 // Test changed to skip checks resulting in flakiness. Proper fix still needed. |
55 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { | 53 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { |
56 RunMediaTestPage("mse_config_change.html", NULL, kEnded, true); | 54 RunMediaTestPage("mse_config_change.html", NULL, kEnded, true); |
57 } | 55 } |
58 | 56 |
59 } // namespace content | 57 } // namespace content |
OLD | NEW |