| OLD | NEW |
| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "content/public/common/content_client.h" | |
| 9 #include "content/public/renderer/content_renderer_client.h" | |
| 10 #include "content/renderer/media/crypto/key_systems.h" | 8 #include "content/renderer/media/crypto/key_systems.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| 13 | 11 |
| 14 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 12 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 15 | 13 |
| 16 // Death tests are not always available, including on Android. | 14 // Death tests are not always available, including on Android. |
| 17 // EXPECT_DEBUG_DEATH_PORTABLE executes tests correctly except in the case that | 15 // EXPECT_DEBUG_DEATH_PORTABLE executes tests correctly except in the case that |
| 18 // death tests are not available and NDEBUG is not defined. | 16 // death tests are not available and NDEBUG is not defined. |
| 19 #if defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) | 17 #if defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 131 |
| 134 aac_codec_.push_back("mp4a"); | 132 aac_codec_.push_back("mp4a"); |
| 135 | 133 |
| 136 avc1_and_aac_codecs_.push_back("avc1"); | 134 avc1_and_aac_codecs_.push_back("avc1"); |
| 137 avc1_and_aac_codecs_.push_back("mp4a"); | 135 avc1_and_aac_codecs_.push_back("mp4a"); |
| 138 | 136 |
| 139 unknown_codec_.push_back("foo"); | 137 unknown_codec_.push_back("foo"); |
| 140 | 138 |
| 141 mixed_codecs_.push_back("vorbis"); | 139 mixed_codecs_.push_back("vorbis"); |
| 142 mixed_codecs_.push_back("avc1"); | 140 mixed_codecs_.push_back("avc1"); |
| 143 | |
| 144 SetRendererClientForTesting(&content_renderer_client_); | |
| 145 } | 141 } |
| 146 | 142 |
| 147 typedef std::vector<std::string> CodecVector; | 143 typedef std::vector<std::string> CodecVector; |
| 148 | 144 |
| 149 const CodecVector& no_codecs() const { return no_codecs_; } | 145 const CodecVector& no_codecs() const { return no_codecs_; } |
| 150 | 146 |
| 151 const CodecVector& vp8_codec() const { return vp8_codec_; } | 147 const CodecVector& vp8_codec() const { return vp8_codec_; } |
| 152 const CodecVector& vp80_codec() const { return vp80_codec_; } | 148 const CodecVector& vp80_codec() const { return vp80_codec_; } |
| 153 const CodecVector& vorbis_codec() const { return vorbis_codec_; } | 149 const CodecVector& vorbis_codec() const { return vorbis_codec_; } |
| 154 const CodecVector& vp8_and_vorbis_codecs() const { | 150 const CodecVector& vp8_and_vorbis_codecs() const { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 182 CodecVector avc1_extended_codec_; | 178 CodecVector avc1_extended_codec_; |
| 183 CodecVector avc1_dot_codec_; | 179 CodecVector avc1_dot_codec_; |
| 184 CodecVector avc2_codec_; | 180 CodecVector avc2_codec_; |
| 185 CodecVector aac_codec_; | 181 CodecVector aac_codec_; |
| 186 CodecVector avc1_and_aac_codecs_; | 182 CodecVector avc1_and_aac_codecs_; |
| 187 | 183 |
| 188 CodecVector unknown_codec_; | 184 CodecVector unknown_codec_; |
| 189 | 185 |
| 190 CodecVector mixed_codecs_; | 186 CodecVector mixed_codecs_; |
| 191 | 187 |
| 192 ContentRendererClient content_renderer_client_; | |
| 193 }; | 188 }; |
| 194 | 189 |
| 195 TEST_F(KeySystemsTest, ClearKey_Basic) { | 190 TEST_F(KeySystemsTest, ClearKey_Basic) { |
| 196 EXPECT_TRUE(IsConcreteSupportedKeySystem(WebString::fromUTF8(kClearKey))); | 191 EXPECT_TRUE(IsConcreteSupportedKeySystem(WebString::fromUTF8(kClearKey))); |
| 197 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 192 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 198 "video/webm", no_codecs(), kClearKey)); | 193 "video/webm", no_codecs(), kClearKey)); |
| 199 | 194 |
| 200 // Not yet out from behind the vendor prefix. | 195 // Not yet out from behind the vendor prefix. |
| 201 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.w3.clearkey")); | 196 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.w3.clearkey")); |
| 202 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 197 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 EXPECT_TRUE(uuid.empty()); | 838 EXPECT_TRUE(uuid.empty()); |
| 844 | 839 |
| 845 EXPECT_TRUE(GetUUID(kClearKey).empty()); | 840 EXPECT_TRUE(GetUUID(kClearKey).empty()); |
| 846 | 841 |
| 847 EXPECT_DEBUG_DEATH_PORTABLE(uuid = GetUUID(""), " is not a concrete system"); | 842 EXPECT_DEBUG_DEATH_PORTABLE(uuid = GetUUID(""), " is not a concrete system"); |
| 848 EXPECT_TRUE(uuid.empty()); | 843 EXPECT_TRUE(uuid.empty()); |
| 849 } | 844 } |
| 850 #endif // defined(OS_ANDROID) | 845 #endif // defined(OS_ANDROID) |
| 851 | 846 |
| 852 } // namespace content | 847 } // namespace content |
| OLD | NEW |