| 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 <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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 static bool IsMSESupported() { | 98 static bool IsMSESupported() { |
| 99 #if defined(OS_ANDROID) | 99 #if defined(OS_ANDROID) |
| 100 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { | 100 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { |
| 101 DVLOG(0) << "MSE is only supported in Android 4.1 and later."; | 101 DVLOG(0) << "MSE is only supported in Android 4.1 and later."; |
| 102 return false; | 102 return false; |
| 103 } | 103 } |
| 104 #endif // defined(OS_ANDROID) | 104 #endif // defined(OS_ANDROID) |
| 105 return true; | 105 return true; |
| 106 } | 106 } |
| 107 | 107 |
| 108 static bool IsParentKeySystemOf(const std::string& parent_key_system, | |
| 109 const std::string& key_system) { | |
| 110 std::string prefix = parent_key_system + '.'; | |
| 111 return key_system.substr(0, prefix.size()) == prefix; | |
| 112 } | |
| 113 | |
| 114 // Base class for encrypted media tests. | 108 // Base class for encrypted media tests. |
| 115 class EncryptedMediaTestBase : public MediaBrowserTest { | 109 class EncryptedMediaTestBase : public MediaBrowserTest { |
| 116 public: | 110 public: |
| 117 EncryptedMediaTestBase() : is_pepper_cdm_registered_(false) {} | 111 EncryptedMediaTestBase() : is_pepper_cdm_registered_(false) {} |
| 118 | 112 |
| 119 bool IsExternalClearKey(const std::string& key_system) { | 113 bool IsExternalClearKey(const std::string& key_system) { |
| 120 return key_system == kExternalClearKeyKeySystem || | 114 if (key_system == kExternalClearKeyKeySystem) |
| 121 IsParentKeySystemOf(kExternalClearKeyKeySystem, key_system); | 115 return true; |
| 116 std::string prefix = std::string(kExternalClearKeyKeySystem) + '.'; |
| 117 return key_system.substr(0, prefix.size()) == prefix; |
| 122 } | 118 } |
| 123 | 119 |
| 124 #if defined(WIDEVINE_CDM_AVAILABLE) | 120 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 125 bool IsWidevine(const std::string& key_system) { | 121 bool IsWidevine(const std::string& key_system) { |
| 126 return key_system == kWidevineKeySystem; | 122 return key_system == kWidevineKeySystem; |
| 127 } | 123 } |
| 128 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 124 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 129 | 125 |
| 130 void RunEncryptedMediaTestPage( | 126 void RunEncryptedMediaTestPage( |
| 131 const std::string& html_page, | 127 const std::string& html_page, |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 668 |
| 673 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 669 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
| 674 TestPlaybackCase(kLoadableSession, kEnded); | 670 TestPlaybackCase(kLoadableSession, kEnded); |
| 675 } | 671 } |
| 676 | 672 |
| 677 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 673 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
| 678 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); | 674 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); |
| 679 } | 675 } |
| 680 | 676 |
| 681 #endif // defined(ENABLE_PEPPER_CDMS) | 677 #endif // defined(ENABLE_PEPPER_CDMS) |
| OLD | NEW |