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

Side by Side Diff: media/base/mock_filters.cc

Issue 2561263002: [eme] Reject CDM calls after connection error (Closed)
Patch Set: changes Created 4 years 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
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 "media/base/mock_filters.h" 5 #include "media/base/mock_filters.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 using ::testing::_; 9 using ::testing::_;
10 using ::testing::Invoke; 10 using ::testing::Invoke;
11 using ::testing::NotNull; 11 using ::testing::NotNull;
12 using ::testing::Return; 12 using ::testing::Return;
13 using ::testing::SaveArg;
14 using ::testing::WithoutArgs;
15
16 MATCHER(NotEmpty, "") {
17 return !arg.empty();
18 }
13 19
14 namespace media { 20 namespace media {
15 21
16 MockPipelineClient::MockPipelineClient() {} 22 MockPipelineClient::MockPipelineClient() {}
17 MockPipelineClient::~MockPipelineClient() {} 23 MockPipelineClient::~MockPipelineClient() {}
18 24
19 MockPipeline::MockPipeline() {} 25 MockPipeline::MockPipeline() {}
20 MockPipeline::~MockPipeline() {} 26 MockPipeline::~MockPipeline() {}
21 27
22 void MockPipeline::Start(Demuxer* demuxer, 28 void MockPipeline::Start(Demuxer* demuxer,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 149 }
144 150
145 void MockCdmContext::set_cdm_id(int cdm_id) { 151 void MockCdmContext::set_cdm_id(int cdm_id) {
146 cdm_id_ = cdm_id; 152 cdm_id_ = cdm_id;
147 } 153 }
148 154
149 MockStreamParser::MockStreamParser() {} 155 MockStreamParser::MockStreamParser() {}
150 156
151 MockStreamParser::~MockStreamParser() {} 157 MockStreamParser::~MockStreamParser() {}
152 158
159 MockCdmPromise::MockCdmPromise(bool expect_success) {
160 if (expect_success) {
161 EXPECT_CALL(*this, resolve())
162 .WillOnce(
163 WithoutArgs(Invoke(this, &MockCdmPromise::MarkPromiseSettled)));
164 EXPECT_CALL(*this, reject(_, _, _)).Times(0);
165 } else {
166 EXPECT_CALL(*this, resolve()).Times(0);
167 EXPECT_CALL(*this, reject(_, _, NotEmpty()))
168 .WillOnce(
169 WithoutArgs(Invoke(this, &MockCdmPromise::MarkPromiseSettled)));
170 }
171 }
172
173 MockCdmPromise::~MockCdmPromise() {}
174
175 MockCdmSessionPromise::MockCdmSessionPromise(bool expect_success,
176 std::string* new_session_id) {
177 if (expect_success) {
178 EXPECT_CALL(*this, resolve(_))
179 .WillOnce(
180 DoAll(SaveArg<0>(new_session_id),
181 WithoutArgs(Invoke(
182 this, &MockCdmSessionPromise::MarkPromiseSettled))));
183 EXPECT_CALL(*this, reject(_, _, _)).Times(0);
184 } else {
185 EXPECT_CALL(*this, resolve(_)).Times(0);
186 EXPECT_CALL(*this, reject(_, _, NotEmpty()))
187 .WillOnce(WithoutArgs(
188 Invoke(this, &MockCdmSessionPromise::MarkPromiseSettled)));
189 }
190 }
191
192 MockCdmSessionPromise::~MockCdmSessionPromise() {}
193
153 } // namespace media 194 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698