OLD | NEW |
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" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void EnableExtraKeySystem() { is_extra_key_system_enabled_ = true; } | 60 void EnableExtraKeySystem() { is_extra_key_system_enabled_ = true; } |
61 | 61 |
62 private: | 62 private: |
63 // Whether a platform-specific extra key system is "supported" by |this|. | 63 // Whether a platform-specific extra key system is "supported" by |this|. |
64 bool is_extra_key_system_enabled_; | 64 bool is_extra_key_system_enabled_; |
65 }; | 65 }; |
66 | 66 |
67 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 67 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
68 bool ContainsWidevine( | 68 bool ContainsWidevine( |
69 const std::vector<media::KeySystemInfo>& key_systems_info) { | 69 const std::vector<media::KeySystemInfo>& key_systems_info) { |
70 for (const auto& key_system_info: key_systems_info) { | 70 for (const auto& key_system_info : key_systems_info) { |
71 if (key_system_info.key_system == kWidevineKeySystem) | 71 if (key_system_info.key_system == kWidevineKeySystem) |
72 return true; | 72 return true; |
73 } | 73 } |
74 return false; | 74 return false; |
75 } | 75 } |
76 #endif | 76 #endif |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 class RenderMediaClientTest : public testing::Test { | 80 class RenderMediaClientTest : public testing::Test { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 #if defined(WIDEVINE_CDM_AVAILABLE) | 115 #if defined(WIDEVINE_CDM_AVAILABLE) |
116 EXPECT_EQ("Widevine", widevine_uma_name); | 116 EXPECT_EQ("Widevine", widevine_uma_name); |
117 #else | 117 #else |
118 EXPECT_TRUE(widevine_uma_name.empty()); | 118 EXPECT_TRUE(widevine_uma_name.empty()); |
119 #endif | 119 #endif |
120 | 120 |
121 EXPECT_TRUE(clearkey_uma_name.empty()) << "Clear Key is added by media/ and " | 121 EXPECT_TRUE(clearkey_uma_name.empty()) << "Clear Key is added by media/ and " |
122 "should not be added by the " | 122 "should not be added by the " |
123 "MediaClient."; | 123 "MediaClient."; |
124 ; | |
125 } | 124 } |
126 | 125 |
127 TEST_F(RenderMediaClientTest, IsKeySystemsUpdateNeeded) { | 126 TEST_F(RenderMediaClientTest, IsKeySystemsUpdateNeeded) { |
128 base::SimpleTestTickClock* tick_clock = new base::SimpleTestTickClock(); | 127 base::SimpleTestTickClock* tick_clock = new base::SimpleTestTickClock(); |
129 render_media_client_->SetTickClockForTesting( | 128 render_media_client_->SetTickClockForTesting( |
130 scoped_ptr<base::TickClock>(tick_clock)); | 129 scoped_ptr<base::TickClock>(tick_clock)); |
131 | 130 |
132 // IsKeySystemsUpdateNeeded() always returns true after construction. | 131 // IsKeySystemsUpdateNeeded() always returns true after construction. |
133 EXPECT_TRUE(render_media_client_->IsKeySystemsUpdateNeeded()); | 132 EXPECT_TRUE(render_media_client_->IsKeySystemsUpdateNeeded()); |
134 | 133 |
(...skipping 22 matching lines...) Expand all Loading... |
157 | 156 |
158 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); | 157 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); |
159 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); | 158 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); |
160 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); | 159 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); |
161 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); | 160 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); |
162 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); | 161 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); |
163 #endif | 162 #endif |
164 } | 163 } |
165 | 164 |
166 } // namespace content | 165 } // namespace content |
OLD | NEW |