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

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

Issue 2561263002: [eme] Reject CDM calls after connection error (Closed)
Patch Set: nit (+rebase for MediaKeys rename) 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
« no previous file with comments | « media/base/mock_filters.h ('k') | media/mojo/clients/mojo_cdm.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 (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;
11 using ::testing::NotNull;
12 using ::testing::Return; 10 using ::testing::Return;
11 using ::testing::SaveArg;
12
13 MATCHER(NotEmpty, "") {
14 return !arg.empty();
15 }
13 16
14 namespace media { 17 namespace media {
15 18
16 MockPipelineClient::MockPipelineClient() {} 19 MockPipelineClient::MockPipelineClient() {}
17 MockPipelineClient::~MockPipelineClient() {} 20 MockPipelineClient::~MockPipelineClient() {}
18 21
19 MockPipeline::MockPipeline() {} 22 MockPipeline::MockPipeline() {}
20 MockPipeline::~MockPipeline() {} 23 MockPipeline::~MockPipeline() {}
21 24
22 void MockPipeline::Start(Demuxer* demuxer, 25 void MockPipeline::Start(Demuxer* demuxer,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 MockCdmContext::~MockCdmContext() {} 142 MockCdmContext::~MockCdmContext() {}
140 143
141 int MockCdmContext::GetCdmId() const { 144 int MockCdmContext::GetCdmId() const {
142 return cdm_id_; 145 return cdm_id_;
143 } 146 }
144 147
145 void MockCdmContext::set_cdm_id(int cdm_id) { 148 void MockCdmContext::set_cdm_id(int cdm_id) {
146 cdm_id_ = cdm_id; 149 cdm_id_ = cdm_id;
147 } 150 }
148 151
152 MockCdmPromise::MockCdmPromise(bool expect_success) {
153 if (expect_success) {
154 EXPECT_CALL(*this, resolve());
155 EXPECT_CALL(*this, reject(_, _, _)).Times(0);
156 } else {
157 EXPECT_CALL(*this, resolve()).Times(0);
158 EXPECT_CALL(*this, reject(_, _, NotEmpty()));
159 }
160 }
161
162 MockCdmPromise::~MockCdmPromise() {
163 // The EXPECT calls will verify that the promise is in fact fulfilled.
164 MarkPromiseSettled();
165 }
166
167 MockCdmSessionPromise::MockCdmSessionPromise(bool expect_success,
168 std::string* new_session_id) {
169 if (expect_success) {
170 EXPECT_CALL(*this, resolve(_)).WillOnce(SaveArg<0>(new_session_id));
171 EXPECT_CALL(*this, reject(_, _, _)).Times(0);
172 } else {
173 EXPECT_CALL(*this, resolve(_)).Times(0);
174 EXPECT_CALL(*this, reject(_, _, NotEmpty()));
175 }
176 }
177
178 MockCdmSessionPromise::~MockCdmSessionPromise() {
179 // The EXPECT calls will verify that the promise is in fact fulfilled.
180 MarkPromiseSettled();
181 }
182
149 MockStreamParser::MockStreamParser() {} 183 MockStreamParser::MockStreamParser() {}
150 184
151 MockStreamParser::~MockStreamParser() {} 185 MockStreamParser::~MockStreamParser() {}
152 186
153 } // namespace media 187 } // namespace media
OLDNEW
« no previous file with comments | « media/base/mock_filters.h ('k') | media/mojo/clients/mojo_cdm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698