OLD | NEW |
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 Loading... |
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 |
OLD | NEW |