| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | 31 static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; |
| 32 static const char kExternalClearKeyKeySystem[] = | 32 static const char kExternalClearKeyKeySystem[] = |
| 33 "org.chromium.externalclearkey"; | 33 "org.chromium.externalclearkey"; |
| 34 | 34 |
| 35 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 35 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
| 36 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; | 36 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; |
| 37 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; | 37 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; |
| 38 | 38 |
| 39 namespace content { | 39 namespace content { |
| 40 | 40 |
| 41 class EncryptedMediaTest : public testing::WithParamInterface<const char*>, | 41 // Disabled, http://crbug.com/158591 . |
| 42 public ContentBrowserTest { | 42 class DISABLED_EncryptedMediaTest |
| 43 : public testing::WithParamInterface<const char*>, |
| 44 public ContentBrowserTest { |
| 43 public: | 45 public: |
| 44 void TestSimplePlayback(const char* encrypted_media, const char* media_type, | 46 void TestSimplePlayback(const char* encrypted_media, const char* media_type, |
| 45 const char* key_system, const string16 expectation) { | 47 const char* key_system, const string16 expectation) { |
| 46 PlayEncryptedMedia("encrypted_media_player.html", encrypted_media, | 48 PlayEncryptedMedia("encrypted_media_player.html", encrypted_media, |
| 47 media_type, key_system, expectation); | 49 media_type, key_system, expectation); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void TestFrameSizeChange(const char* key_system, const string16 expectation) { | 52 void TestFrameSizeChange(const char* key_system, const string16 expectation) { |
| 51 PlayEncryptedMedia("encrypted_frame_size_change.html", | 53 PlayEncryptedMedia("encrypted_frame_size_change.html", |
| 52 "frame_size_change-av-enc-v.webm", kWebMAudioVideo, | 54 "frame_size_change-av-enc-v.webm", kWebMAudioVideo, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 webkit_media::GetPluginType(kExternalClearKeyKeySystem))); | 104 webkit_media::GetPluginType(kExternalClearKeyKeySystem))); |
| 103 #else | 105 #else |
| 104 pepper_plugin.append( | 106 pepper_plugin.append( |
| 105 webkit_media::GetPluginType(kExternalClearKeyKeySystem)); | 107 webkit_media::GetPluginType(kExternalClearKeyKeySystem)); |
| 106 #endif | 108 #endif |
| 107 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | 109 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| 108 pepper_plugin); | 110 pepper_plugin); |
| 109 } | 111 } |
| 110 }; | 112 }; |
| 111 | 113 |
| 112 INSTANTIATE_TEST_CASE_P(ClearKey, EncryptedMediaTest, | 114 INSTANTIATE_TEST_CASE_P(ClearKey, DISABLED_EncryptedMediaTest, |
| 113 ::testing::Values(kClearKeyKeySystem)); | 115 ::testing::Values(kClearKeyKeySystem)); |
| 114 | 116 |
| 115 // http://crbug.com/152864 (Mac) and http://crbug.com/157759 (ASAN on Aura) | 117 // http://crbug.com/152864 (Mac) and http://crbug.com/157759 (ASAN on Aura) |
| 116 #if !defined(OS_MACOSX) && !(defined(ADDRESS_SANITIZER) && defined(USE_AURA)) | 118 #if !defined(OS_MACOSX) && !(defined(ADDRESS_SANITIZER) && defined(USE_AURA)) |
| 117 INSTANTIATE_TEST_CASE_P(ExternalClearKey, EncryptedMediaTest, | 119 INSTANTIATE_TEST_CASE_P(ExternalClearKey, DISABLED_EncryptedMediaTest, |
| 118 ::testing::Values(kExternalClearKeyKeySystem)); | 120 ::testing::Values(kExternalClearKeyKeySystem)); |
| 119 #define MAYBE(test) test | 121 #define MAYBE(test) test |
| 120 #else | 122 #else |
| 121 #define MAYBE(test) DISABLED_ ## test | 123 #define MAYBE(test) DISABLED_ ## test |
| 122 #endif | 124 #endif |
| 123 | 125 |
| 124 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, InvalidKeySystem) { | 126 IN_PROC_BROWSER_TEST_F(DISABLED_EncryptedMediaTest, InvalidKeySystem) { |
| 125 const string16 kExpected = ASCIIToUTF16( | 127 const string16 kExpected = ASCIIToUTF16( |
| 126 StringToUpperASCII(std::string("GenerateKeyRequestException"))); | 128 StringToUpperASCII(std::string("GenerateKeyRequestException"))); |
| 127 ASSERT_NO_FATAL_FAILURE( | 129 ASSERT_NO_FATAL_FAILURE( |
| 128 TestSimplePlayback("bear-320x240-av-enc_av.webm", kWebMAudioVideo, | 130 TestSimplePlayback("bear-320x240-av-enc_av.webm", kWebMAudioVideo, |
| 129 "com.example.invalid", kExpected)); | 131 "com.example.invalid", kExpected)); |
| 130 } | 132 } |
| 131 | 133 |
| 132 // TODO: Make these three IN_PROC_BROWSER_TEST_P() when internal Clear Key | 134 // TODO: Make these three IN_PROC_BROWSER_TEST_P() when internal Clear Key |
| 133 // supports encrypted audio. | 135 // supports encrypted audio. |
| 134 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, MAYBE(BasicPlayback_AudioOnly)) { | 136 IN_PROC_BROWSER_TEST_F(DISABLED_EncryptedMediaTest, |
| 137 MAYBE(BasicPlayback_AudioOnly)) { |
| 135 const string16 kExpected = ASCIIToUTF16("ENDED"); | 138 const string16 kExpected = ASCIIToUTF16("ENDED"); |
| 136 ASSERT_NO_FATAL_FAILURE( | 139 ASSERT_NO_FATAL_FAILURE( |
| 137 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly, | 140 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly, |
| 138 kExternalClearKeyKeySystem, kExpected)); | 141 kExternalClearKeyKeySystem, kExpected)); |
| 139 } | 142 } |
| 140 | 143 |
| 141 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, | 144 IN_PROC_BROWSER_TEST_F(DISABLED_EncryptedMediaTest, |
| 142 MAYBE(BasicPlayback_AudioClearVideo)) { | 145 MAYBE(BasicPlayback_AudioClearVideo)) { |
| 143 const string16 kExpected = ASCIIToUTF16("ENDED"); | 146 const string16 kExpected = ASCIIToUTF16("ENDED"); |
| 144 ASSERT_NO_FATAL_FAILURE( | 147 ASSERT_NO_FATAL_FAILURE( |
| 145 TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo, | 148 TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo, |
| 146 kExternalClearKeyKeySystem, kExpected)); | 149 kExternalClearKeyKeySystem, kExpected)); |
| 147 } | 150 } |
| 148 | 151 |
| 149 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, MAYBE(BasicPlayback_VideoAudio)) { | 152 IN_PROC_BROWSER_TEST_F(DISABLED_EncryptedMediaTest, |
| 153 MAYBE(BasicPlayback_VideoAudio)) { |
| 150 const string16 kExpected = ASCIIToUTF16("ENDED"); | 154 const string16 kExpected = ASCIIToUTF16("ENDED"); |
| 151 ASSERT_NO_FATAL_FAILURE( | 155 ASSERT_NO_FATAL_FAILURE( |
| 152 TestSimplePlayback("bear-320x240-av-enc_av.webm", kWebMAudioVideo, | 156 TestSimplePlayback("bear-320x240-av-enc_av.webm", kWebMAudioVideo, |
| 153 kExternalClearKeyKeySystem, kExpected)); | 157 kExternalClearKeyKeySystem, kExpected)); |
| 154 } | 158 } |
| 155 | 159 |
| 156 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, BasicPlayback_VideoOnly) { | 160 IN_PROC_BROWSER_TEST_P(DISABLED_EncryptedMediaTest, BasicPlayback_VideoOnly) { |
| 157 const string16 kExpected = ASCIIToUTF16("ENDED"); | 161 const string16 kExpected = ASCIIToUTF16("ENDED"); |
| 158 ASSERT_NO_FATAL_FAILURE( | 162 ASSERT_NO_FATAL_FAILURE( |
| 159 TestSimplePlayback("bear-320x240-v-enc_v.webm", kWebMVideoOnly, | 163 TestSimplePlayback("bear-320x240-v-enc_v.webm", kWebMVideoOnly, |
| 160 GetParam(), kExpected)); | 164 GetParam(), kExpected)); |
| 161 } | 165 } |
| 162 | 166 |
| 163 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, BasicPlayback_VideoClearAudio) { | 167 IN_PROC_BROWSER_TEST_P(DISABLED_EncryptedMediaTest, |
| 168 BasicPlayback_VideoClearAudio) { |
| 164 const string16 kExpected = ASCIIToUTF16("ENDED"); | 169 const string16 kExpected = ASCIIToUTF16("ENDED"); |
| 165 ASSERT_NO_FATAL_FAILURE( | 170 ASSERT_NO_FATAL_FAILURE( |
| 166 TestSimplePlayback("bear-320x240-av-enc_v.webm", kWebMAudioVideo, | 171 TestSimplePlayback("bear-320x240-av-enc_v.webm", kWebMAudioVideo, |
| 167 GetParam(), kExpected)); | 172 GetParam(), kExpected)); |
| 168 } | 173 } |
| 169 | 174 |
| 170 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameChangeVideo) { | 175 IN_PROC_BROWSER_TEST_P(DISABLED_EncryptedMediaTest, FrameChangeVideo) { |
| 171 const string16 kExpected = ASCIIToUTF16("ENDED"); | 176 const string16 kExpected = ASCIIToUTF16("ENDED"); |
| 172 ASSERT_NO_FATAL_FAILURE(TestFrameSizeChange(GetParam(), kExpected)); | 177 ASSERT_NO_FATAL_FAILURE(TestFrameSizeChange(GetParam(), kExpected)); |
| 173 } | 178 } |
| 174 | 179 |
| 175 } // namespace content | 180 } // namespace content |
| OLD | NEW |