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

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 833963003: Pass key_information on SessionKeysChange message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes Created 5 years, 11 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 | « media/mojo/services/mojo_cdm_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "media/base/cdm_callback_promise.h" 10 #include "media/base/cdm_callback_promise.h"
11 #include "media/base/cdm_context.h" 11 #include "media/base/cdm_context.h"
12 #include "media/base/cdm_key_information.h"
12 #include "media/base/decoder_buffer.h" 13 #include "media/base/decoder_buffer.h"
13 #include "media/base/media_keys.h" 14 #include "media/base/media_keys.h"
14 #include "media/base/media_switches.h" 15 #include "media/base/media_switches.h"
15 #include "media/base/test_data_util.h" 16 #include "media/base/test_data_util.h"
16 #include "media/cdm/aes_decryptor.h" 17 #include "media/cdm/aes_decryptor.h"
17 #include "media/cdm/json_web_key.h" 18 #include "media/cdm/json_web_key.h"
18 #include "media/filters/chunk_demuxer.h" 19 #include "media/filters/chunk_demuxer.h"
19 #include "media/filters/renderer_impl.h" 20 #include "media/filters/renderer_impl.h"
20 #include "media/test/pipeline_integration_test_base.h" 21 #include "media/test/pipeline_integration_test_base.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 public: 117 public:
117 virtual ~AppBase() {} 118 virtual ~AppBase() {}
118 119
119 virtual void OnSessionMessage(const std::string& web_session_id, 120 virtual void OnSessionMessage(const std::string& web_session_id,
120 const std::vector<uint8>& message, 121 const std::vector<uint8>& message,
121 const GURL& destination_url) = 0; 122 const GURL& destination_url) = 0;
122 123
123 virtual void OnSessionClosed(const std::string& web_session_id) = 0; 124 virtual void OnSessionClosed(const std::string& web_session_id) = 0;
124 125
125 virtual void OnSessionKeysChange(const std::string& web_session_id, 126 virtual void OnSessionKeysChange(const std::string& web_session_id,
126 bool has_additional_usable_key) = 0; 127 bool has_additional_usable_key,
128 CdmKeysInfo keys_info) = 0;
127 129
128 // Errors are not expected unless overridden. 130 // Errors are not expected unless overridden.
129 virtual void OnSessionError(const std::string& web_session_id, 131 virtual void OnSessionError(const std::string& web_session_id,
130 const std::string& error_name, 132 const std::string& error_name,
131 uint32 system_code, 133 uint32 system_code,
132 const std::string& error_message) { 134 const std::string& error_message) {
133 FAIL() << "Unexpected Key Error"; 135 FAIL() << "Unexpected Key Error";
134 } 136 }
135 137
136 virtual void OnEncryptedMediaInitData(const std::string& init_data_type, 138 virtual void OnEncryptedMediaInitData(const std::string& init_data_type,
(...skipping 18 matching lines...) Expand all
155 const std::vector<uint8>& message, 157 const std::vector<uint8>& message,
156 const GURL& destination_url) { 158 const GURL& destination_url) {
157 app_->OnSessionMessage(web_session_id, message, destination_url); 159 app_->OnSessionMessage(web_session_id, message, destination_url);
158 } 160 }
159 161
160 void OnSessionClosed(const std::string& web_session_id) { 162 void OnSessionClosed(const std::string& web_session_id) {
161 app_->OnSessionClosed(web_session_id); 163 app_->OnSessionClosed(web_session_id);
162 } 164 }
163 165
164 void OnSessionKeysChange(const std::string& web_session_id, 166 void OnSessionKeysChange(const std::string& web_session_id,
165 bool has_additional_usable_key) { 167 bool has_additional_usable_key,
166 app_->OnSessionKeysChange(web_session_id, has_additional_usable_key); 168 CdmKeysInfo keys_info) {
169 app_->OnSessionKeysChange(web_session_id, has_additional_usable_key,
170 keys_info.Pass());
167 } 171 }
168 172
169 void OnSessionError(const std::string& web_session_id, 173 void OnSessionError(const std::string& web_session_id,
170 const std::string& error_name, 174 const std::string& error_name,
171 uint32 system_code, 175 uint32 system_code,
172 const std::string& error_message) { 176 const std::string& error_message) {
173 app_->OnSessionError( 177 app_->OnSessionError(
174 web_session_id, error_name, system_code, error_message); 178 web_session_id, error_name, system_code, error_message);
175 } 179 }
176 180
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 EXPECT_FALSE(web_session_id.empty()); 255 EXPECT_FALSE(web_session_id.empty());
252 EXPECT_FALSE(message.empty()); 256 EXPECT_FALSE(message.empty());
253 EXPECT_EQ(current_session_id_, web_session_id); 257 EXPECT_EQ(current_session_id_, web_session_id);
254 } 258 }
255 259
256 void OnSessionClosed(const std::string& web_session_id) override { 260 void OnSessionClosed(const std::string& web_session_id) override {
257 EXPECT_EQ(current_session_id_, web_session_id); 261 EXPECT_EQ(current_session_id_, web_session_id);
258 } 262 }
259 263
260 void OnSessionKeysChange(const std::string& web_session_id, 264 void OnSessionKeysChange(const std::string& web_session_id,
261 bool has_additional_usable_key) override { 265 bool has_additional_usable_key,
266 CdmKeysInfo keys_info) override {
262 EXPECT_EQ(current_session_id_, web_session_id); 267 EXPECT_EQ(current_session_id_, web_session_id);
263 EXPECT_EQ(has_additional_usable_key, true); 268 EXPECT_EQ(has_additional_usable_key, true);
264 } 269 }
265 270
266 void OnEncryptedMediaInitData(const std::string& init_data_type, 271 void OnEncryptedMediaInitData(const std::string& init_data_type,
267 const std::vector<uint8>& init_data, 272 const std::vector<uint8>& init_data,
268 AesDecryptor* decryptor) override { 273 AesDecryptor* decryptor) override {
269 if (current_session_id_.empty()) { 274 if (current_session_id_.empty()) {
270 decryptor->CreateSession(init_data_type, kInitData, arraysize(kInitData), 275 decryptor->CreateSession(init_data_type, kInitData, arraysize(kInitData),
271 MediaKeys::TEMPORARY_SESSION, 276 MediaKeys::TEMPORARY_SESSION,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 EXPECT_FALSE(message.empty()); 381 EXPECT_FALSE(message.empty());
377 FAIL() << "Unexpected Message"; 382 FAIL() << "Unexpected Message";
378 } 383 }
379 384
380 void OnSessionClosed(const std::string& web_session_id) override { 385 void OnSessionClosed(const std::string& web_session_id) override {
381 EXPECT_FALSE(web_session_id.empty()); 386 EXPECT_FALSE(web_session_id.empty());
382 FAIL() << "Unexpected Closed"; 387 FAIL() << "Unexpected Closed";
383 } 388 }
384 389
385 void OnSessionKeysChange(const std::string& web_session_id, 390 void OnSessionKeysChange(const std::string& web_session_id,
386 bool has_additional_usable_key) override { 391 bool has_additional_usable_key,
392 CdmKeysInfo keys_info) override {
387 EXPECT_FALSE(web_session_id.empty()); 393 EXPECT_FALSE(web_session_id.empty());
388 EXPECT_EQ(has_additional_usable_key, true); 394 EXPECT_EQ(has_additional_usable_key, true);
389 } 395 }
390 396
391 void OnEncryptedMediaInitData(const std::string& init_data_type, 397 void OnEncryptedMediaInitData(const std::string& init_data_type,
392 const std::vector<uint8>& init_data, 398 const std::vector<uint8>& init_data,
393 AesDecryptor* decryptor) override {} 399 AesDecryptor* decryptor) override {}
394 }; 400 };
395 401
396 // Helper class that emulates calls made on the ChunkDemuxer by the 402 // Helper class that emulates calls made on the ChunkDemuxer by the
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 1616
1611 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 1617 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
1612 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 1618 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
1613 Play(); 1619 Play();
1614 ASSERT_TRUE(WaitUntilOnEnded()); 1620 ASSERT_TRUE(WaitUntilOnEnded());
1615 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 1621 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
1616 demuxer_->GetStartTime()); 1622 demuxer_->GetStartTime());
1617 } 1623 }
1618 1624
1619 } // namespace media 1625 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_cdm_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698