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

Side by Side Diff: content/renderer/media/render_media_client_unittest.cc

Issue 1953803002: Remove remaining uses of KeySystemInfo and InitDataTypeMask (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 7 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
« no previous file with comments | « content/renderer/media/render_media_client.cc ('k') | media/base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/test/simple_test_tick_clock.h" 8 #include "base/test/simple_test_tick_clock.h"
9 #include "content/public/renderer/content_renderer_client.h" 9 #include "content/public/renderer/content_renderer_client.h"
10 #include "content/renderer/media/render_media_client.h" 10 #include "content/renderer/media/render_media_client.h"
11 #include "content/test/test_content_client.h" 11 #include "content/test/test_content_client.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 14 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
15 15
16 namespace content { 16 namespace content {
17 17
18 namespace { 18 namespace {
19 19
20 class TestKeySystemProperties : public media::KeySystemProperties {
21 public:
22 TestKeySystemProperties(const std::string& key_system_name)
23 : key_system_name_(key_system_name) {}
24
25 std::string GetKeySystemName() const override { return key_system_name_; }
26 bool IsSupportedInitDataType(
27 media::EmeInitDataType init_data_type) const override {
28 return false;
29 }
30 media::SupportedCodecs GetSupportedCodecs() const override {
31 return media::EME_CODEC_NONE;
32 }
33 media::EmeConfigRule GetRobustnessConfigRule(
34 media::EmeMediaType media_type,
35 const std::string& requested_robustness) const override {
36 return requested_robustness.empty() ? media::EmeConfigRule::SUPPORTED
37 : media::EmeConfigRule::NOT_SUPPORTED;
38 }
39 media::EmeSessionTypeSupport GetPersistentLicenseSessionSupport()
40 const override {
41 return media::EmeSessionTypeSupport::NOT_SUPPORTED;
42 }
43 media::EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport()
44 const override {
45 return media::EmeSessionTypeSupport::NOT_SUPPORTED;
46 }
47 media::EmeFeatureSupport GetPersistentStateSupport() const override {
48 return media::EmeFeatureSupport::NOT_SUPPORTED;
49 }
50 media::EmeFeatureSupport GetDistinctiveIdentifierSupport() const override {
51 return media::EmeFeatureSupport::NOT_SUPPORTED;
52 }
53
54 private:
55 const std::string key_system_name_;
56 };
57
20 class TestContentRendererClient : public ContentRendererClient { 58 class TestContentRendererClient : public ContentRendererClient {
21 public: 59 public:
22 TestContentRendererClient() : is_extra_key_system_enabled_(false) {} 60 TestContentRendererClient() : is_extra_key_system_enabled_(false) {}
23 61
24 // ContentRendererClient implementation. 62 // ContentRendererClient implementation.
25 void AddKeySystems( 63 void AddSupportedKeySystems(
26 std::vector<media::KeySystemInfo>* key_systems_info) override { 64 std::vector<std::unique_ptr<media::KeySystemProperties>>*
27 // TODO(sandersd): Was this supposed to be added to the list? 65 key_systems_properties) override {
28 media::KeySystemInfo key_system_info; 66 key_systems_properties->emplace_back(
29 key_system_info.key_system = "test.keysystem"; 67 new TestKeySystemProperties("test.keysystem"));
30 key_system_info.max_audio_robustness = media::EmeRobustness::EMPTY; 68
31 key_system_info.max_video_robustness = media::EmeRobustness::EMPTY;
32 key_system_info.persistent_license_support =
33 media::EmeSessionTypeSupport::NOT_SUPPORTED;
34 key_system_info.persistent_release_message_support =
35 media::EmeSessionTypeSupport::NOT_SUPPORTED;
36 key_system_info.persistent_state_support =
37 media::EmeFeatureSupport::NOT_SUPPORTED;
38 key_system_info.distinctive_identifier_support =
39 media::EmeFeatureSupport::NOT_SUPPORTED;
40 key_systems_info->push_back(key_system_info);
41 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) 69 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
42 if (is_extra_key_system_enabled_) { 70 if (is_extra_key_system_enabled_) {
43 media::KeySystemInfo wv_key_system_info; 71 key_systems_properties->emplace_back(
44 wv_key_system_info.key_system = kWidevineKeySystem; 72 new TestKeySystemProperties(kWidevineKeySystem));
45 wv_key_system_info.max_audio_robustness = media::EmeRobustness::EMPTY;
46 wv_key_system_info.max_video_robustness = media::EmeRobustness::EMPTY;
47 wv_key_system_info.persistent_license_support =
48 media::EmeSessionTypeSupport::NOT_SUPPORTED;
49 wv_key_system_info.persistent_release_message_support =
50 media::EmeSessionTypeSupport::NOT_SUPPORTED;
51 wv_key_system_info.persistent_state_support =
52 media::EmeFeatureSupport::NOT_SUPPORTED;
53 wv_key_system_info.distinctive_identifier_support =
54 media::EmeFeatureSupport::NOT_SUPPORTED;
55 key_systems_info->push_back(wv_key_system_info);
56 } 73 }
57 #endif 74 #endif
58 } 75 }
59 76
60 void EnableExtraKeySystem() { is_extra_key_system_enabled_ = true; } 77 void EnableExtraKeySystem() { is_extra_key_system_enabled_ = true; }
61 78
62 private: 79 private:
63 // Whether a platform-specific extra key system is "supported" by |this|. 80 // Whether a platform-specific extra key system is "supported" by |this|.
64 bool is_extra_key_system_enabled_; 81 bool is_extra_key_system_enabled_;
65 }; 82 };
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 175
159 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); 176 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded());
160 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); 177 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000));
161 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); 178 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded());
162 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); 179 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000));
163 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); 180 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded());
164 #endif 181 #endif
165 } 182 }
166 183
167 } // namespace content 184 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/render_media_client.cc ('k') | media/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698