OLD | NEW |
---|---|
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "chrome/browser/media/media_browsertest.h" | 10 #include "chrome/browser/media/media_browsertest.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #elif defined(OS_WIN) | 28 #elif defined(OS_WIN) |
29 "clearkeycdmadapter.dll"; | 29 "clearkeycdmadapter.dll"; |
30 #elif defined(OS_POSIX) | 30 #elif defined(OS_POSIX) |
31 "libclearkeycdmadapter.so"; | 31 "libclearkeycdmadapter.so"; |
32 #endif | 32 #endif |
33 | 33 |
34 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm"; | 34 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm"; |
35 #endif // defined(ENABLE_PEPPER_CDMS) | 35 #endif // defined(ENABLE_PEPPER_CDMS) |
36 | 36 |
37 // Available key systems. | 37 // Available key systems. |
38 const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | 38 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
39 const char kPrefixedClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | |
39 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; | 40 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; |
40 const char kExternalClearKeyDecryptOnlyKeySystem[] = | 41 const char kExternalClearKeyDecryptOnlyKeySystem[] = |
41 "org.chromium.externalclearkey.decryptonly"; | 42 "org.chromium.externalclearkey.decryptonly"; |
42 const char kExternalClearKeyFileIOTestKeySystem[] = | 43 const char kExternalClearKeyFileIOTestKeySystem[] = |
43 "org.chromium.externalclearkey.fileiotest"; | 44 "org.chromium.externalclearkey.fileiotest"; |
44 const char kExternalClearKeyInitializeFailKeySystem[] = | 45 const char kExternalClearKeyInitializeFailKeySystem[] = |
45 "org.chromium.externalclearkey.initializefail"; | 46 "org.chromium.externalclearkey.initializefail"; |
46 const char kExternalClearKeyCrashKeySystem[] = | 47 const char kExternalClearKeyCrashKeySystem[] = |
47 "org.chromium.externalclearkey.crash"; | 48 "org.chromium.externalclearkey.crash"; |
48 | 49 |
(...skipping 15 matching lines...) Expand all Loading... | |
64 const char kEmeKeyError[] = "KEYERROR"; | 65 const char kEmeKeyError[] = "KEYERROR"; |
65 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 66 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
66 const char kFileIOTestSuccess[] = "FILEIOTESTSUCCESS"; | 67 const char kFileIOTestSuccess[] = "FILEIOTESTSUCCESS"; |
67 | 68 |
68 // The type of video src used to load media. | 69 // The type of video src used to load media. |
69 enum SrcType { | 70 enum SrcType { |
70 SRC, | 71 SRC, |
71 MSE | 72 MSE |
72 }; | 73 }; |
73 | 74 |
75 // Whether to use prefixed or unprefixed EME. | |
76 enum EMEVersion { | |
xhwang
2014/03/06 16:36:53
ddorwin@: What did we decide on EME or Eme?
ddorwin
2014/03/06 18:11:10
Eme (where we are addding new values). See line 65
jrummell
2014/03/06 18:26:03
Done.
| |
77 Prefixed, | |
78 Unprefixed | |
xhwang
2014/03/06 16:36:53
nit: We use UPPER_CASE for enums.
jrummell
2014/03/06 18:26:03
Done.
| |
79 }; | |
80 | |
74 // MSE is available on all desktop platforms and on Android 4.1 and later. | 81 // MSE is available on all desktop platforms and on Android 4.1 and later. |
75 static bool IsMSESupported() { | 82 static bool IsMSESupported() { |
76 #if defined(OS_ANDROID) | 83 #if defined(OS_ANDROID) |
77 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { | 84 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { |
78 VLOG(0) << "MSE is only supported in Android 4.1 and later."; | 85 VLOG(0) << "MSE is only supported in Android 4.1 and later."; |
79 return false; | 86 return false; |
80 } | 87 } |
81 #endif // defined(OS_ANDROID) | 88 #endif // defined(OS_ANDROID) |
82 return true; | 89 return true; |
83 } | 90 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 // and trying to update it with licenses. | 125 // and trying to update it with licenses. |
119 // When |force_invalid_response| is true, the test will provide invalid | 126 // When |force_invalid_response| is true, the test will provide invalid |
120 // responses, which should trigger errors. | 127 // responses, which should trigger errors. |
121 // TODO(xhwang): Find an easier way to pass multiple configuration test | 128 // TODO(xhwang): Find an easier way to pass multiple configuration test |
122 // options. | 129 // options. |
123 void RunEncryptedMediaTest(const std::string& html_page, | 130 void RunEncryptedMediaTest(const std::string& html_page, |
124 const std::string& media_file, | 131 const std::string& media_file, |
125 const std::string& media_type, | 132 const std::string& media_type, |
126 const std::string& key_system, | 133 const std::string& key_system, |
127 SrcType src_type, | 134 SrcType src_type, |
135 EMEVersion eme_version, | |
128 const std::string& session_to_load, | 136 const std::string& session_to_load, |
129 bool force_invalid_response, | 137 bool force_invalid_response, |
130 const std::string& expected_title) { | 138 const std::string& expected_title) { |
131 if (src_type == MSE && !IsMSESupported()) { | 139 if (src_type == MSE && !IsMSESupported()) { |
132 VLOG(0) << "Skipping test - MSE not supported."; | 140 VLOG(0) << "Skipping test - MSE not supported."; |
133 return; | 141 return; |
134 } | 142 } |
135 std::vector<StringPair> query_params; | 143 std::vector<StringPair> query_params; |
136 query_params.push_back(std::make_pair("mediaFile", media_file)); | 144 query_params.push_back(std::make_pair("mediaFile", media_file)); |
137 query_params.push_back(std::make_pair("mediaType", media_type)); | 145 query_params.push_back(std::make_pair("mediaType", media_type)); |
138 query_params.push_back(std::make_pair("keySystem", key_system)); | 146 query_params.push_back(std::make_pair("keySystem", key_system)); |
139 if (src_type == MSE) | 147 if (src_type == MSE) |
140 query_params.push_back(std::make_pair("useMSE", "1")); | 148 query_params.push_back(std::make_pair("useMSE", "1")); |
149 if (eme_version == Prefixed) | |
150 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | |
141 if (force_invalid_response) | 151 if (force_invalid_response) |
142 query_params.push_back(std::make_pair("forceInvalidResponse", "1")); | 152 query_params.push_back(std::make_pair("forceInvalidResponse", "1")); |
143 if (!session_to_load.empty()) | 153 if (!session_to_load.empty()) |
144 query_params.push_back(std::make_pair("sessionToLoad", session_to_load)); | 154 query_params.push_back(std::make_pair("sessionToLoad", session_to_load)); |
145 RunEncryptedMediaTestPage(html_page, key_system, &query_params, | 155 RunEncryptedMediaTestPage(html_page, key_system, &query_params, |
146 expected_title); | 156 expected_title); |
147 } | 157 } |
148 | 158 |
149 void RunSimpleEncryptedMediaTest(const std::string& media_file, | 159 void RunSimpleEncryptedMediaTest(const std::string& media_file, |
150 const std::string& media_type, | 160 const std::string& media_type, |
151 const std::string& key_system, | 161 const std::string& key_system, |
152 SrcType src_type) { | 162 SrcType src_type, |
163 EMEVersion eme_version) { | |
153 std::string expected_title = kEnded; | 164 std::string expected_title = kEnded; |
154 if (!IsPlayBackPossible(key_system)) | 165 if (!IsPlayBackPossible(key_system)) |
155 expected_title = kEmeKeyError; | 166 expected_title = kEmeKeyError; |
156 | 167 |
157 RunEncryptedMediaTest("encrypted_media_player.html", media_file, media_type, | 168 RunEncryptedMediaTest("encrypted_media_player.html", |
158 key_system, src_type, kNoSessionToLoad, false, | 169 media_file, |
170 media_type, | |
171 key_system, | |
172 src_type, | |
173 eme_version, | |
174 kNoSessionToLoad, | |
175 false, | |
159 expected_title); | 176 expected_title); |
160 // Check KeyMessage received for all key systems. | 177 // Check KeyMessage received for all key systems. |
161 bool receivedKeyMessage = false; | 178 bool receivedKeyMessage = false; |
162 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 179 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
163 browser()->tab_strip_model()->GetActiveWebContents(), | 180 browser()->tab_strip_model()->GetActiveWebContents(), |
164 "window.domAutomationController.send(video.receivedKeyMessage);", | 181 "window.domAutomationController.send(video.receivedKeyMessage);", |
165 &receivedKeyMessage)); | 182 &receivedKeyMessage)); |
166 EXPECT_TRUE(receivedKeyMessage); | 183 EXPECT_TRUE(receivedKeyMessage); |
167 } | 184 } |
168 | 185 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. | 304 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. |
288 void TestNonPlaybackCases(const std::string& key_system, | 305 void TestNonPlaybackCases(const std::string& key_system, |
289 const std::string& expected_title) { | 306 const std::string& expected_title) { |
290 // Since we do not test playback, arbitrarily choose a test file and source | 307 // Since we do not test playback, arbitrarily choose a test file and source |
291 // type. | 308 // type. |
292 RunEncryptedMediaTest("encrypted_media_player.html", | 309 RunEncryptedMediaTest("encrypted_media_player.html", |
293 "bear-a-enc_a.webm", | 310 "bear-a-enc_a.webm", |
294 kWebMAudioOnly, | 311 kWebMAudioOnly, |
295 key_system, | 312 key_system, |
296 SRC, | 313 SRC, |
314 Prefixed, | |
297 kNoSessionToLoad, | 315 kNoSessionToLoad, |
298 false, | 316 false, |
299 expected_title); | 317 expected_title); |
300 } | 318 } |
301 | 319 |
302 protected: | 320 protected: |
303 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 321 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
304 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 322 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
305 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); | 323 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); |
306 } | 324 } |
307 }; | 325 }; |
308 | 326 |
309 #if defined(WIDEVINE_CDM_AVAILABLE) | 327 #if defined(WIDEVINE_CDM_AVAILABLE) |
310 // Tests encrypted media playback using Widevine key system. | 328 // Tests encrypted media playback using Widevine key system. |
311 class WVEncryptedMediaTest : public EncryptedMediaTestBase { | 329 class WVEncryptedMediaTest : public EncryptedMediaTestBase { |
xhwang
2014/03/06 16:36:53
Suggestion for a follow up cleanup CL.
Now this i
ddorwin
2014/03/06 18:11:10
If Widevine is not registered (by line 334), this
xhwang
2014/03/06 18:20:57
I see. Thanks!
| |
312 protected: | 330 protected: |
313 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 331 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
314 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 332 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
333 command_line->AppendSwitch(switches::kEnableEncryptedMedia); | |
315 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); | 334 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); |
316 } | 335 } |
317 }; | 336 }; |
318 | 337 |
319 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 338 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
320 #endif // defined(ENABLE_PEPPER_CDMS) | 339 #endif // defined(ENABLE_PEPPER_CDMS) |
321 | 340 |
322 // Tests encrypted media playback with a combination of parameters: | 341 // Tests encrypted media playback with a combination of parameters: |
323 // - char*: Key system name. | 342 // - char*: Key system name. |
324 // - bool: True to load media using MSE, otherwise use src. | 343 // - bool: True to load media using MSE, otherwise use src. |
344 // - bool: True to use unprefixed EME, otherwise use prefixed EME. | |
325 // | 345 // |
326 // Note: Only parameterized (*_P) tests can be used. Non-parameterized (*_F) | 346 // Note: Only parameterized (*_P) tests can be used. Non-parameterized (*_F) |
327 // tests will crash at GetParam(). To add non-parameterized tests, use | 347 // tests will crash at GetParam(). To add non-parameterized tests, use |
328 // EncryptedMediaTestBase or one of its subclasses (e.g. WVEncryptedMediaTest). | 348 // EncryptedMediaTestBase or one of its subclasses (e.g. WVEncryptedMediaTest). |
329 class EncryptedMediaTest : public EncryptedMediaTestBase, | 349 class EncryptedMediaTest |
330 public testing::WithParamInterface<std::tr1::tuple<const char*, SrcType> > { | 350 : public EncryptedMediaTestBase, |
351 public testing::WithParamInterface< | |
352 std::tr1::tuple<const char*, SrcType, EMEVersion> > { | |
331 public: | 353 public: |
332 std::string CurrentKeySystem() { | 354 std::string CurrentKeySystem() { |
333 return std::tr1::get<0>(GetParam()); | 355 return std::tr1::get<0>(GetParam()); |
334 } | 356 } |
335 | 357 |
336 SrcType CurrentSourceType() { | 358 SrcType CurrentSourceType() { |
337 return std::tr1::get<1>(GetParam()); | 359 return std::tr1::get<1>(GetParam()); |
338 } | 360 } |
339 | 361 |
362 EMEVersion CurrentEMEVersion() { | |
363 return std::tr1::get<2>(GetParam()); | |
364 } | |
365 | |
340 void TestSimplePlayback(const std::string& encrypted_media, | 366 void TestSimplePlayback(const std::string& encrypted_media, |
341 const std::string& media_type) { | 367 const std::string& media_type) { |
342 RunSimpleEncryptedMediaTest( | 368 RunSimpleEncryptedMediaTest(encrypted_media, |
343 encrypted_media, media_type, CurrentKeySystem(), CurrentSourceType()); | 369 media_type, |
370 CurrentKeySystem(), | |
371 CurrentSourceType(), | |
372 CurrentEMEVersion()); | |
344 } | 373 } |
345 | 374 |
346 void RunInvalidResponseTest() { | 375 void RunInvalidResponseTest() { |
347 RunEncryptedMediaTest("encrypted_media_player.html", | 376 RunEncryptedMediaTest("encrypted_media_player.html", |
348 "bear-320x240-av-enc_av.webm", | 377 "bear-320x240-av-enc_av.webm", |
349 kWebMAudioVideo, | 378 kWebMAudioVideo, |
350 CurrentKeySystem(), | 379 CurrentKeySystem(), |
351 CurrentSourceType(), | 380 CurrentSourceType(), |
381 CurrentEMEVersion(), | |
352 kNoSessionToLoad, | 382 kNoSessionToLoad, |
353 true, | 383 true, |
354 kEmeKeyError); | 384 kEmeKeyError); |
355 } | 385 } |
356 | 386 |
357 void TestFrameSizeChange() { | 387 void TestFrameSizeChange() { |
358 RunEncryptedMediaTest("encrypted_frame_size_change.html", | 388 RunEncryptedMediaTest("encrypted_frame_size_change.html", |
359 "frame_size_change-av-enc-v.webm", | 389 "frame_size_change-av-enc-v.webm", |
360 kWebMAudioVideo, | 390 kWebMAudioVideo, |
361 CurrentKeySystem(), | 391 CurrentKeySystem(), |
362 CurrentSourceType(), | 392 CurrentSourceType(), |
393 CurrentEMEVersion(), | |
363 kNoSessionToLoad, | 394 kNoSessionToLoad, |
364 false, | 395 false, |
365 kEnded); | 396 kEnded); |
366 } | 397 } |
367 | 398 |
368 void TestConfigChange() { | 399 void TestConfigChange() { |
369 DCHECK(IsMSESupported()); | 400 DCHECK(IsMSESupported()); |
370 std::vector<StringPair> query_params; | 401 std::vector<StringPair> query_params; |
371 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); | 402 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); |
372 query_params.push_back(std::make_pair("runEncrypted", "1")); | 403 query_params.push_back(std::make_pair("runEncrypted", "1")); |
404 if (CurrentEMEVersion() == Prefixed) | |
405 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | |
373 RunEncryptedMediaTestPage("mse_config_change.html", | 406 RunEncryptedMediaTestPage("mse_config_change.html", |
374 CurrentKeySystem(), | 407 CurrentKeySystem(), |
375 &query_params, | 408 &query_params, |
376 kEnded); | 409 kEnded); |
377 } | 410 } |
378 | 411 |
379 protected: | 412 protected: |
380 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 413 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
381 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 414 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
382 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); | 415 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); |
416 | |
417 if (CurrentEMEVersion() == Unprefixed) | |
418 command_line->AppendSwitch(switches::kEnableEncryptedMedia); | |
383 } | 419 } |
384 }; | 420 }; |
385 | 421 |
386 using ::testing::Combine; | 422 using ::testing::Combine; |
387 using ::testing::Values; | 423 using ::testing::Values; |
388 | 424 |
389 #if !defined(OS_ANDROID) | 425 #if !defined(OS_ANDROID) |
390 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, | 426 INSTANTIATE_TEST_CASE_P(SRC_ClearKey_Prefixed, |
391 Combine(Values(kClearKeyKeySystem), Values(SRC))); | 427 EncryptedMediaTest, |
428 Combine(Values(kPrefixedClearKeyKeySystem), | |
429 Values(SRC), | |
430 Values(Prefixed))); | |
431 | |
432 // TODO: Enable unprefixed tests before shipping unprefixed EME. Disabled now | |
xhwang
2014/03/06 16:36:53
Here and below, TODO(jrummell)
jrummell
2014/03/06 18:26:03
Done.
| |
433 // as they don't provide much additional coverage, but do take a bit of time | |
434 // to execute. | |
435 INSTANTIATE_TEST_CASE_P(DISABLED_SRC_ClearKey, | |
436 EncryptedMediaTest, | |
437 Combine(Values(kClearKeyKeySystem), | |
438 Values(SRC), | |
439 Values(Unprefixed))); | |
392 #endif // !defined(OS_ANDROID) | 440 #endif // !defined(OS_ANDROID) |
393 | 441 |
394 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, | 442 INSTANTIATE_TEST_CASE_P(MSE_ClearKey_Prefixed, |
395 Combine(Values(kClearKeyKeySystem), Values(MSE))); | 443 EncryptedMediaTest, |
444 Combine(Values(kPrefixedClearKeyKeySystem), | |
445 Values(MSE), | |
446 Values(Prefixed))); | |
447 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, | |
448 EncryptedMediaTest, | |
449 Combine(Values(kClearKeyKeySystem), | |
450 Values(MSE), | |
451 Values(Unprefixed))); | |
396 | 452 |
397 // External Clear Key is currently only used on platforms that use Pepper CDMs. | 453 // External Clear Key is currently only used on platforms that use Pepper CDMs. |
398 #if defined(ENABLE_PEPPER_CDMS) | 454 #if defined(ENABLE_PEPPER_CDMS) |
399 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, EncryptedMediaTest, | 455 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey_Prefixed, |
400 Combine(Values(kExternalClearKeyKeySystem), Values(SRC))); | 456 EncryptedMediaTest, |
401 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, EncryptedMediaTest, | 457 Combine(Values(kExternalClearKeyKeySystem), |
402 Combine(Values(kExternalClearKeyKeySystem), Values(MSE))); | 458 Values(SRC), |
459 Values(Prefixed))); | |
460 // TODO: Enable unprefixed tests once the CDM can be loaded using MediaKeys. | |
461 INSTANTIATE_TEST_CASE_P(DISABLED_SRC_ExternalClearKey, | |
462 EncryptedMediaTest, | |
463 Combine(Values(kExternalClearKeyKeySystem), | |
464 Values(SRC), | |
465 Values(Unprefixed))); | |
466 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey_Prefixed, | |
467 EncryptedMediaTest, | |
468 Combine(Values(kExternalClearKeyKeySystem), | |
469 Values(MSE), | |
470 Values(Prefixed))); | |
471 // TODO: Enable unprefixed tests once the CDM can be loaded using MediaKeys. | |
472 INSTANTIATE_TEST_CASE_P(DISABLED_MSE_ExternalClearKey, | |
473 EncryptedMediaTest, | |
474 Combine(Values(kExternalClearKeyKeySystem), | |
475 Values(MSE), | |
476 Values(Unprefixed))); | |
403 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. | 477 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. |
404 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, EncryptedMediaTest, | 478 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly_Prefixed, |
405 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), Values(MSE))); | 479 EncryptedMediaTest, |
480 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), | |
481 Values(MSE), | |
482 Values(Prefixed))); | |
483 // TODO: Enable unprefixed tests once the CDM can be loaded using MediaKeys. | |
484 INSTANTIATE_TEST_CASE_P(DISABLED_MSE_ExternalClearKeyDecryptOnly, | |
485 EncryptedMediaTest, | |
486 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), | |
487 Values(MSE), | |
488 Values(Unprefixed))); | |
406 #endif // defined(ENABLE_PEPPER_CDMS) | 489 #endif // defined(ENABLE_PEPPER_CDMS) |
407 | 490 |
408 #if defined(WIDEVINE_CDM_AVAILABLE) | 491 #if defined(WIDEVINE_CDM_AVAILABLE) |
409 // This test doesn't fully test playback with Widevine. So we only run Widevine | 492 // This test doesn't fully test playback with Widevine. So we only run Widevine |
410 // test with MSE (no SRC) to reduce test time. Also, on Android EME only works | 493 // test with MSE (no SRC) to reduce test time. Also, on Android EME only works |
411 // with MSE and we cannot run this test with SRC. | 494 // with MSE and we cannot run this test with SRC. |
412 INSTANTIATE_TEST_CASE_P(MSE_Widevine, EncryptedMediaTest, | 495 INSTANTIATE_TEST_CASE_P(MSE_Widevine_Prefixed, |
413 Combine(Values(kWidevineKeySystem), Values(MSE))); | 496 EncryptedMediaTest, |
497 Combine(Values(kWidevineKeySystem), | |
498 Values(MSE), | |
499 Values(Prefixed))); | |
500 // TODO: Enable unprefixed tests once the CDM can be loaded using MediaKeys. | |
501 INSTANTIATE_TEST_CASE_P(DISABLED_MSE_Widevine, | |
502 EncryptedMediaTest, | |
503 Combine(Values(kWidevineKeySystem), | |
504 Values(MSE), | |
505 Values(Unprefixed))); | |
414 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 506 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
415 | 507 |
416 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { | 508 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
417 #if defined(WIDEVINE_CDM_AVAILABLE) | 509 #if defined(WIDEVINE_CDM_AVAILABLE) |
418 if (IsWidevine(CurrentKeySystem())) { | 510 if (IsWidevine(CurrentKeySystem())) { |
419 VLOG(0) << "Test disabled on Widevine key system, crbug.com/349526."; | 511 VLOG(0) << "Test disabled on Widevine key system, crbug.com/349526."; |
420 return; | 512 return; |
421 } | 513 } |
422 #endif | 514 #endif |
423 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); | 515 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 if (CurrentSourceType() != MSE) { | 581 if (CurrentSourceType() != MSE) { |
490 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 582 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
491 return; | 583 return; |
492 } | 584 } |
493 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); | 585 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); |
494 } | 586 } |
495 #endif // defined(USE_PROPRIETARY_CODECS) | 587 #endif // defined(USE_PROPRIETARY_CODECS) |
496 | 588 |
497 #if defined(WIDEVINE_CDM_AVAILABLE) | 589 #if defined(WIDEVINE_CDM_AVAILABLE) |
498 // The parent key system cannot be used in generateKeyRequest. | 590 // The parent key system cannot be used in generateKeyRequest. |
499 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { | 591 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException_Prefixed) { |
500 RunEncryptedMediaTest("encrypted_media_player.html", | 592 RunEncryptedMediaTest("encrypted_media_player.html", |
501 "bear-a-enc_a.webm", | 593 "bear-a-enc_a.webm", |
502 kWebMAudioOnly, | 594 kWebMAudioOnly, |
503 "com.widevine", | 595 "com.widevine", |
504 MSE, | 596 MSE, |
597 Prefixed, | |
505 kNoSessionToLoad, | 598 kNoSessionToLoad, |
506 false, | 599 false, |
507 kEmeNotSupportedError); | 600 kEmeNotSupportedError); |
601 } | |
602 | |
603 // FIXME(jrummell): http://crbug.com/349181 | |
xhwang
2014/03/06 16:36:53
s/FIXME/TODO
jrummell
2014/03/06 18:26:03
Done.
| |
604 // The parent key system cannot be used when creating MediaKeys. | |
605 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, DISABLED_ParentThrowsException) { | |
606 RunEncryptedMediaTest("encrypted_media_player.html", | |
607 "bear-a-enc_a.webm", | |
608 kWebMAudioOnly, | |
609 "com.widevine", | |
610 MSE, | |
611 Unprefixed, | |
612 kNoSessionToLoad, | |
613 false, | |
614 kEmeNotSupportedError); | |
508 } | 615 } |
509 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 616 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
510 | 617 |
511 #if defined(ENABLE_PEPPER_CDMS) | 618 #if defined(ENABLE_PEPPER_CDMS) |
512 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { | 619 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { |
513 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, kEmeKeyError); | 620 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, kEmeKeyError); |
514 } | 621 } |
515 | 622 |
516 // When CDM crashes, we should still get a decode error. | 623 // When CDM crashes, we should still get a decode error. |
517 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { | 624 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { |
518 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); | 625 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); |
519 } | 626 } |
520 | 627 |
521 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { | 628 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { |
522 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, | 629 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, |
523 kFileIOTestSuccess); | 630 kFileIOTestSuccess); |
524 } | 631 } |
525 | 632 |
526 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 633 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
527 RunEncryptedMediaTest("encrypted_media_player.html", | 634 RunEncryptedMediaTest("encrypted_media_player.html", |
528 "bear-320x240-v-enc_v.webm", | 635 "bear-320x240-v-enc_v.webm", |
529 kWebMVideoOnly, | 636 kWebMVideoOnly, |
530 kExternalClearKeyKeySystem, | 637 kExternalClearKeyKeySystem, |
531 SRC, | 638 SRC, |
639 Prefixed, | |
532 kLoadableSession, | 640 kLoadableSession, |
533 false, | 641 false, |
534 kEnded); | 642 kEnded); |
535 } | 643 } |
536 | 644 |
537 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 645 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
538 // TODO(xhwang): Add a specific error for this failure, e.g. kSessionNotFound. | 646 // TODO(xhwang): Add a specific error for this failure, e.g. kSessionNotFound. |
539 RunEncryptedMediaTest("encrypted_media_player.html", | 647 RunEncryptedMediaTest("encrypted_media_player.html", |
540 "bear-320x240-v-enc_v.webm", | 648 "bear-320x240-v-enc_v.webm", |
541 kWebMVideoOnly, | 649 kWebMVideoOnly, |
542 kExternalClearKeyKeySystem, | 650 kExternalClearKeyKeySystem, |
543 SRC, | 651 SRC, |
652 Prefixed, | |
544 kUnknownSession, | 653 kUnknownSession, |
545 false, | 654 false, |
546 kEmeKeyError); | 655 kEmeKeyError); |
547 } | 656 } |
548 #endif // defined(ENABLE_PEPPER_CDMS) | 657 #endif // defined(ENABLE_PEPPER_CDMS) |
OLD | NEW |