| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 21 matching lines...) Expand all Loading... |
| 32 #include "talk/app/webrtc/statscollector.h" | 32 #include "talk/app/webrtc/statscollector.h" |
| 33 | 33 |
| 34 #include "talk/app/webrtc/mediastream.h" | 34 #include "talk/app/webrtc/mediastream.h" |
| 35 #include "talk/app/webrtc/mediastreaminterface.h" | 35 #include "talk/app/webrtc/mediastreaminterface.h" |
| 36 #include "talk/app/webrtc/mediastreamsignaling.h" | 36 #include "talk/app/webrtc/mediastreamsignaling.h" |
| 37 #include "talk/app/webrtc/mediastreamtrack.h" | 37 #include "talk/app/webrtc/mediastreamtrack.h" |
| 38 #include "talk/app/webrtc/test/fakedatachannelprovider.h" | 38 #include "talk/app/webrtc/test/fakedatachannelprovider.h" |
| 39 #include "talk/app/webrtc/test/fakemediastreamsignaling.h" | 39 #include "talk/app/webrtc/test/fakemediastreamsignaling.h" |
| 40 #include "talk/app/webrtc/videotrack.h" | 40 #include "talk/app/webrtc/videotrack.h" |
| 41 #include "talk/media/base/fakemediaengine.h" | 41 #include "talk/media/base/fakemediaengine.h" |
| 42 #include "talk/media/devices/fakedevicemanager.h" | |
| 43 #include "talk/session/media/channelmanager.h" | 42 #include "talk/session/media/channelmanager.h" |
| 44 #include "testing/gmock/include/gmock/gmock.h" | 43 #include "testing/gmock/include/gmock/gmock.h" |
| 45 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
| 46 #include "webrtc/base/base64.h" | 45 #include "webrtc/base/base64.h" |
| 47 #include "webrtc/base/fakesslidentity.h" | 46 #include "webrtc/base/fakesslidentity.h" |
| 48 #include "webrtc/base/gunit.h" | 47 #include "webrtc/base/gunit.h" |
| 49 #include "webrtc/base/network.h" | 48 #include "webrtc/base/network.h" |
| 50 #include "webrtc/p2p/base/faketransportcontroller.h" | 49 #include "webrtc/p2p/base/faketransportcontroller.h" |
| 51 | 50 |
| 52 using rtc::scoped_ptr; | 51 using rtc::scoped_ptr; |
| 53 using testing::_; | 52 using testing::_; |
| 54 using testing::DoAll; | 53 using testing::DoAll; |
| 55 using testing::Field; | 54 using testing::Field; |
| 56 using testing::Return; | 55 using testing::Return; |
| 57 using testing::ReturnNull; | 56 using testing::ReturnNull; |
| 58 using testing::SetArgPointee; | 57 using testing::SetArgPointee; |
| 59 using webrtc::PeerConnectionInterface; | 58 using webrtc::PeerConnectionInterface; |
| 60 using webrtc::StatsReport; | 59 using webrtc::StatsReport; |
| 61 using webrtc::StatsReports; | 60 using webrtc::StatsReports; |
| 62 | 61 |
| 63 namespace cricket { | 62 namespace cricket { |
| 64 | 63 |
| 65 class ChannelManager; | 64 class ChannelManager; |
| 66 class FakeDeviceManager; | |
| 67 | 65 |
| 68 } // namespace cricket | 66 } // namespace cricket |
| 69 | 67 |
| 70 namespace webrtc { | 68 namespace webrtc { |
| 71 | 69 |
| 72 // Error return values | 70 // Error return values |
| 73 const char kNotFound[] = "NOT FOUND"; | 71 const char kNotFound[] = "NOT FOUND"; |
| 74 | 72 |
| 75 // Constant names for track identification. | 73 // Constant names for track identification. |
| 76 const char kLocalTrackId[] = "local_track_id"; | 74 const char kLocalTrackId[] = "local_track_id"; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 477 |
| 480 private: | 478 private: |
| 481 double time_now_; | 479 double time_now_; |
| 482 }; | 480 }; |
| 483 | 481 |
| 484 class StatsCollectorTest : public testing::Test { | 482 class StatsCollectorTest : public testing::Test { |
| 485 protected: | 483 protected: |
| 486 StatsCollectorTest() | 484 StatsCollectorTest() |
| 487 : media_engine_(new cricket::FakeMediaEngine()), | 485 : media_engine_(new cricket::FakeMediaEngine()), |
| 488 channel_manager_( | 486 channel_manager_( |
| 489 new cricket::ChannelManager(media_engine_, | 487 new cricket::ChannelManager(media_engine_, rtc::Thread::Current())), |
| 490 new cricket::FakeDeviceManager(), | |
| 491 rtc::Thread::Current())), | |
| 492 session_(channel_manager_.get()), | 488 session_(channel_manager_.get()), |
| 493 signaling_(channel_manager_.get()) { | 489 signaling_(channel_manager_.get()) { |
| 494 // By default, we ignore session GetStats calls. | 490 // By default, we ignore session GetStats calls. |
| 495 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); | 491 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); |
| 496 EXPECT_CALL(session_, mediastream_signaling()).WillRepeatedly( | 492 EXPECT_CALL(session_, mediastream_signaling()).WillRepeatedly( |
| 497 Return(&signaling_)); | 493 Return(&signaling_)); |
| 498 } | 494 } |
| 499 | 495 |
| 500 ~StatsCollectorTest() {} | 496 ~StatsCollectorTest() {} |
| 501 | 497 |
| (...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 cricket::VoiceSenderInfo new_voice_sender_info; | 1725 cricket::VoiceSenderInfo new_voice_sender_info; |
| 1730 InitVoiceSenderInfo(&new_voice_sender_info); | 1726 InitVoiceSenderInfo(&new_voice_sender_info); |
| 1731 cricket::VoiceMediaInfo new_stats_read; | 1727 cricket::VoiceMediaInfo new_stats_read; |
| 1732 reports.clear(); | 1728 reports.clear(); |
| 1733 SetupAndVerifyAudioTrackStats( | 1729 SetupAndVerifyAudioTrackStats( |
| 1734 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1730 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, |
| 1735 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); | 1731 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); |
| 1736 } | 1732 } |
| 1737 | 1733 |
| 1738 } // namespace webrtc | 1734 } // namespace webrtc |
| OLD | NEW |