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

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/codec_owner_unittest.cc

Issue 1331793003: MockAudioEncoder: Use a dedicated marker method for test expectations (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 | « webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h ('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 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 AudioEncoder::EncodedInfo info; 108 AudioEncoder::EncodedInfo info;
109 EXPECT_CALL(external_encoder, SampleRateHz()) 109 EXPECT_CALL(external_encoder, SampleRateHz())
110 .WillRepeatedly(Return(kSampleRateHz)); 110 .WillRepeatedly(Return(kSampleRateHz));
111 111
112 { 112 {
113 InSequence s; 113 InSequence s;
114 info.encoded_timestamp = 0; 114 info.encoded_timestamp = 0;
115 EXPECT_CALL(external_encoder, 115 EXPECT_CALL(external_encoder,
116 EncodeInternal(0, audio, arraysize(encoded), encoded)) 116 EncodeInternal(0, audio, arraysize(encoded), encoded))
117 .WillOnce(Return(info)); 117 .WillOnce(Return(info));
118 EXPECT_CALL(external_encoder, Reset()); 118 EXPECT_CALL(external_encoder, Mark("A"));
119 EXPECT_CALL(external_encoder, Reset()); 119 EXPECT_CALL(external_encoder, Mark("B"));
120 info.encoded_timestamp = 2; 120 info.encoded_timestamp = 2;
121 EXPECT_CALL(external_encoder, 121 EXPECT_CALL(external_encoder,
122 EncodeInternal(2, audio, arraysize(encoded), encoded)) 122 EncodeInternal(2, audio, arraysize(encoded), encoded))
123 .WillOnce(Return(info)); 123 .WillOnce(Return(info));
124 EXPECT_CALL(external_encoder, Reset()); 124 EXPECT_CALL(external_encoder, Die());
125 } 125 }
126 126
127 info = codec_owner_.Encoder()->Encode(0, audio, arraysize(audio), 127 info = codec_owner_.Encoder()->Encode(0, audio, arraysize(audio),
128 arraysize(encoded), encoded); 128 arraysize(encoded), encoded);
129 EXPECT_EQ(0u, info.encoded_timestamp); 129 EXPECT_EQ(0u, info.encoded_timestamp);
130 external_encoder.Reset(); // Dummy call to mark the sequence of expectations. 130 external_encoder.Mark("A");
131 131
132 // Change to internal encoder. 132 // Change to internal encoder.
133 CodecInst codec_inst = kDefaultCodecInst; 133 CodecInst codec_inst = kDefaultCodecInst;
134 codec_inst.pacsize = kPacketSizeSamples; 134 codec_inst.pacsize = kPacketSizeSamples;
135 codec_owner_.SetEncoders(codec_inst, -1, VADNormal, -1); 135 codec_owner_.SetEncoders(codec_inst, -1, VADNormal, -1);
136 // Don't expect any more calls to the external encoder. 136 // Don't expect any more calls to the external encoder.
137 info = codec_owner_.Encoder()->Encode(1, audio, arraysize(audio), 137 info = codec_owner_.Encoder()->Encode(1, audio, arraysize(audio),
138 arraysize(encoded), encoded); 138 arraysize(encoded), encoded);
139 external_encoder.Reset(); // Dummy call to mark the sequence of expectations. 139 external_encoder.Mark("B");
140 140
141 // Change back to external encoder again. 141 // Change back to external encoder again.
142 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1); 142 codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1);
143 info = codec_owner_.Encoder()->Encode(2, audio, arraysize(audio), 143 info = codec_owner_.Encoder()->Encode(2, audio, arraysize(audio),
144 arraysize(encoded), encoded); 144 arraysize(encoded), encoded);
145 EXPECT_EQ(2u, info.encoded_timestamp); 145 EXPECT_EQ(2u, info.encoded_timestamp);
146 external_encoder.Reset(); // Dummy call to mark the sequence of expectations.
147 } 146 }
148 147
149 } // namespace acm2 148 } // namespace acm2
150 } // namespace webrtc 149 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698