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 "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "content/browser/media/media_browsertest.h" | 7 #include "content/browser/media/media_browsertest.h" |
8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
9 #include "media/media_features.h" | 9 #include "media/media_features.h" |
10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
(...skipping 12 matching lines...) Expand all Loading... |
23 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; | 23 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; |
24 | 24 |
25 #if defined(USE_PROPRIETARY_CODECS) | 25 #if defined(USE_PROPRIETARY_CODECS) |
26 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 26 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
27 const char kMp2tAudioVideo[] = "video/mp2t; codecs=\"mp4a.40.2, avc1.42E01E\""; | 27 const char kMp2tAudioVideo[] = "video/mp2t; codecs=\"mp4a.40.2, avc1.42E01E\""; |
28 #endif | 28 #endif |
29 #endif | 29 #endif |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 | 32 |
33 // MSE is available on all desktop platforms and on Android 4.1 and later. | |
34 static bool IsMSESupported() { | |
35 #if defined(OS_ANDROID) | |
36 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { | |
37 VLOG(0) << "MSE is only supported in Android 4.1 and later."; | |
38 return false; | |
39 } | |
40 #endif // defined(OS_ANDROID) | |
41 return true; | |
42 } | |
43 | |
44 class MediaSourceTest : public content::MediaBrowserTest { | 33 class MediaSourceTest : public content::MediaBrowserTest { |
45 public: | 34 public: |
46 void TestSimplePlayback(const std::string& media_file, | 35 void TestSimplePlayback(const std::string& media_file, |
47 const std::string& media_type, | 36 const std::string& media_type, |
48 const std::string& expectation) { | 37 const std::string& expectation) { |
49 if (!IsMSESupported()) { | |
50 VLOG(0) << "Skipping test - MSE not supported."; | |
51 return; | |
52 } | |
53 | |
54 base::StringPairs query_params; | 38 base::StringPairs query_params; |
55 query_params.push_back(std::make_pair("mediaFile", media_file)); | 39 query_params.push_back(std::make_pair("mediaFile", media_file)); |
56 query_params.push_back(std::make_pair("mediaType", media_type)); | 40 query_params.push_back(std::make_pair("mediaType", media_type)); |
57 RunMediaTestPage("media_source_player.html", query_params, expectation, | 41 RunMediaTestPage("media_source_player.html", query_params, expectation, |
58 false); | 42 false); |
59 } | 43 } |
60 | 44 |
61 void SetUpCommandLine(base::CommandLine* command_line) override { | 45 void SetUpCommandLine(base::CommandLine* command_line) override { |
62 command_line->AppendSwitch( | 46 command_line->AppendSwitch( |
63 switches::kDisableGestureRequirementForMediaPlayback); | 47 switches::kDisableGestureRequirementForMediaPlayback); |
(...skipping 28 matching lines...) Expand all Loading... |
92 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); | 76 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); |
93 } | 77 } |
94 | 78 |
95 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { | 79 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { |
96 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); | 80 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); |
97 } | 81 } |
98 | 82 |
99 // Flaky test crbug.com/246308 | 83 // Flaky test crbug.com/246308 |
100 // Test changed to skip checks resulting in flakiness. Proper fix still needed. | 84 // Test changed to skip checks resulting in flakiness. Proper fix still needed. |
101 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { | 85 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { |
102 if (!IsMSESupported()) { | |
103 VLOG(0) << "Skipping test - MSE not supported."; | |
104 return; | |
105 } | |
106 RunMediaTestPage("mse_config_change.html", base::StringPairs(), kEnded, true); | 86 RunMediaTestPage("mse_config_change.html", base::StringPairs(), kEnded, true); |
107 } | 87 } |
108 | 88 |
109 #if defined(USE_PROPRIETARY_CODECS) | 89 #if defined(USE_PROPRIETARY_CODECS) |
110 | 90 |
111 // TODO(chcunningham): Figure out why this is flaky on android. crbug/607841 | 91 // TODO(chcunningham): Figure out why this is flaky on android. crbug/607841 |
112 #if !defined(OS_ANDROID) | 92 #if !defined(OS_ANDROID) |
113 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_MP4_Audio_WEBM) { | 93 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_MP4_Audio_WEBM) { |
114 if (!IsMSESupported()) { | |
115 VLOG(0) << "Skipping test - MSE not supported."; | |
116 return; | |
117 } | |
118 base::StringPairs query_params; | 94 base::StringPairs query_params; |
119 query_params.push_back(std::make_pair("videoFormat", "CLEAR_MP4")); | 95 query_params.push_back(std::make_pair("videoFormat", "CLEAR_MP4")); |
120 query_params.push_back(std::make_pair("audioFormat", "CLEAR_WEBM")); | 96 query_params.push_back(std::make_pair("audioFormat", "CLEAR_WEBM")); |
121 RunMediaTestPage("mse_different_containers.html", query_params, kEnded, true); | 97 RunMediaTestPage("mse_different_containers.html", query_params, kEnded, true); |
122 } | 98 } |
123 #endif // !defined(OS_ANDROID) | 99 #endif // !defined(OS_ANDROID) |
124 | 100 |
125 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_WEBM_Audio_MP4) { | 101 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_WEBM_Audio_MP4) { |
126 if (!IsMSESupported()) { | |
127 VLOG(0) << "Skipping test - MSE not supported."; | |
128 return; | |
129 } | |
130 base::StringPairs query_params; | 102 base::StringPairs query_params; |
131 query_params.push_back(std::make_pair("videoFormat", "CLEAR_WEBM")); | 103 query_params.push_back(std::make_pair("videoFormat", "CLEAR_WEBM")); |
132 query_params.push_back(std::make_pair("audioFormat", "CLEAR_MP4")); | 104 query_params.push_back(std::make_pair("audioFormat", "CLEAR_MP4")); |
133 RunMediaTestPage("mse_different_containers.html", query_params, kEnded, true); | 105 RunMediaTestPage("mse_different_containers.html", query_params, kEnded, true); |
134 } | 106 } |
135 #endif | 107 #endif |
136 | 108 |
137 #if defined(USE_PROPRIETARY_CODECS) | 109 #if defined(USE_PROPRIETARY_CODECS) |
138 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 110 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
139 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioVideo_Mp2t) { | 111 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioVideo_Mp2t) { |
140 TestSimplePlayback("bear-1280x720.ts", kMp2tAudioVideo, kEnded); | 112 TestSimplePlayback("bear-1280x720.ts", kMp2tAudioVideo, kEnded); |
141 } | 113 } |
142 #endif | 114 #endif |
143 #endif | 115 #endif |
144 } // namespace content | 116 } // namespace content |
OLD | NEW |