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

Side by Side Diff: media/cdm/cdm_adapter_unittest.cc

Issue 1544313002: Convert Pass()→std::move() in //media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/cdm/cdm_adapter.cc ('k') | media/cdm/json_web_key.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 scoped_ptr<SimpleCdmPromise> CreatePromise(ExpectedResult expected_result) { 170 scoped_ptr<SimpleCdmPromise> CreatePromise(ExpectedResult expected_result) {
171 if (expected_result == SUCCESS) { 171 if (expected_result == SUCCESS) {
172 EXPECT_CALL(*this, OnResolve()); 172 EXPECT_CALL(*this, OnResolve());
173 } else { 173 } else {
174 EXPECT_CALL(*this, OnReject(_, _, IsNotEmpty())); 174 EXPECT_CALL(*this, OnReject(_, _, IsNotEmpty()));
175 } 175 }
176 176
177 scoped_ptr<SimpleCdmPromise> promise(new CdmCallbackPromise<>( 177 scoped_ptr<SimpleCdmPromise> promise(new CdmCallbackPromise<>(
178 base::Bind(&CdmAdapterTest::OnResolve, base::Unretained(this)), 178 base::Bind(&CdmAdapterTest::OnResolve, base::Unretained(this)),
179 base::Bind(&CdmAdapterTest::OnReject, base::Unretained(this)))); 179 base::Bind(&CdmAdapterTest::OnReject, base::Unretained(this))));
180 return promise.Pass(); 180 return promise;
181 } 181 }
182 182
183 // Create a promise to be used when a new session is created. 183 // Create a promise to be used when a new session is created.
184 // |expected_result| is used to indicate how the promise should be fulfilled. 184 // |expected_result| is used to indicate how the promise should be fulfilled.
185 scoped_ptr<NewSessionCdmPromise> CreateSessionPromise( 185 scoped_ptr<NewSessionCdmPromise> CreateSessionPromise(
186 ExpectedResult expected_result) { 186 ExpectedResult expected_result) {
187 if (expected_result == SUCCESS) { 187 if (expected_result == SUCCESS) {
188 EXPECT_CALL(*this, OnResolveWithSession(_)) 188 EXPECT_CALL(*this, OnResolveWithSession(_))
189 .WillOnce(SaveArg<0>(&session_id_)); 189 .WillOnce(SaveArg<0>(&session_id_));
190 } else { 190 } else {
191 EXPECT_CALL(*this, OnReject(_, _, IsNotEmpty())); 191 EXPECT_CALL(*this, OnReject(_, _, IsNotEmpty()));
192 } 192 }
193 193
194 scoped_ptr<NewSessionCdmPromise> promise( 194 scoped_ptr<NewSessionCdmPromise> promise(
195 new CdmCallbackPromise<std::string>( 195 new CdmCallbackPromise<std::string>(
196 base::Bind(&CdmAdapterTest::OnResolveWithSession, 196 base::Bind(&CdmAdapterTest::OnResolveWithSession,
197 base::Unretained(this)), 197 base::Unretained(this)),
198 base::Bind(&CdmAdapterTest::OnReject, base::Unretained(this)))); 198 base::Bind(&CdmAdapterTest::OnReject, base::Unretained(this))));
199 return promise.Pass(); 199 return promise;
200 } 200 }
201 201
202 void RunUntilIdle() { message_loop_.RunUntilIdle(); } 202 void RunUntilIdle() { message_loop_.RunUntilIdle(); }
203 203
204 // Methods used for promise resolved/rejected. 204 // Methods used for promise resolved/rejected.
205 MOCK_METHOD0(OnResolve, void()); 205 MOCK_METHOD0(OnResolve, void());
206 MOCK_METHOD1(OnResolveWithSession, void(const std::string& session_id)); 206 MOCK_METHOD1(OnResolveWithSession, void(const std::string& session_id));
207 MOCK_METHOD3(OnReject, 207 MOCK_METHOD3(OnReject,
208 void(MediaKeys::Exception exception_code, 208 void(MediaKeys::Exception exception_code,
209 uint32_t system_code, 209 uint32_t system_code,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 TEST_F(CdmAdapterTest, UpdateSessionWithBadData) { 313 TEST_F(CdmAdapterTest, UpdateSessionWithBadData) {
314 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); 314 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS);
315 315
316 std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); 316 std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId));
317 CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); 317 CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS);
318 318
319 UpdateSessionAndExpect(SessionId(), "random data", FAILURE, true); 319 UpdateSessionAndExpect(SessionId(), "random data", FAILURE, true);
320 } 320 }
321 321
322 } // namespace media 322 } // namespace media
OLDNEW
« no previous file with comments | « media/cdm/cdm_adapter.cc ('k') | media/cdm/json_web_key.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698