| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "base/win/windows_version.h" | 7 #include "base/win/windows_version.h" |
| 8 #include "content/browser/media/media_browsertest.h" | 8 #include "content/browser/media/media_browsertest.h" |
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
| 11 #include "content/shell/browser/shell.h" | 11 #include "content/shell/browser/shell.h" |
| 12 #if defined(OS_ANDROID) | 12 #if defined(OS_ANDROID) |
| 13 #include "base/android/build_info.h" | 13 #include "base/android/build_info.h" |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 // Available key systems. | 16 // Available key systems. |
| 17 const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | 17 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
| 18 | 18 |
| 19 // Supported media types. | 19 // Supported media types. |
| 20 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 20 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
| 21 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; | 21 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; |
| 22 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; | 22 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; |
| 23 | 23 |
| 24 // EME-specific test results and errors. | 24 // EME-specific test results and errors. |
| 25 const char kEmeKeyError[] = "KEYERROR"; | 25 const char kEmeKeyError[] = "KEYERROR"; |
| 26 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 26 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
| 27 | 27 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 void TestConfigChange() { | 77 void TestConfigChange() { |
| 78 if (CurrentSourceType() != MSE || !IsMSESupported()) { | 78 if (CurrentSourceType() != MSE || !IsMSESupported()) { |
| 79 VLOG(0) << "Skipping test - config change test requires MSE."; | 79 VLOG(0) << "Skipping test - config change test requires MSE."; |
| 80 return; | 80 return; |
| 81 } | 81 } |
| 82 | 82 |
| 83 base::StringPairs query_params; | 83 base::StringPairs query_params; |
| 84 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); | 84 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); |
| 85 query_params.push_back(std::make_pair("runEncrypted", "1")); | 85 query_params.push_back(std::make_pair("runEncrypted", "1")); |
| 86 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | |
| 87 RunMediaTestPage("mse_config_change.html", query_params, kEnded, true); | 86 RunMediaTestPage("mse_config_change.html", query_params, kEnded, true); |
| 88 } | 87 } |
| 89 | 88 |
| 90 void RunEncryptedMediaTest(const std::string& html_page, | 89 void RunEncryptedMediaTest(const std::string& html_page, |
| 91 const std::string& media_file, | 90 const std::string& media_file, |
| 92 const std::string& media_type, | 91 const std::string& media_type, |
| 93 const std::string& key_system, | 92 const std::string& key_system, |
| 94 SrcType src_type, | 93 SrcType src_type, |
| 95 const std::string& expectation) { | 94 const std::string& expectation) { |
| 96 if (src_type == MSE && !IsMSESupported()) { | 95 if (src_type == MSE && !IsMSESupported()) { |
| 97 VLOG(0) << "Skipping test - MSE not supported."; | 96 VLOG(0) << "Skipping test - MSE not supported."; |
| 98 return; | 97 return; |
| 99 } | 98 } |
| 100 | 99 |
| 101 base::StringPairs query_params; | 100 base::StringPairs query_params; |
| 102 query_params.push_back(std::make_pair("mediaFile", media_file)); | 101 query_params.push_back(std::make_pair("mediaFile", media_file)); |
| 103 query_params.push_back(std::make_pair("mediaType", media_type)); | 102 query_params.push_back(std::make_pair("mediaType", media_type)); |
| 104 query_params.push_back(std::make_pair("keySystem", key_system)); | 103 query_params.push_back(std::make_pair("keySystem", key_system)); |
| 105 if (src_type == MSE) | 104 if (src_type == MSE) |
| 106 query_params.push_back(std::make_pair("useMSE", "1")); | 105 query_params.push_back(std::make_pair("useMSE", "1")); |
| 107 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | |
| 108 RunMediaTestPage(html_page, query_params, expectation, true); | 106 RunMediaTestPage(html_page, query_params, expectation, true); |
| 109 } | 107 } |
| 110 | 108 |
| 111 void RunSimpleEncryptedMediaTest(const std::string& media_file, | 109 void RunSimpleEncryptedMediaTest(const std::string& media_file, |
| 112 const std::string& media_type, | 110 const std::string& media_type, |
| 113 const std::string& key_system, | 111 const std::string& key_system, |
| 114 SrcType src_type) { | 112 SrcType src_type) { |
| 115 RunEncryptedMediaTest(kDefaultEmePlayer, | 113 RunEncryptedMediaTest(kDefaultEmePlayer, |
| 116 media_file, | 114 media_file, |
| 117 media_type, | 115 media_type, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { | 201 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { |
| 204 RunEncryptedMediaTest(kDefaultEmePlayer, | 202 RunEncryptedMediaTest(kDefaultEmePlayer, |
| 205 "bear-a_enc-a.webm", | 203 "bear-a_enc-a.webm", |
| 206 kWebMAudioOnly, | 204 kWebMAudioOnly, |
| 207 "com.example.foo", | 205 "com.example.foo", |
| 208 MSE, | 206 MSE, |
| 209 kEmeNotSupportedError); | 207 kEmeNotSupportedError); |
| 210 } | 208 } |
| 211 | 209 |
| 212 } // namespace content | 210 } // namespace content |
| OLD | NEW |