| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 |
| 11 #include "webrtc/api/dtmfsender.h" | 11 #include "webrtc/api/dtmfsender.h" |
| 12 | 12 |
| 13 #include <memory> |
| 13 #include <set> | 14 #include <set> |
| 14 #include <string> | 15 #include <string> |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "webrtc/api/audiotrack.h" | 18 #include "webrtc/api/audiotrack.h" |
| 18 #include "webrtc/base/gunit.h" | 19 #include "webrtc/base/gunit.h" |
| 19 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
| 20 #include "webrtc/base/timeutils.h" | 21 #include "webrtc/base/timeutils.h" |
| 21 | 22 |
| 22 using webrtc::AudioTrackInterface; | 23 using webrtc::AudioTrackInterface; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 std::string::const_iterator it_ref = tones_ref.begin(); | 208 std::string::const_iterator it_ref = tones_ref.begin(); |
| 208 std::vector<std::string>::const_iterator it = tones.begin(); | 209 std::vector<std::string>::const_iterator it = tones.begin(); |
| 209 while (it_ref != tones_ref.end() && it != tones.end()) { | 210 while (it_ref != tones_ref.end() && it != tones.end()) { |
| 210 EXPECT_EQ(*it_ref, it->at(0)); | 211 EXPECT_EQ(*it_ref, it->at(0)); |
| 211 ++it_ref; | 212 ++it_ref; |
| 212 ++it; | 213 ++it; |
| 213 } | 214 } |
| 214 } | 215 } |
| 215 | 216 |
| 216 rtc::scoped_refptr<AudioTrackInterface> track_; | 217 rtc::scoped_refptr<AudioTrackInterface> track_; |
| 217 rtc::scoped_ptr<FakeDtmfObserver> observer_; | 218 std::unique_ptr<FakeDtmfObserver> observer_; |
| 218 rtc::scoped_ptr<FakeDtmfProvider> provider_; | 219 std::unique_ptr<FakeDtmfProvider> provider_; |
| 219 rtc::scoped_refptr<DtmfSender> dtmf_; | 220 rtc::scoped_refptr<DtmfSender> dtmf_; |
| 220 }; | 221 }; |
| 221 | 222 |
| 222 TEST_F(DtmfSenderTest, CanInsertDtmf) { | 223 TEST_F(DtmfSenderTest, CanInsertDtmf) { |
| 223 EXPECT_TRUE(dtmf_->CanInsertDtmf()); | 224 EXPECT_TRUE(dtmf_->CanInsertDtmf()); |
| 224 provider_->RemoveCanInsertDtmfTrack(kTestAudioLabel); | 225 provider_->RemoveCanInsertDtmfTrack(kTestAudioLabel); |
| 225 EXPECT_FALSE(dtmf_->CanInsertDtmf()); | 226 EXPECT_FALSE(dtmf_->CanInsertDtmf()); |
| 226 } | 227 } |
| 227 | 228 |
| 228 TEST_F(DtmfSenderTest, InsertDtmf) { | 229 TEST_F(DtmfSenderTest, InsertDtmf) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 std::string tones = "3,4"; | 334 std::string tones = "3,4"; |
| 334 int duration = 100; | 335 int duration = 100; |
| 335 int inter_tone_gap = 50; | 336 int inter_tone_gap = 50; |
| 336 | 337 |
| 337 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 6001, inter_tone_gap)); | 338 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 6001, inter_tone_gap)); |
| 338 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 69, inter_tone_gap)); | 339 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 69, inter_tone_gap)); |
| 339 EXPECT_FALSE(dtmf_->InsertDtmf(tones, duration, 49)); | 340 EXPECT_FALSE(dtmf_->InsertDtmf(tones, duration, 49)); |
| 340 | 341 |
| 341 EXPECT_TRUE(dtmf_->InsertDtmf(tones, duration, inter_tone_gap)); | 342 EXPECT_TRUE(dtmf_->InsertDtmf(tones, duration, inter_tone_gap)); |
| 342 } | 343 } |
| OLD | NEW |