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

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

Issue 1712903002: Remove prefixed EME. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix isRenewalMessage() in browser tests. Created 4 years, 10 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | content/child/runtime_features.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <utility> 5 #include <utility>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 23 matching lines...) Expand all
34 "clearkeycdmadapter.dll"; 34 "clearkeycdmadapter.dll";
35 #elif defined(OS_POSIX) 35 #elif defined(OS_POSIX)
36 "libclearkeycdmadapter.so"; 36 "libclearkeycdmadapter.so";
37 #endif 37 #endif
38 38
39 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm"; 39 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm";
40 #endif // defined(ENABLE_PEPPER_CDMS) 40 #endif // defined(ENABLE_PEPPER_CDMS)
41 41
42 // Available key systems. 42 // Available key systems.
43 const char kClearKeyKeySystem[] = "org.w3.clearkey"; 43 const char kClearKeyKeySystem[] = "org.w3.clearkey";
44 const char kPrefixedClearKeyKeySystem[] = "webkit-org.w3.clearkey";
45 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; 44 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
46 const char kExternalClearKeyFileIOTestKeySystem[] = 45 const char kExternalClearKeyFileIOTestKeySystem[] =
47 "org.chromium.externalclearkey.fileiotest"; 46 "org.chromium.externalclearkey.fileiotest";
48 const char kExternalClearKeyInitializeFailKeySystem[] = 47 const char kExternalClearKeyInitializeFailKeySystem[] =
49 "org.chromium.externalclearkey.initializefail"; 48 "org.chromium.externalclearkey.initializefail";
50 const char kExternalClearKeyCrashKeySystem[] = 49 const char kExternalClearKeyCrashKeySystem[] =
51 "org.chromium.externalclearkey.crash"; 50 "org.chromium.externalclearkey.crash";
52 51
53 // Supported media types. 52 // Supported media types.
54 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; 53 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
(...skipping 12 matching lines...) Expand all
67 66
68 // EME-specific test results and errors. 67 // EME-specific test results and errors.
69 const char kFileIOTestSuccess[] = "FILE_IO_TEST_SUCCESS"; 68 const char kFileIOTestSuccess[] = "FILE_IO_TEST_SUCCESS";
70 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; 69 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR";
71 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; 70 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED";
72 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; 71 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND";
73 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; 72 const char kEmeLoadFailed[] = "EME_LOAD_FAILED";
74 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; 73 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED";
75 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; 74 const char kEmeErrorEvent[] = "EME_ERROR_EVENT";
76 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; 75 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE";
77 const char kPrefixedEmeRenewalMissingHeader[] = 76 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER";
78 "PREFIXED_EME_RENEWAL_MISSING_HEADER";
79 const char kPrefixedEmeErrorEvent[] = "PREFIXED_EME_ERROR_EVENT";
80 77
81 const char kDefaultEmePlayer[] = "eme_player.html"; 78 const char kDefaultEmePlayer[] = "eme_player.html";
82 79
83 // The type of video src used to load media. 80 // The type of video src used to load media.
84 enum SrcType { 81 enum SrcType {
85 SRC, 82 SRC,
86 MSE 83 MSE
87 }; 84 };
88 85
89 // Whether to use prefixed or unprefixed EME.
90 enum EmeVersion {
91 PREFIXED,
92 UNPREFIXED
93 };
94
95 // Whether the video should be played once or twice. 86 // Whether the video should be played once or twice.
96 enum class PlayTwice { NO, YES }; 87 enum class PlayTwice { NO, YES };
97 88
98 // Format of a container when testing different streams. 89 // Format of a container when testing different streams.
99 enum class EncryptedContainer { 90 enum class EncryptedContainer {
100 CLEAR_WEBM, 91 CLEAR_WEBM,
101 CLEAR_MP4, 92 CLEAR_MP4,
102 ENCRYPTED_WEBM, 93 ENCRYPTED_WEBM,
103 ENCRYPTED_MP4 94 ENCRYPTED_MP4
104 }; 95 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // and trying to update it with licenses. 143 // and trying to update it with licenses.
153 // When |force_invalid_response| is true, the test will provide invalid 144 // When |force_invalid_response| is true, the test will provide invalid
154 // responses, which should trigger errors. 145 // responses, which should trigger errors.
155 // TODO(xhwang): Find an easier way to pass multiple configuration test 146 // TODO(xhwang): Find an easier way to pass multiple configuration test
156 // options. 147 // options.
157 void RunEncryptedMediaTest(const std::string& html_page, 148 void RunEncryptedMediaTest(const std::string& html_page,
158 const std::string& media_file, 149 const std::string& media_file,
159 const std::string& media_type, 150 const std::string& media_type,
160 const std::string& key_system, 151 const std::string& key_system,
161 SrcType src_type, 152 SrcType src_type,
162 EmeVersion eme_version,
163 const std::string& session_to_load, 153 const std::string& session_to_load,
164 bool force_invalid_response, 154 bool force_invalid_response,
165 PlayTwice play_twice, 155 PlayTwice play_twice,
166 const std::string& expected_title) { 156 const std::string& expected_title) {
167 if (src_type == MSE && !IsMSESupported()) { 157 if (src_type == MSE && !IsMSESupported()) {
168 DVLOG(0) << "Skipping test - MSE not supported."; 158 DVLOG(0) << "Skipping test - MSE not supported.";
169 return; 159 return;
170 } 160 }
171 base::StringPairs query_params; 161 base::StringPairs query_params;
172 query_params.push_back(std::make_pair("mediaFile", media_file)); 162 query_params.push_back(std::make_pair("mediaFile", media_file));
173 query_params.push_back(std::make_pair("mediaType", media_type)); 163 query_params.push_back(std::make_pair("mediaType", media_type));
174 query_params.push_back(std::make_pair("keySystem", key_system)); 164 query_params.push_back(std::make_pair("keySystem", key_system));
175 if (src_type == MSE) 165 if (src_type == MSE)
176 query_params.push_back(std::make_pair("useMSE", "1")); 166 query_params.push_back(std::make_pair("useMSE", "1"));
177 if (eme_version == PREFIXED)
178 query_params.push_back(std::make_pair("usePrefixedEME", "1"));
179 if (force_invalid_response) 167 if (force_invalid_response)
180 query_params.push_back(std::make_pair("forceInvalidResponse", "1")); 168 query_params.push_back(std::make_pair("forceInvalidResponse", "1"));
181 if (!session_to_load.empty()) 169 if (!session_to_load.empty())
182 query_params.push_back(std::make_pair("sessionToLoad", session_to_load)); 170 query_params.push_back(std::make_pair("sessionToLoad", session_to_load));
183 if (play_twice == PlayTwice::YES) 171 if (play_twice == PlayTwice::YES)
184 query_params.push_back(std::make_pair("playTwice", "1")); 172 query_params.push_back(std::make_pair("playTwice", "1"));
185 RunEncryptedMediaTestPage(html_page, key_system, query_params, 173 RunEncryptedMediaTestPage(html_page, key_system, query_params,
186 expected_title); 174 expected_title);
187 } 175 }
188 176
189 void RunSimpleEncryptedMediaTest(const std::string& media_file, 177 void RunSimpleEncryptedMediaTest(const std::string& media_file,
190 const std::string& media_type, 178 const std::string& media_type,
191 const std::string& key_system, 179 const std::string& key_system,
192 SrcType src_type, 180 SrcType src_type) {
193 EmeVersion eme_version) {
194 std::string expected_title = kEnded; 181 std::string expected_title = kEnded;
195 if (!IsPlayBackPossible(key_system)) { 182 if (!IsPlayBackPossible(key_system)) {
196 expected_title = (eme_version == EmeVersion::UNPREFIXED) 183 expected_title = kEmeUpdateFailed;
197 ? kEmeUpdateFailed
198 : kPrefixedEmeErrorEvent;
199 } 184 }
200 185
201 RunEncryptedMediaTest(kDefaultEmePlayer, media_file, media_type, key_system, 186 RunEncryptedMediaTest(kDefaultEmePlayer, media_file, media_type, key_system,
202 src_type, eme_version, kNoSessionToLoad, false, 187 src_type, kNoSessionToLoad, false, PlayTwice::NO,
203 PlayTwice::NO, expected_title); 188 expected_title);
204 // Check KeyMessage received for all key systems. 189 // Check KeyMessage received for all key systems.
205 bool receivedKeyMessage = false; 190 bool receivedKeyMessage = false;
206 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 191 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
207 browser()->tab_strip_model()->GetActiveWebContents(), 192 browser()->tab_strip_model()->GetActiveWebContents(),
208 "window.domAutomationController.send(" 193 "window.domAutomationController.send("
209 "document.querySelector('video').receivedKeyMessage);", 194 "document.querySelector('video').receivedKeyMessage);",
210 &receivedKeyMessage)); 195 &receivedKeyMessage));
211 EXPECT_TRUE(receivedKeyMessage); 196 EXPECT_TRUE(receivedKeyMessage);
212 } 197 }
213 198
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); 238 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError));
254 title_watcher->AlsoWaitForTitle( 239 title_watcher->AlsoWaitForTitle(
255 base::ASCIIToUTF16(kEmeGenerateRequestFailed)); 240 base::ASCIIToUTF16(kEmeGenerateRequestFailed));
256 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeSessionNotFound)); 241 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeSessionNotFound));
257 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeLoadFailed)); 242 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeLoadFailed));
258 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeUpdateFailed)); 243 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeUpdateFailed));
259 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeErrorEvent)); 244 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeErrorEvent));
260 title_watcher->AlsoWaitForTitle( 245 title_watcher->AlsoWaitForTitle(
261 base::ASCIIToUTF16(kEmeMessageUnexpectedType)); 246 base::ASCIIToUTF16(kEmeMessageUnexpectedType));
262 title_watcher->AlsoWaitForTitle( 247 title_watcher->AlsoWaitForTitle(
263 base::ASCIIToUTF16(kPrefixedEmeRenewalMissingHeader)); 248 base::ASCIIToUTF16(kEmeRenewalMissingHeader));
264 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kPrefixedEmeErrorEvent));
265 } 249 }
266 250
267 void SetUpCommandLine(base::CommandLine* command_line) override { 251 void SetUpCommandLine(base::CommandLine* command_line) override {
268 command_line->AppendSwitch( 252 command_line->AppendSwitch(
269 switches::kDisableGestureRequirementForMediaPlayback); 253 switches::kDisableGestureRequirementForMediaPlayback);
270 // For simplicity with respect to parameterized tests, enable for all tests.
271 command_line->AppendSwitch(switches::kEnablePrefixedEncryptedMedia);
272 } 254 }
273 255
274 void SetUpCommandLineForKeySystem(const std::string& key_system, 256 void SetUpCommandLineForKeySystem(const std::string& key_system,
275 base::CommandLine* command_line) { 257 base::CommandLine* command_line) {
276 if (GetServerConfig(key_system)) 258 if (GetServerConfig(key_system))
277 // Since the web and license servers listen on different ports, we need to 259 // Since the web and license servers listen on different ports, we need to
278 // disable web-security to send license requests to the license server. 260 // disable web-security to send license requests to the license server.
279 // TODO(shadi): Add port forwarding to the test web server configuration. 261 // TODO(shadi): Add port forwarding to the test web server configuration.
280 command_line->AppendSwitch(switches::kDisableWebSecurity); 262 command_line->AppendSwitch(switches::kDisableWebSecurity);
281 263
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // Tests encrypted media playback using ExternalClearKey key system in 319 // Tests encrypted media playback using ExternalClearKey key system in
338 // decrypt-and-decode mode. 320 // decrypt-and-decode mode.
339 class ECKEncryptedMediaTest : public EncryptedMediaTestBase { 321 class ECKEncryptedMediaTest : public EncryptedMediaTestBase {
340 public: 322 public:
341 // We use special |key_system| names to do non-playback related tests, e.g. 323 // We use special |key_system| names to do non-playback related tests, e.g.
342 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. 324 // kExternalClearKeyFileIOTestKeySystem is used to test file IO.
343 void TestNonPlaybackCases(const std::string& key_system, 325 void TestNonPlaybackCases(const std::string& key_system,
344 const std::string& expected_title) { 326 const std::string& expected_title) {
345 // Since we do not test playback, arbitrarily choose a test file and source 327 // Since we do not test playback, arbitrarily choose a test file and source
346 // type. 328 // type.
347 RunEncryptedMediaTest( 329 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
348 kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly, key_system, SRC, 330 kWebMAudioOnly, key_system, SRC, kNoSessionToLoad,
349 UNPREFIXED, kNoSessionToLoad, false, PlayTwice::NO, expected_title); 331 false, PlayTwice::NO, expected_title);
350 } 332 }
351 333
352 void TestPlaybackCase(const std::string& session_to_load, 334 void TestPlaybackCase(const std::string& session_to_load,
353 const std::string& expected_title) { 335 const std::string& expected_title) {
354 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-v_enc-v.webm", 336 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-v_enc-v.webm",
355 kWebMVideoOnly, kExternalClearKeyKeySystem, SRC, 337 kWebMVideoOnly, kExternalClearKeyKeySystem, SRC,
356 UNPREFIXED, session_to_load, false, PlayTwice::NO, 338 session_to_load, false, PlayTwice::NO,
357 expected_title); 339 expected_title);
358 } 340 }
359 341
360 protected:
361 void SetUpCommandLine(base::CommandLine* command_line) override {
362 EncryptedMediaTestBase::SetUpCommandLine(command_line);
363 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line);
364 }
365 };
366
367 // Tests encrypted media playback using ExternalClearKey key system in
368 // decrypt-and-decode mode for prefixed EME.
369 class ECKPrefixedEncryptedMediaTest : public EncryptedMediaTestBase {
370 public:
371 // We use special |key_system| names to do non-playback related tests, e.g.
372 // kExternalClearKeyFileIOTestKeySystem is used to test file IO.
373 void TestNonPlaybackCases(const std::string& key_system,
374 const std::string& expected_title) {
375 // Since we do not test playback, arbitrarily choose a test file and source
376 // type.
377 RunEncryptedMediaTest(
378 kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly, key_system, SRC,
379 PREFIXED, kNoSessionToLoad, false, PlayTwice::NO, expected_title);
380 }
381
382 void TestPlaybackCase(const std::string& session_to_load,
383 const std::string& expected_title) {
384 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-v_enc-v.webm",
385 kWebMVideoOnly, kExternalClearKeyKeySystem, SRC,
386 PREFIXED, session_to_load, false, PlayTwice::NO,
387 expected_title);
388 }
389
390 protected: 342 protected:
391 void SetUpCommandLine(base::CommandLine* command_line) override { 343 void SetUpCommandLine(base::CommandLine* command_line) override {
392 EncryptedMediaTestBase::SetUpCommandLine(command_line); 344 EncryptedMediaTestBase::SetUpCommandLine(command_line);
393 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); 345 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line);
394 } 346 }
395 }; 347 };
396 348
397 #if defined(WIDEVINE_CDM_AVAILABLE) 349 #if defined(WIDEVINE_CDM_AVAILABLE)
398 // Tests encrypted media playback using Widevine key system. 350 // Tests encrypted media playback using Widevine key system.
399 class WVEncryptedMediaTest : public EncryptedMediaTestBase { 351 class WVEncryptedMediaTest : public EncryptedMediaTestBase {
400 protected: 352 protected:
401 void SetUpCommandLine(base::CommandLine* command_line) override { 353 void SetUpCommandLine(base::CommandLine* command_line) override {
402 EncryptedMediaTestBase::SetUpCommandLine(command_line); 354 EncryptedMediaTestBase::SetUpCommandLine(command_line);
403 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); 355 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line);
404 } 356 }
405 }; 357 };
406 358
407 #endif // defined(WIDEVINE_CDM_AVAILABLE) 359 #endif // defined(WIDEVINE_CDM_AVAILABLE)
408 #endif // defined(ENABLE_PEPPER_CDMS) 360 #endif // defined(ENABLE_PEPPER_CDMS)
409 361
410 // Tests encrypted media playback with a combination of parameters: 362 // Tests encrypted media playback with a combination of parameters:
411 // - char*: Key system name. 363 // - char*: Key system name.
412 // - SrcType: Use MSE or SRC. 364 // - SrcType: Use MSE or SRC.
413 // - EmeVersion: Use PREFIXED or UNPREFIXED EME.
414 // 365 //
415 // Note: Only parameterized (*_P) tests can be used. Non-parameterized (*_F) 366 // Note: Only parameterized (*_P) tests can be used. Non-parameterized (*_F)
416 // tests will crash at GetParam(). To add non-parameterized tests, use 367 // tests will crash at GetParam(). To add non-parameterized tests, use
417 // EncryptedMediaTestBase or one of its subclasses (e.g. WVEncryptedMediaTest). 368 // EncryptedMediaTestBase or one of its subclasses (e.g. WVEncryptedMediaTest).
418 class EncryptedMediaTest 369 class EncryptedMediaTest : public EncryptedMediaTestBase,
419 : public EncryptedMediaTestBase, 370 public testing::WithParamInterface<
420 public testing::WithParamInterface< 371 std::tr1::tuple<const char*, SrcType>> {
421 std::tr1::tuple<const char*, SrcType, EmeVersion> > {
422 public: 372 public:
423 std::string CurrentKeySystem() { 373 std::string CurrentKeySystem() {
424 return std::tr1::get<0>(GetParam()); 374 return std::tr1::get<0>(GetParam());
425 } 375 }
426 376
427 SrcType CurrentSourceType() { 377 SrcType CurrentSourceType() {
428 return std::tr1::get<1>(GetParam()); 378 return std::tr1::get<1>(GetParam());
429 } 379 }
430 380
431 EmeVersion CurrentEmeVersion() {
432 return std::tr1::get<2>(GetParam());
433 }
434
435 void TestSimplePlayback(const std::string& encrypted_media, 381 void TestSimplePlayback(const std::string& encrypted_media,
436 const std::string& media_type) { 382 const std::string& media_type) {
437 RunSimpleEncryptedMediaTest(encrypted_media, 383 RunSimpleEncryptedMediaTest(encrypted_media, media_type, CurrentKeySystem(),
438 media_type, 384 CurrentSourceType());
439 CurrentKeySystem(),
440 CurrentSourceType(),
441 CurrentEmeVersion());
442 } 385 }
443 386
444 void TestMultiplePlayback(const std::string& encrypted_media, 387 void TestMultiplePlayback(const std::string& encrypted_media,
445 const std::string& media_type) { 388 const std::string& media_type) {
446 DCHECK(IsPlayBackPossible(CurrentKeySystem())); 389 DCHECK(IsPlayBackPossible(CurrentKeySystem()));
447 RunEncryptedMediaTest(kDefaultEmePlayer, encrypted_media, media_type, 390 RunEncryptedMediaTest(kDefaultEmePlayer, encrypted_media, media_type,
448 CurrentKeySystem(), CurrentSourceType(), 391 CurrentKeySystem(), CurrentSourceType(),
449 CurrentEmeVersion(), kNoSessionToLoad, false, 392 kNoSessionToLoad, false, PlayTwice::YES, kEnded);
450 PlayTwice::YES, kEnded);
451 } 393 }
452 394
453 void RunInvalidResponseTest() { 395 void RunInvalidResponseTest() {
454 std::string expected_response = 396 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-av_enc-av.webm",
455 (CurrentEmeVersion() == EmeVersion::UNPREFIXED) 397 kWebMAudioVideo, CurrentKeySystem(),
456 ? kEmeUpdateFailed 398 CurrentSourceType(), kNoSessionToLoad, true,
457 : kPrefixedEmeErrorEvent; 399 PlayTwice::NO, kEmeUpdateFailed);
458 RunEncryptedMediaTest(
459 kDefaultEmePlayer, "bear-320x240-av_enc-av.webm", kWebMAudioVideo,
460 CurrentKeySystem(), CurrentSourceType(), CurrentEmeVersion(),
461 kNoSessionToLoad, true, PlayTwice::NO, expected_response);
462 } 400 }
463 401
464 void TestFrameSizeChange() { 402 void TestFrameSizeChange() {
465 RunEncryptedMediaTest( 403 RunEncryptedMediaTest("encrypted_frame_size_change.html",
466 "encrypted_frame_size_change.html", "frame_size_change-av_enc-v.webm", 404 "frame_size_change-av_enc-v.webm", kWebMAudioVideo,
467 kWebMAudioVideo, CurrentKeySystem(), CurrentSourceType(), 405 CurrentKeySystem(), CurrentSourceType(),
468 CurrentEmeVersion(), kNoSessionToLoad, false, PlayTwice::NO, kEnded); 406 kNoSessionToLoad, false, PlayTwice::NO, kEnded);
469 } 407 }
470 408
471 void TestConfigChange() { 409 void TestConfigChange() {
472 DCHECK(IsMSESupported()); 410 DCHECK(IsMSESupported());
473 base::StringPairs query_params; 411 base::StringPairs query_params;
474 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); 412 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem()));
475 query_params.push_back(std::make_pair("runEncrypted", "1")); 413 query_params.push_back(std::make_pair("runEncrypted", "1"));
476 if (CurrentEmeVersion() == PREFIXED)
477 query_params.push_back(std::make_pair("usePrefixedEME", "1"));
478 RunEncryptedMediaTestPage("mse_config_change.html", 414 RunEncryptedMediaTestPage("mse_config_change.html",
479 CurrentKeySystem(), 415 CurrentKeySystem(),
480 query_params, 416 query_params,
481 kEnded); 417 kEnded);
482 } 418 }
483 419
484 std::string ConvertContainerFormat(EncryptedContainer format) { 420 std::string ConvertContainerFormat(EncryptedContainer format) {
485 switch (format) { 421 switch (format) {
486 case EncryptedContainer::CLEAR_MP4: 422 case EncryptedContainer::CLEAR_MP4:
487 return "CLEAR_MP4"; 423 return "CLEAR_MP4";
488 case EncryptedContainer::CLEAR_WEBM: 424 case EncryptedContainer::CLEAR_WEBM:
489 return "CLEAR_WEBM"; 425 return "CLEAR_WEBM";
490 case EncryptedContainer::ENCRYPTED_MP4: 426 case EncryptedContainer::ENCRYPTED_MP4:
491 return "ENCRYPTED_MP4"; 427 return "ENCRYPTED_MP4";
492 case EncryptedContainer::ENCRYPTED_WEBM: 428 case EncryptedContainer::ENCRYPTED_WEBM:
493 return "ENCRYPTED_WEBM"; 429 return "ENCRYPTED_WEBM";
494 } 430 }
495 NOTREACHED(); 431 NOTREACHED();
496 return "UNKNOWN"; 432 return "UNKNOWN";
497 } 433 }
498 434
499 void TestDifferentContainers(EncryptedContainer video_format, 435 void TestDifferentContainers(EncryptedContainer video_format,
500 EncryptedContainer audio_format) { 436 EncryptedContainer audio_format) {
501 DCHECK(IsMSESupported()); 437 DCHECK(IsMSESupported());
502 DCHECK_NE(CurrentEmeVersion(), PREFIXED);
503 base::StringPairs query_params; 438 base::StringPairs query_params;
504 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); 439 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem()));
505 query_params.push_back(std::make_pair("runEncrypted", "1")); 440 query_params.push_back(std::make_pair("runEncrypted", "1"));
506 query_params.push_back( 441 query_params.push_back(
507 std::make_pair("videoFormat", ConvertContainerFormat(video_format))); 442 std::make_pair("videoFormat", ConvertContainerFormat(video_format)));
508 query_params.push_back( 443 query_params.push_back(
509 std::make_pair("audioFormat", ConvertContainerFormat(audio_format))); 444 std::make_pair("audioFormat", ConvertContainerFormat(audio_format)));
510 RunEncryptedMediaTestPage("mse_different_containers.html", 445 RunEncryptedMediaTestPage("mse_different_containers.html",
511 CurrentKeySystem(), query_params, kEnded); 446 CurrentKeySystem(), query_params, kEnded);
512 } 447 }
513 448
514 protected: 449 protected:
515 void SetUpCommandLine(base::CommandLine* command_line) override { 450 void SetUpCommandLine(base::CommandLine* command_line) override {
516 EncryptedMediaTestBase::SetUpCommandLine(command_line); 451 EncryptedMediaTestBase::SetUpCommandLine(command_line);
517 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); 452 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line);
518 } 453 }
519 }; 454 };
520 455
521 using ::testing::Combine; 456 using ::testing::Combine;
522 using ::testing::Values; 457 using ::testing::Values;
523 458
524 #if !defined(OS_ANDROID) 459 #if !defined(OS_ANDROID)
525 INSTANTIATE_TEST_CASE_P(SRC_ClearKey_Prefixed,
526 EncryptedMediaTest,
527 Combine(Values(kPrefixedClearKeyKeySystem),
528 Values(SRC),
529 Values(PREFIXED)));
530
531 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, 460 INSTANTIATE_TEST_CASE_P(SRC_ClearKey,
532 EncryptedMediaTest, 461 EncryptedMediaTest,
533 Combine(Values(kClearKeyKeySystem), 462 Combine(Values(kClearKeyKeySystem), Values(SRC)));
534 Values(SRC),
535 Values(UNPREFIXED)));
536 #endif // !defined(OS_ANDROID) 463 #endif // !defined(OS_ANDROID)
537 464
538 INSTANTIATE_TEST_CASE_P(MSE_ClearKey_Prefixed,
539 EncryptedMediaTest,
540 Combine(Values(kPrefixedClearKeyKeySystem),
541 Values(MSE),
542 Values(PREFIXED)));
543 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, 465 INSTANTIATE_TEST_CASE_P(MSE_ClearKey,
544 EncryptedMediaTest, 466 EncryptedMediaTest,
545 Combine(Values(kClearKeyKeySystem), 467 Combine(Values(kClearKeyKeySystem), Values(MSE)));
546 Values(MSE),
547 Values(UNPREFIXED)));
548 468
549 // External Clear Key is currently only used on platforms that use Pepper CDMs. 469 // External Clear Key is currently only used on platforms that use Pepper CDMs.
550 #if defined(ENABLE_PEPPER_CDMS) 470 #if defined(ENABLE_PEPPER_CDMS)
551 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey_Prefixed,
552 EncryptedMediaTest,
553 Combine(Values(kExternalClearKeyKeySystem),
554 Values(SRC),
555 Values(PREFIXED)));
556 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, 471 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey,
557 EncryptedMediaTest, 472 EncryptedMediaTest,
558 Combine(Values(kExternalClearKeyKeySystem), 473 Combine(Values(kExternalClearKeyKeySystem),
559 Values(SRC), 474 Values(SRC)));
560 Values(UNPREFIXED)));
561 475
562 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey_Prefixed,
563 EncryptedMediaTest,
564 Combine(Values(kExternalClearKeyKeySystem),
565 Values(MSE),
566 Values(PREFIXED)));
567 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, 476 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey,
568 EncryptedMediaTest, 477 EncryptedMediaTest,
569 Combine(Values(kExternalClearKeyKeySystem), 478 Combine(Values(kExternalClearKeyKeySystem),
570 Values(MSE), 479 Values(MSE)));
571 Values(UNPREFIXED)));
572 480
573 const char kExternalClearKeyDecryptOnlyKeySystem[] = 481 const char kExternalClearKeyDecryptOnlyKeySystem[] =
574 "org.chromium.externalclearkey.decryptonly"; 482 "org.chromium.externalclearkey.decryptonly";
575 483
576 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. 484 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE.
577 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly_Prefixed,
578 EncryptedMediaTest,
579 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem),
580 Values(MSE),
581 Values(PREFIXED)));
582 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, 485 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly,
583 EncryptedMediaTest, 486 EncryptedMediaTest,
584 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), 487 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem),
585 Values(MSE), 488 Values(MSE)));
586 Values(UNPREFIXED)));
587 #endif // defined(ENABLE_PEPPER_CDMS) 489 #endif // defined(ENABLE_PEPPER_CDMS)
588 490
589 #if defined(WIDEVINE_CDM_AVAILABLE) 491 #if defined(WIDEVINE_CDM_AVAILABLE)
590
591 // Prefixed Widevine tests fail in Chrome OS official builds due to the request
592 // for permissions. Since prefixed EME is deprecated and will be removed soon,
593 // don't run these tests. http://crbug.com/430711
594 #if !(defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD))
595
596 // This test doesn't fully test playback with Widevine. So we only run Widevine
597 // test with MSE (no SRC) to reduce test time. Also, on Android EME only works
598 // with MSE and we cannot run this test with SRC.
599 INSTANTIATE_TEST_CASE_P(MSE_Widevine_Prefixed,
600 EncryptedMediaTest,
601 Combine(Values(kWidevineKeySystem),
602 Values(MSE),
603 Values(PREFIXED)));
604 #endif // !(defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD))
605
606 #if !defined(OS_CHROMEOS) 492 #if !defined(OS_CHROMEOS)
607 INSTANTIATE_TEST_CASE_P(MSE_Widevine, 493 INSTANTIATE_TEST_CASE_P(MSE_Widevine,
608 EncryptedMediaTest, 494 EncryptedMediaTest,
609 Combine(Values(kWidevineKeySystem), 495 Combine(Values(kWidevineKeySystem), Values(MSE)));
610 Values(MSE),
611 Values(UNPREFIXED)));
612 #endif // !defined(OS_CHROMEOS) 496 #endif // !defined(OS_CHROMEOS)
613 #endif // defined(WIDEVINE_CDM_AVAILABLE) 497 #endif // defined(WIDEVINE_CDM_AVAILABLE)
614 498
615 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { 499 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) {
616 TestSimplePlayback("bear-a_enc-a.webm", kWebMAudioOnly); 500 TestSimplePlayback("bear-a_enc-a.webm", kWebMAudioOnly);
617 } 501 }
618 502
619 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { 503 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) {
620 TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMAudioVideo); 504 TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMAudioVideo);
621 } 505 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); 588 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly);
705 } 589 }
706 590
707 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, 591 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
708 Playback_EncryptedVideo_MP4_ClearAudio_WEBM) { 592 Playback_EncryptedVideo_MP4_ClearAudio_WEBM) {
709 // MP4 without MSE is not support yet, http://crbug.com/170793. 593 // MP4 without MSE is not support yet, http://crbug.com/170793.
710 if (CurrentSourceType() != MSE) { 594 if (CurrentSourceType() != MSE) {
711 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 595 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
712 return; 596 return;
713 } 597 }
714 if (CurrentEmeVersion() != UNPREFIXED) {
715 DVLOG(0) << "Skipping test; Only supported by unprefixed EME";
716 return;
717 }
718 if (!IsPlayBackPossible(CurrentKeySystem())) { 598 if (!IsPlayBackPossible(CurrentKeySystem())) {
719 DVLOG(0) << "Skipping test - Test requires video playback."; 599 DVLOG(0) << "Skipping test - Test requires video playback.";
720 return; 600 return;
721 } 601 }
722 TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4, 602 TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4,
723 EncryptedContainer::CLEAR_WEBM); 603 EncryptedContainer::CLEAR_WEBM);
724 } 604 }
725 605
726 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, 606 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
727 Playback_ClearVideo_WEBM_EncryptedAudio_MP4) { 607 Playback_ClearVideo_WEBM_EncryptedAudio_MP4) {
728 // MP4 without MSE is not support yet, http://crbug.com/170793. 608 // MP4 without MSE is not support yet, http://crbug.com/170793.
729 if (CurrentSourceType() != MSE) { 609 if (CurrentSourceType() != MSE) {
730 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 610 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
731 return; 611 return;
732 } 612 }
733 if (CurrentEmeVersion() != UNPREFIXED) {
734 DVLOG(0) << "Skipping test; Only supported by unprefixed EME";
735 return;
736 }
737 if (!IsPlayBackPossible(CurrentKeySystem())) { 613 if (!IsPlayBackPossible(CurrentKeySystem())) {
738 DVLOG(0) << "Skipping test - Test requires video playback."; 614 DVLOG(0) << "Skipping test - Test requires video playback.";
739 return; 615 return;
740 } 616 }
741 TestDifferentContainers(EncryptedContainer::CLEAR_WEBM, 617 TestDifferentContainers(EncryptedContainer::CLEAR_WEBM,
742 EncryptedContainer::ENCRYPTED_MP4); 618 EncryptedContainer::ENCRYPTED_MP4);
743 } 619 }
744 620
745 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, 621 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
746 Playback_EncryptedVideo_WEBM_EncryptedAudio_MP4) { 622 Playback_EncryptedVideo_WEBM_EncryptedAudio_MP4) {
747 // MP4 without MSE is not support yet, http://crbug.com/170793. 623 // MP4 without MSE is not support yet, http://crbug.com/170793.
748 if (CurrentSourceType() != MSE) { 624 if (CurrentSourceType() != MSE) {
749 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 625 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
750 return; 626 return;
751 } 627 }
752 if (CurrentEmeVersion() != UNPREFIXED) {
753 DVLOG(0) << "Skipping test; Only supported by unprefixed EME";
754 return;
755 }
756 if (!IsPlayBackPossible(CurrentKeySystem())) { 628 if (!IsPlayBackPossible(CurrentKeySystem())) {
757 DVLOG(0) << "Skipping test - Test requires video playback."; 629 DVLOG(0) << "Skipping test - Test requires video playback.";
758 return; 630 return;
759 } 631 }
760 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, 632 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM,
761 EncryptedContainer::ENCRYPTED_MP4); 633 EncryptedContainer::ENCRYPTED_MP4);
762 } 634 }
763 #endif // defined(USE_PROPRIETARY_CODECS) 635 #endif // defined(USE_PROPRIETARY_CODECS)
764 636
765 #if defined(WIDEVINE_CDM_AVAILABLE) 637 #if defined(WIDEVINE_CDM_AVAILABLE)
766 // The parent key system cannot be used in generateKeyRequest.
767 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException_Prefixed) {
768 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly,
769 "com.widevine", MSE, PREFIXED, kNoSessionToLoad, false,
770 PlayTwice::NO, kEmeNotSupportedError);
771 }
772
773 // The parent key system cannot be used when creating MediaKeys. 638 // The parent key system cannot be used when creating MediaKeys.
774 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { 639 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) {
775 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly, 640 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly,
776 "com.widevine", MSE, UNPREFIXED, kNoSessionToLoad, 641 "com.widevine", MSE, kNoSessionToLoad, false,
777 false, PlayTwice::NO, kEmeNotSupportedError); 642 PlayTwice::NO, kEmeNotSupportedError);
778 } 643 }
779 #endif // defined(WIDEVINE_CDM_AVAILABLE) 644 #endif // defined(WIDEVINE_CDM_AVAILABLE)
780 645
781 #if defined(ENABLE_PEPPER_CDMS) 646 #if defined(ENABLE_PEPPER_CDMS)
782 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { 647 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) {
783 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, 648 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem,
784 kEmeNotSupportedError); 649 kEmeNotSupportedError);
785 } 650 }
786 651
787 // When CDM crashes, we should still get a decode error. |kError| is reported 652 // When CDM crashes, we should still get a decode error. |kError| is reported
(...skipping 18 matching lines...) Expand all
806 } 671 }
807 672
808 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { 673 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) {
809 TestPlaybackCase(kLoadableSession, kEnded); 674 TestPlaybackCase(kLoadableSession, kEnded);
810 } 675 }
811 676
812 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { 677 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) {
813 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); 678 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound);
814 } 679 }
815 680
816 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, InitializeCDMFail) {
817 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem,
818 kPrefixedEmeErrorEvent);
819 }
820
821 // When CDM crashes, we should still get a decode error.
822 // crbug.com/386657
823 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest,
824 DISABLED_CDMCrashDuringDecode) {
825 IgnorePluginCrash();
826 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError);
827 }
828
829 // Testing that the media browser test does fail on plugin crash.
830 // crbug.com/386657
831 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest,
832 DISABLED_CDMExpectedCrash) {
833 // Plugin crash is not ignored by default, the test is expected to fail.
834 EXPECT_NONFATAL_FAILURE(
835 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError),
836 "plugin crash");
837 }
838
839 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, FileIOTest) {
840 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem,
841 kFileIOTestSuccess);
842 }
843
844 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, LoadLoadableSession) {
845 TestPlaybackCase(kLoadableSession, kEnded);
846 }
847
848 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, LoadUnknownSession) {
849 TestPlaybackCase(kUnknownSession, kPrefixedEmeErrorEvent);
850 }
851 #endif // defined(ENABLE_PEPPER_CDMS) 681 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | content/child/runtime_features.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698