summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/android/pylib/gtest/filter/content_browsertests_disabled4
-rw-r--r--chrome/browser/media/encrypted_media_browsertest.cc54
-rw-r--r--content/browser/media/encrypted_media_browsertest.cc38
-rw-r--r--content/browser/media/media_source_browsertest.cc29
-rw-r--r--content/child/DEPS1
-rw-r--r--content/child/runtime_features.cc13
6 files changed, 107 insertions, 32 deletions
diff --git a/build/android/pylib/gtest/filter/content_browsertests_disabled b/build/android/pylib/gtest/filter/content_browsertests_disabled
index 8747097..bf1fcf0 100644
--- a/build/android/pylib/gtest/filter/content_browsertests_disabled
+++ b/build/android/pylib/gtest/filter/content_browsertests_disabled
@@ -2,14 +2,12 @@
# Timeouts
Http/MediaTest.*
File/MediaTest.*
-ExternalClearKey/EncryptedMediaTest.*
-ClearKey/EncryptedMediaTest.*
WorkerTest.*
MediaTest.*
MediaSourceTest.*
WebGLConformanceTest.*
MessagePortTest.Tests
-EncryptedMediaTest.*
+*EncryptedMediaTest.*
CrossPlatformAccessibilityBrowserTest.*
DatabaseTest.*
ResourceDispatcherHostBrowserTest.SyncXMLHttpRequest_DuringUnload
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc
index d3b74746..9c24849 100644
--- a/chrome/browser/media/encrypted_media_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -11,6 +11,9 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/test/browser_test_utils.h"
+#if defined(OS_ANDROID)
+#include "base/android/build_info.h"
+#endif
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
@@ -56,6 +59,17 @@ enum SrcType {
MSE
};
+// MSE is available on all desktop platforms and on Android 4.1 and later.
+static bool IsMSESupported() {
+#if defined(OS_ANDROID)
+ if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) {
+ LOG(INFO) << "MSE is only supported in Android 4.1 and later.";
+ return false;
+ }
+#endif // defined(OS_ANDROID)
+ return true;
+}
+
// Base class for encrypted media tests.
class EncryptedMediaTestBase : public MediaBrowserTest {
public:
@@ -77,6 +91,11 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
const char* key_system,
SrcType src_type,
const char* expectation) {
+ if (src_type == MSE && !IsMSESupported()) {
+ LOG(INFO) << "Skipping test - MSE not supported.";
+ return;
+ }
+
std::vector<StringPair> query_params;
query_params.push_back(std::make_pair("mediafile", media_file));
query_params.push_back(std::make_pair("mediatype", media_type));
@@ -261,6 +280,10 @@ class EncryptedMediaTest : public EncryptedMediaTestBase,
}
void TestConfigChange() {
+ if (CurrentSourceType() != MSE || !IsMSESupported()) {
+ LOG(INFO) << "Skipping test - config change test requires MSE.";
+ return;
+ }
#if defined(WIDEVINE_CDM_AVAILABLE)
if (IsWidevine(CurrentKeySystem())) {
LOG(INFO) << "ConfigChange test cannot run with Widevine.";
@@ -280,25 +303,32 @@ class EncryptedMediaTest : public EncryptedMediaTestBase,
}
};
-INSTANTIATE_TEST_CASE_P(ClearKey, EncryptedMediaTest,
- ::testing::Combine(
- ::testing::Values(kClearKeyKeySystem), ::testing::Values(SRC, MSE)));
+using ::testing::Combine;
+using ::testing::Values;
+
+#if !defined(OS_ANDROID)
+INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest,
+ Combine(Values(kClearKeyKeySystem), Values(SRC)));
+#endif // !defined(OS_ANDROID)
+
+INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest,
+ Combine(Values(kClearKeyKeySystem), Values(MSE)));
// External Clear Key is currently only used on platforms that use Pepper CDMs.
#if defined(ENABLE_PEPPER_CDMS)
-INSTANTIATE_TEST_CASE_P(ExternalClearKey, EncryptedMediaTest,
- ::testing::Combine(
- ::testing::Values(kExternalClearKeyKeySystem),
- ::testing::Values(SRC, MSE)));
+INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, EncryptedMediaTest,
+ Combine(Values(kExternalClearKeyKeySystem), Values(SRC)));
+INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, EncryptedMediaTest,
+ Combine(Values(kExternalClearKeyKeySystem), Values(MSE)));
+#endif // defined(ENABLE_PEPPER_CDMS)
#if defined(WIDEVINE_CDM_AVAILABLE)
// This test doesn't fully test playback with Widevine. So we only run Widevine
-// test with MSE (no SRC) to reduce test time.
-INSTANTIATE_TEST_CASE_P(Widevine, EncryptedMediaTest,
- ::testing::Combine(
- ::testing::Values(kWidevineKeySystem), ::testing::Values(MSE)));
+// test with MSE (no SRC) to reduce test time. Also, on Android EME only works
+// with MSE and we cannot run this test with SRC.
+INSTANTIATE_TEST_CASE_P(MSE_Widevine, EncryptedMediaTest,
+ Combine(Values(kWidevineKeySystem), Values(MSE)));
#endif // defined(WIDEVINE_CDM_AVAILABLE)
-#endif // defined(ENABLE_PEPPER_CDMS)
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) {
TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly);
diff --git a/content/browser/media/encrypted_media_browsertest.cc b/content/browser/media/encrypted_media_browsertest.cc
index 1a40910..528dfb9 100644
--- a/content/browser/media/encrypted_media_browsertest.cc
+++ b/content/browser/media/encrypted_media_browsertest.cc
@@ -10,18 +10,21 @@
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/shell/browser/shell.h"
+#if defined(OS_ANDROID)
+#include "base/android/build_info.h"
+#endif
// Available key systems.
-static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
+const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
// Supported media types.
-static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
-static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\"";
-static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\"";
+const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
+const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\"";
+const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\"";
// EME-specific test results and errors.
-static const char kEmeKeyError[] = "KEYERROR";
-static const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR";
+const char kEmeKeyError[] = "KEYERROR";
+const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR";
// The type of video src used to load media.
enum SrcType {
@@ -31,6 +34,17 @@ enum SrcType {
namespace content {
+// MSE is available on all desktop platforms and on Android 4.1 and later.
+static bool IsMSESupported() {
+#if defined(OS_ANDROID)
+ if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) {
+ LOG(INFO) << "MSE is only supported in Android 4.1 and later.";
+ return false;
+ }
+#endif // defined(OS_ANDROID)
+ return true;
+}
+
// Tests encrypted media playback with a combination of parameters:
// - char*: Key system name.
// - bool: True to load media using MSE, otherwise use src.
@@ -59,6 +73,11 @@ class EncryptedMediaTest : public content::MediaBrowserTest,
}
void TestConfigChange() {
+ if (CurrentSourceType() != MSE || !IsMSESupported()) {
+ LOG(INFO) << "Skipping test - config change test requires MSE.";
+ return;
+ }
+
std::vector<StringPair> query_params;
query_params.push_back(std::make_pair("keysystem", CurrentKeySystem()));
query_params.push_back(std::make_pair("runencrypted", "1"));
@@ -71,6 +90,11 @@ class EncryptedMediaTest : public content::MediaBrowserTest,
const char* key_system,
SrcType src_type,
const char* expectation) {
+ if (src_type == MSE && !IsMSESupported()) {
+ LOG(INFO) << "Skipping test - MSE not supported.";
+ return;
+ }
+
std::vector<StringPair> query_params;
query_params.push_back(std::make_pair("mediafile", media_file));
query_params.push_back(std::make_pair("mediatype", media_type));
@@ -111,7 +135,7 @@ using ::testing::Values;
// Encrypted media playback with SRC is not supported on Android.
INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest,
Combine(Values(kClearKeyKeySystem), Values(SRC)));
-#endif // defined(OS_ANDROID)
+#endif // !defined(OS_ANDROID)
INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest,
Combine(Values(kClearKeyKeySystem), Values(MSE)));
diff --git a/content/browser/media/media_source_browsertest.cc b/content/browser/media/media_source_browsertest.cc
index bd119dd..360baa7 100644
--- a/content/browser/media/media_source_browsertest.cc
+++ b/content/browser/media/media_source_browsertest.cc
@@ -5,18 +5,37 @@
#include "base/command_line.h"
#include "content/browser/media/media_browsertest.h"
#include "content/public/common/content_switches.h"
+#if defined(OS_ANDROID)
+#include "base/android/build_info.h"
+#endif
// Common media types.
-static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
-static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\"";
-static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\"";
+const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
+const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\"";
+const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\"";
namespace content {
+// MSE is available on all desktop platforms and on Android 4.1 and later.
+static bool IsMSESupported() {
+#if defined(OS_ANDROID)
+ if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) {
+ LOG(INFO) << "MSE is only supported in Android 4.1 and later.";
+ return false;
+ }
+#endif // defined(OS_ANDROID)
+ return true;
+}
+
class MediaSourceTest : public content::MediaBrowserTest {
public:
void TestSimplePlayback(const char* media_file, const char* media_type,
const char* expectation) {
+ if (!IsMSESupported()) {
+ LOG(INFO) << "Skipping test - MSE not supported.";
+ return;
+ }
+
std::vector<StringPair> query_params;
query_params.push_back(std::make_pair("mediafile", media_file));
query_params.push_back(std::make_pair("mediatype", media_type));
@@ -51,6 +70,10 @@ IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) {
// Flaky test crbug.com/246308
// Test changed to skip checks resulting in flakiness. Proper fix still needed.
IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) {
+ if (!IsMSESupported()) {
+ LOG(INFO) << "Skipping test - MSE not supported.";
+ return;
+ }
RunMediaTestPage("mse_config_change.html", NULL, kEnded, true);
}
diff --git a/content/child/DEPS b/content/child/DEPS
index e962861..911b3c9 100644
--- a/content/child/DEPS
+++ b/content/child/DEPS
@@ -1,4 +1,5 @@
include_rules = [
"+components/tracing",
"+content/public/child",
+ "+media/base/android",
]
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc
index b784459..aebad1c 100644
--- a/content/child/runtime_features.cc
+++ b/content/child/runtime_features.cc
@@ -10,7 +10,7 @@
#if defined(OS_ANDROID)
#include <cpu-features.h>
-#include "base/android/build_info.h"
+#include "media/base/android/media_codec_bridge.h"
#endif
using WebKit::WebRuntimeFeatures;
@@ -20,9 +20,8 @@ namespace content {
static void SetRuntimeFeatureDefaultsForPlatform() {
#if defined(OS_ANDROID)
#if !defined(GOOGLE_TV)
- // MSE/EME implementation needs Android MediaCodec API that was introduced
- // in JellyBrean.
- if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) {
+ // MSE/EME implementation needs Android MediaCodec API.
+ if (!media::MediaCodecBridge::IsAvailable()) {
WebRuntimeFeatures::enableWebKitMediaSource(false);
WebRuntimeFeatures::enableMediaSource(false);
WebRuntimeFeatures::enablePrefixedEncryptedMedia(false);
@@ -30,10 +29,10 @@ static void SetRuntimeFeatureDefaultsForPlatform() {
#endif // !defined(GOOGLE_TV)
bool enable_webaudio = false;
#if defined(ARCH_CPU_ARMEL)
- // WebAudio needs Android MediaCodec API that was introduced in
- // JellyBean, and also currently needs NEON support for the FFT.
+ // WebAudio needs Android MediaCodec API, and also currently needs NEON
+ // support for the FFT.
enable_webaudio =
- (base::android::BuildInfo::GetInstance()->sdk_int() >= 16) &&
+ (media::MediaCodecBridge::IsAvailable()) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0);
#endif // defined(ARCH_CPU_ARMEL)
WebRuntimeFeatures::enableWebAudio(enable_webaudio);