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

Unified Diff: webrtc/pc/rtcstats_integrationtest.cc

Issue 3001683002: Revert of Trace the stats report as JSON instead of each stat separately. (Closed)
Patch Set: Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/pc/rtcstatscollector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/rtcstats_integrationtest.cc
diff --git a/webrtc/pc/rtcstats_integrationtest.cc b/webrtc/pc/rtcstats_integrationtest.cc
index d6326f6beaa4f8f7540a4b44f3701687cb3be4a9..56a4ef11edae0c74339569cd760b1cc530986a6c 100644
--- a/webrtc/pc/rtcstats_integrationtest.cc
+++ b/webrtc/pc/rtcstats_integrationtest.cc
@@ -24,7 +24,6 @@
#include "webrtc/rtc_base/gunit.h"
#include "webrtc/rtc_base/refcountedobject.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h"
-#include "webrtc/rtc_base/trace_event.h"
#include "webrtc/rtc_base/virtualsocketserver.h"
namespace webrtc {
@@ -34,62 +33,27 @@
const int64_t kGetStatsTimeoutMs = 10000;
const unsigned char* GetCategoryEnabledHandler(const char* name) {
- if (strcmp("webrtc_stats", name) != 0) {
- return reinterpret_cast<const unsigned char*>("");
- }
- return reinterpret_cast<const unsigned char*>(name);
+ return reinterpret_cast<const unsigned char*>("webrtc_stats");
}
-class RTCStatsReportTraceListener {
- public:
- static void SetUp() {
- if (!traced_report_)
- traced_report_ = new RTCStatsReportTraceListener();
- traced_report_->last_trace_ = "";
- SetupEventTracer(&GetCategoryEnabledHandler,
- &RTCStatsReportTraceListener::AddTraceEventHandler);
- }
-
- static const std::string& last_trace() {
- RTC_DCHECK(traced_report_);
- return traced_report_->last_trace_;
- }
-
- private:
- static void AddTraceEventHandler(char phase,
- const unsigned char* category_enabled,
- const char* name,
- unsigned long long id,
- int num_args,
- const char** arg_names,
- const unsigned char* arg_types,
- const unsigned long long* arg_values,
- unsigned char flags) {
- RTC_DCHECK(traced_report_);
- EXPECT_EQ(traced_report_->last_trace_, "");
- EXPECT_STREQ("webrtc_stats",
- reinterpret_cast<const char*>(category_enabled));
- EXPECT_STREQ("webrtc_stats", name);
- EXPECT_EQ(1, num_args);
- EXPECT_STREQ("report", arg_names[0]);
- EXPECT_EQ(TRACE_VALUE_TYPE_COPY_STRING, arg_types[0]);
-
- traced_report_->last_trace_ = reinterpret_cast<const char*>(arg_values[0]);
- }
-
- static RTCStatsReportTraceListener* traced_report_;
- std::string last_trace_;
-};
-
-RTCStatsReportTraceListener* RTCStatsReportTraceListener::traced_report_ =
- nullptr;
+void AddTraceEventHandler(char phase,
+ const unsigned char* category_enabled,
+ const char* name,
+ unsigned long long id,
+ int num_args,
+ const char** arg_names,
+ const unsigned char* arg_types,
+ const unsigned long long* arg_values,
+ unsigned char flags) {
+ // Do nothing
+}
class RTCStatsIntegrationTest : public testing::Test {
public:
RTCStatsIntegrationTest()
: network_thread_(new rtc::Thread(&virtual_socket_server_)),
worker_thread_(rtc::Thread::Create()) {
- RTCStatsReportTraceListener::SetUp();
+ SetupEventTracer(&GetCategoryEnabledHandler, &AddTraceEventHandler);
RTC_CHECK(network_thread_->Start());
RTC_CHECK(worker_thread_->Start());
@@ -686,7 +650,6 @@
rtc::scoped_refptr<const RTCStatsReport> report = GetStatsFromCaller();
RTCStatsReportVerifier(report.get()).VerifyReport();
- EXPECT_EQ(report->ToJson(), RTCStatsReportTraceListener::last_trace());
}
TEST_F(RTCStatsIntegrationTest, GetStatsFromCallee) {
@@ -694,7 +657,6 @@
rtc::scoped_refptr<const RTCStatsReport> report = GetStatsFromCallee();
RTCStatsReportVerifier(report.get()).VerifyReport();
- EXPECT_EQ(report->ToJson(), RTCStatsReportTraceListener::last_trace());
}
TEST_F(RTCStatsIntegrationTest, GetsStatsWhileDestroyingPeerConnections) {
@@ -708,8 +670,6 @@
// Any pending stats requests should have completed in the act of destroying
// the peer connection.
EXPECT_TRUE(stats_obtainer->report());
- EXPECT_EQ(stats_obtainer->report()->ToJson(),
- RTCStatsReportTraceListener::last_trace());
}
#endif // HAVE_SCTP
« no previous file with comments | « no previous file | webrtc/pc/rtcstatscollector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698