Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: content/browser/media/encrypted_media_browsertest.cc

Issue 27230004: Do not run MSE related tests when MSE is not available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check MediaCodecBridge Availability Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/win/windows_version.h" 8 #include "base/win/windows_version.h"
9 #include "content/browser/media/media_browsertest.h" 9 #include "content/browser/media/media_browsertest.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
11 #include "content/public/test/browser_test_utils.h" 11 #include "content/public/test/browser_test_utils.h"
12 #include "content/shell/browser/shell.h" 12 #include "content/shell/browser/shell.h"
13 #if defined(OS_ANDROID)
14 #include "media/base/android/media_codec_bridge.h"
15 #endif
13 16
14 // Available key systems. 17 // Available key systems.
15 static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; 18 static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
16 19
17 // Supported media types. 20 // Supported media types.
18 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; 21 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
19 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; 22 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\"";
20 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; 23 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\"";
21 24
22 // EME-specific test results and errors. 25 // EME-specific test results and errors.
(...skipping 29 matching lines...) Expand all
52 encrypted_media, media_type, CurrentKeySystem(), CurrentSourceType()); 55 encrypted_media, media_type, CurrentKeySystem(), CurrentSourceType());
53 } 56 }
54 57
55 void TestFrameSizeChange() { 58 void TestFrameSizeChange() {
56 RunEncryptedMediaTest("encrypted_frame_size_change.html", 59 RunEncryptedMediaTest("encrypted_frame_size_change.html",
57 "frame_size_change-av-enc-v.webm", kWebMAudioVideo, 60 "frame_size_change-av-enc-v.webm", kWebMAudioVideo,
58 CurrentKeySystem(), CurrentSourceType(), kEnded); 61 CurrentKeySystem(), CurrentSourceType(), kEnded);
59 } 62 }
60 63
61 void TestConfigChange() { 64 void TestConfigChange() {
65 if (CurrentSourceType() != MSE) {
66 LOG(INFO) << "Skipping test - config change only applies to MSE.";
67 return;
68 }
69
70 #if defined(OS_ANDROID)
71 if (!media::MediaCodecBridge::IsAvailable()) {
72 LOG(INFO) << "Could not run test - MSE not supported.";
73 return;
74 }
75 #endif // defined(OS_ANDROID)
76
62 std::vector<StringPair> query_params; 77 std::vector<StringPair> query_params;
63 query_params.push_back(std::make_pair("keysystem", CurrentKeySystem())); 78 query_params.push_back(std::make_pair("keysystem", CurrentKeySystem()));
64 query_params.push_back(std::make_pair("runencrypted", "1")); 79 query_params.push_back(std::make_pair("runencrypted", "1"));
65 RunMediaTestPage("mse_config_change.html", &query_params, kEnded, true); 80 RunMediaTestPage("mse_config_change.html", &query_params, kEnded, true);
66 } 81 }
67 82
68 void RunEncryptedMediaTest(const char* html_page, 83 void RunEncryptedMediaTest(const char* html_page,
69 const char* media_file, 84 const char* media_file,
70 const char* media_type, 85 const char* media_type,
71 const char* key_system, 86 const char* key_system,
72 SrcType src_type, 87 SrcType src_type,
73 const char* expectation) { 88 const char* expectation) {
89 #if defined(OS_ANDROID)
90 if (src_type == MSE && !media::MediaCodecBridge::IsAvailable()) {
91 LOG(INFO) << "Could not run test - MSE not supported.";
92 return;
93 }
94 #endif // defined(OS_ANDROID)
95
74 std::vector<StringPair> query_params; 96 std::vector<StringPair> query_params;
75 query_params.push_back(std::make_pair("mediafile", media_file)); 97 query_params.push_back(std::make_pair("mediafile", media_file));
76 query_params.push_back(std::make_pair("mediatype", media_type)); 98 query_params.push_back(std::make_pair("mediatype", media_type));
77 query_params.push_back(std::make_pair("keysystem", key_system)); 99 query_params.push_back(std::make_pair("keysystem", key_system));
78 if (src_type == MSE) 100 if (src_type == MSE)
79 query_params.push_back(std::make_pair("usemse", "1")); 101 query_params.push_back(std::make_pair("usemse", "1"));
80 RunMediaTestPage(html_page, &query_params, expectation, true); 102 RunMediaTestPage(html_page, &query_params, expectation, true);
81 } 103 }
82 104
83 void RunSimpleEncryptedMediaTest(const char* media_file, 105 void RunSimpleEncryptedMediaTest(const char* media_file,
(...skipping 20 matching lines...) Expand all
104 #endif 126 #endif
105 }; 127 };
106 128
107 using ::testing::Combine; 129 using ::testing::Combine;
108 using ::testing::Values; 130 using ::testing::Values;
109 131
110 #if !defined(OS_ANDROID) 132 #if !defined(OS_ANDROID)
111 // Encrypted media playback with SRC is not supported on Android. 133 // Encrypted media playback with SRC is not supported on Android.
112 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, 134 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest,
113 Combine(Values(kClearKeyKeySystem), Values(SRC))); 135 Combine(Values(kClearKeyKeySystem), Values(SRC)));
114 #endif // defined(OS_ANDROID) 136 #endif // !defined(OS_ANDROID)
115 137
116 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, 138 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest,
117 Combine(Values(kClearKeyKeySystem), Values(MSE))); 139 Combine(Values(kClearKeyKeySystem), Values(MSE)));
118 140
119 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { 141 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) {
120 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); 142 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly);
121 } 143 }
122 144
123 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { 145 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) {
124 TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo); 146 TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo);
(...skipping 24 matching lines...) Expand all
149 TestFrameSizeChange(); 171 TestFrameSizeChange();
150 } 172 }
151 173
152 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { 174 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) {
153 RunEncryptedMediaTest("encrypted_media_player.html", "bear-a-enc_a.webm", 175 RunEncryptedMediaTest("encrypted_media_player.html", "bear-a-enc_a.webm",
154 kWebMAudioOnly, "com.example.foo", MSE, 176 kWebMAudioOnly, "com.example.foo", MSE,
155 kEmeGkrException); 177 kEmeGkrException);
156 } 178 }
157 179
158 } // namespace content 180 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698