Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/media/encrypted_media_browsertest.cc

Issue 27230004: Do not run MSE related tests when MSE is not available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check MediaCodecBridge Availability Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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 "chrome/browser/media/media_browsertest.h" 9 #include "chrome/browser/media/media_browsertest.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "content/public/test/browser_test_utils.h" 13 #include "content/public/test/browser_test_utils.h"
14 #if defined(OS_ANDROID)
15 #include "media/base/android/media_codec_bridge.h"
16 #endif
14 17
15 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 18 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
16 19
17 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX) 20 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX)
18 #include <gnu/libc-version.h> 21 #include <gnu/libc-version.h>
19 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX) 22 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX)
20 23
21 #if defined(ENABLE_PEPPER_CDMS) 24 #if defined(ENABLE_PEPPER_CDMS)
22 // Platform-specific filename relative to the chrome executable. 25 // Platform-specific filename relative to the chrome executable.
23 const char kClearKeyCdmAdapterFileName[] = 26 const char kClearKeyCdmAdapterFileName[] =
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 LOG(INFO) << "FrameSizeChange test cannot run with Widevine."; 92 LOG(INFO) << "FrameSizeChange test cannot run with Widevine.";
90 return; 93 return;
91 } 94 }
92 #endif // defined(WIDEVINE_CDM_AVAILABLE) 95 #endif // defined(WIDEVINE_CDM_AVAILABLE)
93 RunEncryptedMediaTest("encrypted_frame_size_change.html", 96 RunEncryptedMediaTest("encrypted_frame_size_change.html",
94 "frame_size_change-av-enc-v.webm", kWebMAudioVideo, 97 "frame_size_change-av-enc-v.webm", kWebMAudioVideo,
95 CurrentKeySystem(), CurrentSourceType(), kEnded); 98 CurrentKeySystem(), CurrentSourceType(), kEnded);
96 } 99 }
97 100
98 void TestConfigChange() { 101 void TestConfigChange() {
102 if (CurrentSourceType() != MSE) {
103 LOG(INFO) << "Skipping test - config change only applies to MSE.";
104 return;
105 }
106
107 #if defined(OS_ANDROID)
108 if (!media::MediaCodecBridge::IsAvailable()) {
ddorwin 2013/10/16 20:17:17 As mentioned in PS1, I don't think we should rely
xhwang 2013/10/16 21:41:17 Done.
109 LOG(INFO) << "Could not run test - MSE not supported.";
ddorwin 2013/10/16 20:17:17 An explicit check also allows you to say why here
xhwang 2013/10/16 21:41:17 Done.
110 return;
111 }
112 #endif // defined(OS_ANDROID)
113
99 #if defined(WIDEVINE_CDM_AVAILABLE) 114 #if defined(WIDEVINE_CDM_AVAILABLE)
100 if (IsWidevine(CurrentKeySystem())) { 115 if (IsWidevine(CurrentKeySystem())) {
101 LOG(INFO) << "ConfigChange test cannot run with Widevine."; 116 LOG(INFO) << "ConfigChange test cannot run with Widevine.";
102 return; 117 return;
103 } 118 }
104 #endif // defined(WIDEVINE_CDM_AVAILABLE) 119 #endif // defined(WIDEVINE_CDM_AVAILABLE)
120
105 std::vector<StringPair> query_params; 121 std::vector<StringPair> query_params;
106 query_params.push_back(std::make_pair("keysystem", CurrentKeySystem())); 122 query_params.push_back(std::make_pair("keysystem", CurrentKeySystem()));
107 query_params.push_back(std::make_pair("runencrypted", "1")); 123 query_params.push_back(std::make_pair("runencrypted", "1"));
108 RunMediaTestPage("mse_config_change.html", &query_params, kEnded, true); 124 RunMediaTestPage("mse_config_change.html", &query_params, kEnded, true);
109 } 125 }
110 126
111 void RunEncryptedMediaTest(const char* html_page, 127 void RunEncryptedMediaTest(const char* html_page,
112 const char* media_file, 128 const char* media_file,
113 const char* media_type, 129 const char* media_type,
114 const char* key_system, 130 const char* key_system,
115 SrcType src_type, 131 SrcType src_type,
116 const char* expectation) { 132 const char* expectation) {
133 #if defined(OS_ANDROID)
134 if (src_type == MSE && !media::MediaCodecBridge::IsAvailable()) {
135 LOG(INFO) << "Could not run test - MSE not supported.";
136 return;
137 }
138 #endif // defined(OS_ANDROID)
139
117 std::vector<StringPair> query_params; 140 std::vector<StringPair> query_params;
118 query_params.push_back(std::make_pair("mediafile", media_file)); 141 query_params.push_back(std::make_pair("mediafile", media_file));
119 query_params.push_back(std::make_pair("mediatype", media_type)); 142 query_params.push_back(std::make_pair("mediatype", media_type));
120 query_params.push_back(std::make_pair("keysystem", key_system)); 143 query_params.push_back(std::make_pair("keysystem", key_system));
121 if (src_type == MSE) 144 if (src_type == MSE)
122 query_params.push_back(std::make_pair("usemse", "1")); 145 query_params.push_back(std::make_pair("usemse", "1"));
123 RunMediaTestPage(html_page, &query_params, expectation, true); 146 RunMediaTestPage(html_page, &query_params, expectation, true);
124 } 147 }
125 148
126 void RunSimpleEncryptedMediaTest(const char* media_file, 149 void RunSimpleEncryptedMediaTest(const char* media_file,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 322 }
300 #endif // defined(USE_PROPRIETARY_CODECS) 323 #endif // defined(USE_PROPRIETARY_CODECS)
301 324
302 #if defined(WIDEVINE_CDM_AVAILABLE) 325 #if defined(WIDEVINE_CDM_AVAILABLE)
303 // The parent key system cannot be used in generateKeyRequest. 326 // The parent key system cannot be used in generateKeyRequest.
304 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, WVParentThrowsException) { 327 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, WVParentThrowsException) {
305 RunEncryptedMediaTest("encrypted_media_player.html", "bear-a-enc_a.webm", 328 RunEncryptedMediaTest("encrypted_media_player.html", "bear-a-enc_a.webm",
306 kWebMAudioOnly, "com.widevine", SRC, kEmeGkrException); 329 kWebMAudioOnly, "com.widevine", SRC, kEmeGkrException);
307 } 330 }
308 #endif // defined(WIDEVINE_CDM_AVAILABLE) 331 #endif // defined(WIDEVINE_CDM_AVAILABLE)
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/encrypted_media_browsertest.cc » ('j') | content/child/runtime_features.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698