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/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/win/windows_version.h" | 8 #include "base/win/windows_version.h" |
9 #include "content/browser/media/media_browsertest.h" | 9 #include "content/browser/media/media_browsertest.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 SRC, | 31 SRC, |
32 MSE | 32 MSE |
33 }; | 33 }; |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 | 36 |
37 // MSE is available on all desktop platforms and on Android 4.1 and later. | 37 // MSE is available on all desktop platforms and on Android 4.1 and later. |
38 static bool IsMSESupported() { | 38 static bool IsMSESupported() { |
39 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
40 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { | 40 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { |
41 LOG(INFO) << "MSE is only supported in Android 4.1 and later."; | 41 VLOG(0) << "MSE is only supported in Android 4.1 and later."; |
42 return false; | 42 return false; |
43 } | 43 } |
44 #endif // defined(OS_ANDROID) | 44 #endif // defined(OS_ANDROID) |
45 return true; | 45 return true; |
46 } | 46 } |
47 | 47 |
48 // Tests encrypted media playback with a combination of parameters: | 48 // Tests encrypted media playback with a combination of parameters: |
49 // - char*: Key system name. | 49 // - char*: Key system name. |
50 // - bool: True to load media using MSE, otherwise use src. | 50 // - bool: True to load media using MSE, otherwise use src. |
51 class EncryptedMediaTest : public content::MediaBrowserTest, | 51 class EncryptedMediaTest : public content::MediaBrowserTest, |
(...skipping 15 matching lines...) Expand all Loading... |
67 } | 67 } |
68 | 68 |
69 void TestFrameSizeChange() { | 69 void TestFrameSizeChange() { |
70 RunEncryptedMediaTest("encrypted_frame_size_change.html", | 70 RunEncryptedMediaTest("encrypted_frame_size_change.html", |
71 "frame_size_change-av-enc-v.webm", kWebMAudioVideo, | 71 "frame_size_change-av-enc-v.webm", kWebMAudioVideo, |
72 CurrentKeySystem(), CurrentSourceType(), kEnded); | 72 CurrentKeySystem(), CurrentSourceType(), kEnded); |
73 } | 73 } |
74 | 74 |
75 void TestConfigChange() { | 75 void TestConfigChange() { |
76 if (CurrentSourceType() != MSE || !IsMSESupported()) { | 76 if (CurrentSourceType() != MSE || !IsMSESupported()) { |
77 LOG(INFO) << "Skipping test - config change test requires MSE."; | 77 VLOG(0) << "Skipping test - config change test requires MSE."; |
78 return; | 78 return; |
79 } | 79 } |
80 | 80 |
81 std::vector<StringPair> query_params; | 81 std::vector<StringPair> query_params; |
82 query_params.push_back(std::make_pair("keysystem", CurrentKeySystem())); | 82 query_params.push_back(std::make_pair("keysystem", CurrentKeySystem())); |
83 query_params.push_back(std::make_pair("runencrypted", "1")); | 83 query_params.push_back(std::make_pair("runencrypted", "1")); |
84 RunMediaTestPage("mse_config_change.html", &query_params, kEnded, true); | 84 RunMediaTestPage("mse_config_change.html", &query_params, kEnded, true); |
85 } | 85 } |
86 | 86 |
87 void RunEncryptedMediaTest(const char* html_page, | 87 void RunEncryptedMediaTest(const char* html_page, |
88 const char* media_file, | 88 const char* media_file, |
89 const char* media_type, | 89 const char* media_type, |
90 const char* key_system, | 90 const char* key_system, |
91 SrcType src_type, | 91 SrcType src_type, |
92 const char* expectation) { | 92 const char* expectation) { |
93 if (src_type == MSE && !IsMSESupported()) { | 93 if (src_type == MSE && !IsMSESupported()) { |
94 LOG(INFO) << "Skipping test - MSE not supported."; | 94 VLOG(0) << "Skipping test - MSE not supported."; |
95 return; | 95 return; |
96 } | 96 } |
97 | 97 |
98 std::vector<StringPair> query_params; | 98 std::vector<StringPair> query_params; |
99 query_params.push_back(std::make_pair("mediafile", media_file)); | 99 query_params.push_back(std::make_pair("mediafile", media_file)); |
100 query_params.push_back(std::make_pair("mediatype", media_type)); | 100 query_params.push_back(std::make_pair("mediatype", media_type)); |
101 query_params.push_back(std::make_pair("keysystem", key_system)); | 101 query_params.push_back(std::make_pair("keysystem", key_system)); |
102 if (src_type == MSE) | 102 if (src_type == MSE) |
103 query_params.push_back(std::make_pair("usemse", "1")); | 103 query_params.push_back(std::make_pair("usemse", "1")); |
104 RunMediaTestPage(html_page, &query_params, expectation, true); | 104 RunMediaTestPage(html_page, &query_params, expectation, true); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 TestFrameSizeChange(); | 173 TestFrameSizeChange(); |
174 } | 174 } |
175 | 175 |
176 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { | 176 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { |
177 RunEncryptedMediaTest("encrypted_media_player.html", "bear-a-enc_a.webm", | 177 RunEncryptedMediaTest("encrypted_media_player.html", "bear-a-enc_a.webm", |
178 kWebMAudioOnly, "com.example.foo", MSE, | 178 kWebMAudioOnly, "com.example.foo", MSE, |
179 kEmeNotSupportedError); | 179 kEmeNotSupportedError); |
180 } | 180 } |
181 | 181 |
182 } // namespace content | 182 } // namespace content |
OLD | NEW |