| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" | 14 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
| 15 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" | 15 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" |
| 16 #include "webrtc/api/datachannelinterface.h" | 16 #include "webrtc/api/datachannelinterface.h" |
| 17 #include "webrtc/api/peerconnectioninterface.h" | 17 #include "webrtc/api/peerconnectioninterface.h" |
| 18 #include "webrtc/api/stats/rtcstats_objects.h" | 18 #include "webrtc/api/stats/rtcstats_objects.h" |
| 19 #include "webrtc/api/stats/rtcstatsreport.h" | 19 #include "webrtc/api/stats/rtcstatsreport.h" |
| 20 #include "webrtc/pc/test/peerconnectiontestwrapper.h" | 20 #include "webrtc/pc/test/peerconnectiontestwrapper.h" |
| 21 #include "webrtc/pc/test/rtcstatsobtainer.h" | 21 #include "webrtc/pc/test/rtcstatsobtainer.h" |
| 22 #include "webrtc/rtc_base/checks.h" | 22 #include "webrtc/rtc_base/checks.h" |
| 23 #include "webrtc/rtc_base/event_tracer.h" |
| 23 #include "webrtc/rtc_base/gunit.h" | 24 #include "webrtc/rtc_base/gunit.h" |
| 24 #include "webrtc/rtc_base/refcountedobject.h" | 25 #include "webrtc/rtc_base/refcountedobject.h" |
| 25 #include "webrtc/rtc_base/scoped_ref_ptr.h" | 26 #include "webrtc/rtc_base/scoped_ref_ptr.h" |
| 26 #include "webrtc/rtc_base/virtualsocketserver.h" | 27 #include "webrtc/rtc_base/virtualsocketserver.h" |
| 27 | 28 |
| 28 namespace webrtc { | 29 namespace webrtc { |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 const int64_t kGetStatsTimeoutMs = 10000; | 33 const int64_t kGetStatsTimeoutMs = 10000; |
| 33 | 34 |
| 35 const unsigned char* GetCategoryEnabledHandler(const char* name) { |
| 36 return reinterpret_cast<const unsigned char*>("webrtc_stats"); |
| 37 } |
| 38 |
| 39 void AddTraceEventHandler(char phase, |
| 40 const unsigned char* category_enabled, |
| 41 const char* name, |
| 42 unsigned long long id, |
| 43 int num_args, |
| 44 const char** arg_names, |
| 45 const unsigned char* arg_types, |
| 46 const unsigned long long* arg_values, |
| 47 unsigned char flags) { |
| 48 // Do nothing |
| 49 } |
| 50 |
| 34 class RTCStatsIntegrationTest : public testing::Test { | 51 class RTCStatsIntegrationTest : public testing::Test { |
| 35 public: | 52 public: |
| 36 RTCStatsIntegrationTest() | 53 RTCStatsIntegrationTest() |
| 37 : network_thread_(new rtc::Thread(&virtual_socket_server_)), | 54 : network_thread_(new rtc::Thread(&virtual_socket_server_)), |
| 38 worker_thread_(rtc::Thread::Create()) { | 55 worker_thread_(rtc::Thread::Create()) { |
| 56 SetupEventTracer(&GetCategoryEnabledHandler, &AddTraceEventHandler); |
| 57 |
| 39 RTC_CHECK(network_thread_->Start()); | 58 RTC_CHECK(network_thread_->Start()); |
| 40 RTC_CHECK(worker_thread_->Start()); | 59 RTC_CHECK(worker_thread_->Start()); |
| 41 | 60 |
| 42 caller_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( | 61 caller_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( |
| 43 "caller", network_thread_.get(), worker_thread_.get()); | 62 "caller", network_thread_.get(), worker_thread_.get()); |
| 44 callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( | 63 callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( |
| 45 "callee", network_thread_.get(), worker_thread_.get()); | 64 "callee", network_thread_.get(), worker_thread_.get()); |
| 46 } | 65 } |
| 47 | 66 |
| 48 void StartCall() { | 67 void StartCall() { |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 caller_ = nullptr; | 669 caller_ = nullptr; |
| 651 // Any pending stats requests should have completed in the act of destroying | 670 // Any pending stats requests should have completed in the act of destroying |
| 652 // the peer connection. | 671 // the peer connection. |
| 653 EXPECT_TRUE(stats_obtainer->report()); | 672 EXPECT_TRUE(stats_obtainer->report()); |
| 654 } | 673 } |
| 655 #endif // HAVE_SCTP | 674 #endif // HAVE_SCTP |
| 656 | 675 |
| 657 } // namespace | 676 } // namespace |
| 658 | 677 |
| 659 } // namespace webrtc | 678 } // namespace webrtc |
| OLD | NEW |