| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "talk/app/webrtc/dtmfsender.h" | 28 #include "talk/app/webrtc/dtmfsender.h" |
| 29 | 29 |
| 30 #include <set> | 30 #include <set> |
| 31 #include <string> | 31 #include <string> |
| 32 #include <vector> | 32 #include <vector> |
| 33 | 33 |
| 34 #include "talk/app/webrtc/audiotrack.h" | 34 #include "talk/app/webrtc/audiotrack.h" |
| 35 #include "webrtc/base/gunit.h" | 35 #include "webrtc/base/gunit.h" |
| 36 #include "webrtc/base/logging.h" | 36 #include "webrtc/base/logging.h" |
| 37 #include "webrtc/base/refcount.h" | |
| 38 #include "webrtc/base/timeutils.h" | 37 #include "webrtc/base/timeutils.h" |
| 39 | 38 |
| 40 using webrtc::AudioTrackInterface; | 39 using webrtc::AudioTrackInterface; |
| 41 using webrtc::AudioTrack; | 40 using webrtc::AudioTrack; |
| 42 using webrtc::DtmfProviderInterface; | 41 using webrtc::DtmfProviderInterface; |
| 43 using webrtc::DtmfSender; | 42 using webrtc::DtmfSender; |
| 44 using webrtc::DtmfSenderObserverInterface; | 43 using webrtc::DtmfSenderObserverInterface; |
| 45 | 44 |
| 46 static const char kTestAudioLabel[] = "test_audio_track"; | 45 static const char kTestAudioLabel[] = "test_audio_track"; |
| 47 static const int kMaxWaitMs = 3000; | 46 static const int kMaxWaitMs = 3000; |
| 48 | 47 |
| 49 class FakeDtmfObserver : public DtmfSenderObserverInterface, RefCountInterface { | 48 class FakeDtmfObserver : public DtmfSenderObserverInterface { |
| 50 public: | 49 public: |
| 51 FakeDtmfObserver() : completed_(false) {} | 50 FakeDtmfObserver() : completed_(false) {} |
| 52 | 51 |
| 53 // Implements DtmfSenderObserverInterface. | 52 // Implements DtmfSenderObserverInterface. |
| 54 void OnToneChange(const std::string& tone) override { | 53 void OnToneChange(const std::string& tone) override { |
| 55 LOG(LS_VERBOSE) << "FakeDtmfObserver::OnToneChange '" << tone << "'."; | 54 LOG(LS_VERBOSE) << "FakeDtmfObserver::OnToneChange '" << tone << "'."; |
| 56 tones_.push_back(tone); | 55 tones_.push_back(tone); |
| 57 if (tone.empty()) { | 56 if (tone.empty()) { |
| 58 completed_ = true; | 57 completed_ = true; |
| 59 } | 58 } |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 std::string tones = "3,4"; | 350 std::string tones = "3,4"; |
| 352 int duration = 100; | 351 int duration = 100; |
| 353 int inter_tone_gap = 50; | 352 int inter_tone_gap = 50; |
| 354 | 353 |
| 355 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 6001, inter_tone_gap)); | 354 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 6001, inter_tone_gap)); |
| 356 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 69, inter_tone_gap)); | 355 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 69, inter_tone_gap)); |
| 357 EXPECT_FALSE(dtmf_->InsertDtmf(tones, duration, 49)); | 356 EXPECT_FALSE(dtmf_->InsertDtmf(tones, duration, 49)); |
| 358 | 357 |
| 359 EXPECT_TRUE(dtmf_->InsertDtmf(tones, duration, inter_tone_gap)); | 358 EXPECT_TRUE(dtmf_->InsertDtmf(tones, duration, inter_tone_gap)); |
| 360 } | 359 } |
| OLD | NEW |