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 |
10 #if defined(OS_ANDROID) | 11 #if defined(OS_ANDROID) |
11 #include "base/android/build_info.h" | 12 #include "base/android/build_info.h" |
12 #endif | 13 #endif |
13 | 14 |
14 // Common media types. | 15 // Common media types. |
15 #if defined(USE_PROPRIETARY_CODECS) && !defined(OS_ANDROID) | 16 #if BUILDFLAG(USE_PROPRIETARY_CODECS) && !defined(OS_ANDROID) |
16 const char kAAC_ADTS_AudioOnly[] = "audio/aac"; | 17 const char kAAC_ADTS_AudioOnly[] = "audio/aac"; |
17 #endif | 18 #endif |
18 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 19 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
19 #if !defined(OS_ANDROID) | 20 #if !defined(OS_ANDROID) |
20 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; | 21 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; |
21 #endif | 22 #endif |
22 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; | 23 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; |
23 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; | 24 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; |
24 | 25 |
25 #if defined(USE_PROPRIETARY_CODECS) | 26 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
26 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 27 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
27 const char kMp2tAudioVideo[] = "video/mp2t; codecs=\"mp4a.40.2, avc1.42E01E\""; | 28 const char kMp2tAudioVideo[] = "video/mp2t; codecs=\"mp4a.40.2, avc1.42E01E\""; |
28 #endif | 29 #endif |
29 #endif | 30 #endif |
30 | 31 |
31 namespace content { | 32 namespace content { |
32 | 33 |
33 class MediaSourceTest : public content::MediaBrowserTest { | 34 class MediaSourceTest : public content::MediaBrowserTest { |
34 public: | 35 public: |
35 void TestSimplePlayback(const std::string& media_file, | 36 void TestSimplePlayback(const std::string& media_file, |
(...skipping 16 matching lines...) Expand all Loading... |
52 TestSimplePlayback("bear-320x240.webm", kWebMAudioVideo, kEnded); | 53 TestSimplePlayback("bear-320x240.webm", kWebMAudioVideo, kEnded); |
53 } | 54 } |
54 | 55 |
55 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoOnly_WebM) { | 56 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoOnly_WebM) { |
56 TestSimplePlayback("bear-320x240-video-only.webm", kWebMVideoOnly, kEnded); | 57 TestSimplePlayback("bear-320x240-video-only.webm", kWebMVideoOnly, kEnded); |
57 } | 58 } |
58 | 59 |
59 // TODO(servolk): Android is supposed to support AAC in ADTS container with | 60 // TODO(servolk): Android is supposed to support AAC in ADTS container with |
60 // 'audio/aac' mime type, but for some reason playback fails on trybots due to | 61 // 'audio/aac' mime type, but for some reason playback fails on trybots due to |
61 // some issue in OMX AAC decoder (crbug.com/528361) | 62 // some issue in OMX AAC decoder (crbug.com/528361) |
62 #if defined(USE_PROPRIETARY_CODECS) && !defined(OS_ANDROID) | 63 #if BUILDFLAG(USE_PROPRIETARY_CODECS) && !defined(OS_ANDROID) |
63 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_AAC_ADTS) { | 64 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_AAC_ADTS) { |
64 TestSimplePlayback("sfx.adts", kAAC_ADTS_AudioOnly, kEnded); | 65 TestSimplePlayback("sfx.adts", kAAC_ADTS_AudioOnly, kEnded); |
65 } | 66 } |
66 #endif | 67 #endif |
67 | 68 |
68 // Opus is not supported in Android as of now. | 69 // Opus is not supported in Android as of now. |
69 #if !defined(OS_ANDROID) | 70 #if !defined(OS_ANDROID) |
70 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_Opus_WebM) { | 71 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_Opus_WebM) { |
71 TestSimplePlayback("bear-opus.webm", kWebMOpusAudioOnly, kEnded); | 72 TestSimplePlayback("bear-opus.webm", kWebMOpusAudioOnly, kEnded); |
72 } | 73 } |
73 #endif | 74 #endif |
74 | 75 |
75 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_WebM) { | 76 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_WebM) { |
76 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); | 77 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); |
77 } | 78 } |
78 | 79 |
79 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { | 80 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { |
80 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); | 81 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); |
81 } | 82 } |
82 | 83 |
83 // Flaky test crbug.com/246308 | 84 // Flaky test crbug.com/246308 |
84 // Test changed to skip checks resulting in flakiness. Proper fix still needed. | 85 // Test changed to skip checks resulting in flakiness. Proper fix still needed. |
85 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { | 86 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { |
86 RunMediaTestPage("mse_config_change.html", base::StringPairs(), kEnded, true); | 87 RunMediaTestPage("mse_config_change.html", base::StringPairs(), kEnded, true); |
87 } | 88 } |
88 | 89 |
89 #if defined(USE_PROPRIETARY_CODECS) | 90 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
90 | 91 |
91 // TODO(chcunningham): Figure out why this is flaky on android. crbug/607841 | 92 // TODO(chcunningham): Figure out why this is flaky on android. crbug/607841 |
92 #if !defined(OS_ANDROID) | 93 #if !defined(OS_ANDROID) |
93 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_MP4_Audio_WEBM) { | 94 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_MP4_Audio_WEBM) { |
94 base::StringPairs query_params; | 95 base::StringPairs query_params; |
95 query_params.push_back(std::make_pair("videoFormat", "CLEAR_MP4")); | 96 query_params.push_back(std::make_pair("videoFormat", "CLEAR_MP4")); |
96 query_params.push_back(std::make_pair("audioFormat", "CLEAR_WEBM")); | 97 query_params.push_back(std::make_pair("audioFormat", "CLEAR_WEBM")); |
97 RunMediaTestPage("mse_different_containers.html", query_params, kEnded, true); | 98 RunMediaTestPage("mse_different_containers.html", query_params, kEnded, true); |
98 } | 99 } |
99 #endif // !defined(OS_ANDROID) | 100 #endif // !defined(OS_ANDROID) |
100 | 101 |
101 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_WEBM_Audio_MP4) { | 102 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_WEBM_Audio_MP4) { |
102 base::StringPairs query_params; | 103 base::StringPairs query_params; |
103 query_params.push_back(std::make_pair("videoFormat", "CLEAR_WEBM")); | 104 query_params.push_back(std::make_pair("videoFormat", "CLEAR_WEBM")); |
104 query_params.push_back(std::make_pair("audioFormat", "CLEAR_MP4")); | 105 query_params.push_back(std::make_pair("audioFormat", "CLEAR_MP4")); |
105 RunMediaTestPage("mse_different_containers.html", query_params, kEnded, true); | 106 RunMediaTestPage("mse_different_containers.html", query_params, kEnded, true); |
106 } | 107 } |
107 #endif | 108 #endif |
108 | 109 |
109 #if defined(USE_PROPRIETARY_CODECS) | 110 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
110 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 111 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
111 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioVideo_Mp2t) { | 112 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioVideo_Mp2t) { |
112 TestSimplePlayback("bear-1280x720.ts", kMp2tAudioVideo, kEnded); | 113 TestSimplePlayback("bear-1280x720.ts", kMp2tAudioVideo, kEnded); |
113 } | 114 } |
114 #endif | 115 #endif |
115 #endif | 116 #endif |
116 } // namespace content | 117 } // namespace content |
OLD | NEW |