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 { | |
77 Prefixed, | |
78 Unprefixed | |
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 { |
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); | |
shadi1
2014/03/06 01:16:21
Is it safe to add this for both versions (prefixed
jrummell
2014/03/06 01:55:07
Should be fine. Events generated have different na
| |
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 when prefixed EME goes away. Disabled now | |
ddorwin
2014/03/05 23:57:48
...before shipping unprefixed EME.
jrummell
2014/03/06 01:55:07
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(SRC_ClearKey, | |
ddorwin
2014/03/05 23:57:48
use #if 0 rather than comments.
shadi1
2014/03/06 01:16:21
Another way is to name it DISABLED_SRC_Clearkey.
jrummell
2014/03/06 01:55:07
Done.
jrummell
2014/03/06 01:55:07
Done.
| |
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))); | |
shadi1
2014/03/06 01:16:21
For the other prefixed tests there is no _Prefixed
jrummell
2014/03/06 01:55:07
In the long run the prefixed ones will go away, so
| |
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, |
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 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, | |
461 EncryptedMediaTest, | |
462 Combine(Values(kExternalClearKeyKeySystem), | |
463 Values(MSE), | |
464 Values(Prefixed))); | |
403 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. | 465 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. |
404 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, EncryptedMediaTest, | 466 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, |
405 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), Values(MSE))); | 467 EncryptedMediaTest, |
468 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), | |
469 Values(MSE), | |
470 Values(Prefixed))); | |
406 #endif // defined(ENABLE_PEPPER_CDMS) | 471 #endif // defined(ENABLE_PEPPER_CDMS) |
407 | 472 |
408 #if defined(WIDEVINE_CDM_AVAILABLE) | 473 #if defined(WIDEVINE_CDM_AVAILABLE) |
409 // This test doesn't fully test playback with Widevine. So we only run Widevine | 474 // 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 | 475 // 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. | 476 // with MSE and we cannot run this test with SRC. |
412 INSTANTIATE_TEST_CASE_P(MSE_Widevine, EncryptedMediaTest, | 477 INSTANTIATE_TEST_CASE_P(MSE_Widevine, |
413 Combine(Values(kWidevineKeySystem), Values(MSE))); | 478 EncryptedMediaTest, |
479 Combine(Values(kWidevineKeySystem), | |
480 Values(MSE), | |
481 Values(Prefixed))); | |
shadi1
2014/03/06 01:16:21
I might be reading the parametrized tests wrong, d
jrummell
2014/03/06 01:55:07
Correct (for now, until unprefixed WV loads).
| |
414 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 482 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
415 | 483 |
416 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { | 484 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
485 #if defined(WIDEVINE_CDM_AVAILABLE) | |
486 if (IsWidevine(CurrentKeySystem())) { | |
487 VLOG(0) << "Test disabled on Widevine key system, crbug.com/349526."; | |
488 return; | |
489 } | |
490 #endif | |
417 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); | 491 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); |
418 } | 492 } |
419 | 493 |
420 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { | 494 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { |
495 #if defined(WIDEVINE_CDM_AVAILABLE) | |
496 if (IsWidevine(CurrentKeySystem())) { | |
497 VLOG(0) << "Test disabled on Widevine key system, crbug.com/349526."; | |
498 return; | |
499 } | |
500 #endif | |
421 TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo); | 501 TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo); |
422 } | 502 } |
423 | 503 |
424 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoAudio_WebM) { | 504 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoAudio_WebM) { |
425 TestSimplePlayback("bear-320x240-av-enc_av.webm", kWebMAudioVideo); | 505 TestSimplePlayback("bear-320x240-av-enc_av.webm", kWebMAudioVideo); |
426 } | 506 } |
427 | 507 |
428 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_WebM) { | 508 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_WebM) { |
429 TestSimplePlayback("bear-320x240-v-enc_v.webm", kWebMVideoOnly); | 509 TestSimplePlayback("bear-320x240-v-enc_v.webm", kWebMVideoOnly); |
430 } | 510 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 if (CurrentSourceType() != MSE) { | 557 if (CurrentSourceType() != MSE) { |
478 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 558 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
479 return; | 559 return; |
480 } | 560 } |
481 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); | 561 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); |
482 } | 562 } |
483 #endif // defined(USE_PROPRIETARY_CODECS) | 563 #endif // defined(USE_PROPRIETARY_CODECS) |
484 | 564 |
485 #if defined(WIDEVINE_CDM_AVAILABLE) | 565 #if defined(WIDEVINE_CDM_AVAILABLE) |
486 // The parent key system cannot be used in generateKeyRequest. | 566 // The parent key system cannot be used in generateKeyRequest. |
487 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { | 567 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException_Prefixed) { |
488 RunEncryptedMediaTest("encrypted_media_player.html", | 568 RunEncryptedMediaTest("encrypted_media_player.html", |
489 "bear-a-enc_a.webm", | 569 "bear-a-enc_a.webm", |
490 kWebMAudioOnly, | 570 kWebMAudioOnly, |
491 "com.widevine", | 571 "com.widevine", |
492 MSE, | 572 MSE, |
573 Prefixed, | |
493 kNoSessionToLoad, | 574 kNoSessionToLoad, |
494 false, | 575 false, |
495 kEmeNotSupportedError); | 576 kEmeNotSupportedError); |
577 } | |
578 | |
579 // FIXME(jrummell): http://crbug.com/349181 | |
580 // The parent key system cannot be used when creating MediaKeys. | |
581 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, DISABLED_ParentThrowsException) { | |
582 RunEncryptedMediaTest("encrypted_media_player.html", | |
583 "bear-a-enc_a.webm", | |
584 kWebMAudioOnly, | |
585 "com.widevine", | |
586 MSE, | |
587 Unprefixed, | |
588 kNoSessionToLoad, | |
589 false, | |
590 kEmeNotSupportedError); | |
496 } | 591 } |
497 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 592 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
498 | 593 |
499 #if defined(ENABLE_PEPPER_CDMS) | 594 #if defined(ENABLE_PEPPER_CDMS) |
500 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { | 595 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { |
501 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, kEmeKeyError); | 596 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, kEmeKeyError); |
502 } | 597 } |
503 | 598 |
504 // When CDM crashes, we should still get a decode error. | 599 // When CDM crashes, we should still get a decode error. |
505 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { | 600 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { |
506 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); | 601 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); |
507 } | 602 } |
508 | 603 |
509 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { | 604 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { |
510 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, | 605 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, |
511 kFileIOTestSuccess); | 606 kFileIOTestSuccess); |
512 } | 607 } |
513 | 608 |
514 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 609 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
515 RunEncryptedMediaTest("encrypted_media_player.html", | 610 RunEncryptedMediaTest("encrypted_media_player.html", |
516 "bear-320x240-v-enc_v.webm", | 611 "bear-320x240-v-enc_v.webm", |
517 kWebMVideoOnly, | 612 kWebMVideoOnly, |
518 kExternalClearKeyKeySystem, | 613 kExternalClearKeyKeySystem, |
519 SRC, | 614 SRC, |
615 Prefixed, | |
520 kLoadableSession, | 616 kLoadableSession, |
521 false, | 617 false, |
522 kEnded); | 618 kEnded); |
523 } | 619 } |
524 | 620 |
525 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 621 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
526 // TODO(xhwang): Add a specific error for this failure, e.g. kSessionNotFound. | 622 // TODO(xhwang): Add a specific error for this failure, e.g. kSessionNotFound. |
527 RunEncryptedMediaTest("encrypted_media_player.html", | 623 RunEncryptedMediaTest("encrypted_media_player.html", |
528 "bear-320x240-v-enc_v.webm", | 624 "bear-320x240-v-enc_v.webm", |
529 kWebMVideoOnly, | 625 kWebMVideoOnly, |
530 kExternalClearKeyKeySystem, | 626 kExternalClearKeyKeySystem, |
531 SRC, | 627 SRC, |
628 Prefixed, | |
532 kUnknownSession, | 629 kUnknownSession, |
533 false, | 630 false, |
534 kEmeKeyError); | 631 kEmeKeyError); |
535 } | 632 } |
536 #endif // defined(ENABLE_PEPPER_CDMS) | 633 #endif // defined(ENABLE_PEPPER_CDMS) |
OLD | NEW |