Commit 01bcb6f6 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Move webrtc_stats_report_obtainer.cc|h to Blink

This CL allows phase 7 in the design document [1], to be
executed, and including the respective unittests.

[1] https://docs.google.com/document/d/1AJKVA5U4nDkyDB9p4ROrggWXadCxyy-grKaE9KS5vOU/

BUG=787254
R=guidou@chromium.org, haraken@chromium.org

Change-Id: I0bfca719bc5de9392aaddf54c1fe4ebe21085e81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819405
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704953}
parent 31ca3d25
......@@ -14,7 +14,6 @@
#include "base/synchronization/waitable_event.h"
#include "base/test/task_environment.h"
#include "content/child/child_process.h"
#include "content/renderer/media/webrtc/test/webrtc_stats_report_obtainer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/platform/web_rtc_stats.h"
......@@ -22,6 +21,7 @@
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_dependency_factory.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_impl.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_media_stream_track_adapter_map.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_stats_report_obtainer.h"
#include "third_party/blink/public/web/web_heap.h"
#include "third_party/webrtc/api/stats/rtc_stats_report.h"
#include "third_party/webrtc/api/stats/rtcstats_objects.h"
......@@ -81,9 +81,9 @@ class RTCRtpReceiverTest : public ::testing::Test {
std::move(state));
}
scoped_refptr<WebRTCStatsReportObtainer> GetStats() {
scoped_refptr<WebRTCStatsReportObtainer> obtainer =
new WebRTCStatsReportObtainer();
scoped_refptr<blink::WebRTCStatsReportObtainer> GetStats() {
scoped_refptr<blink::WebRTCStatsReportObtainer> obtainer =
new blink::WebRTCStatsReportObtainer();
receiver_->GetStats(obtainer->GetStatsCallbackWrapper(), {});
return obtainer;
}
......
......@@ -13,7 +13,6 @@
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "content/child/child_process.h"
#include "content/renderer/media/webrtc/test/webrtc_stats_report_obtainer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_source.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
......@@ -25,6 +24,7 @@
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_dependency_factory.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_impl.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_media_stream_track_adapter_map.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_stats_report_obtainer.h"
#include "third_party/blink/public/web/web_heap.h"
#include "third_party/webrtc/api/stats/rtc_stats_report.h"
#include "third_party/webrtc/api/stats/rtcstats_objects.h"
......@@ -119,9 +119,9 @@ class RTCRtpSenderTest : public ::testing::Test {
std::move(run_loop));
}
scoped_refptr<WebRTCStatsReportObtainer> CallGetStats() {
scoped_refptr<WebRTCStatsReportObtainer> obtainer =
new WebRTCStatsReportObtainer();
scoped_refptr<blink::WebRTCStatsReportObtainer> CallGetStats() {
scoped_refptr<blink::WebRTCStatsReportObtainer> obtainer =
new blink::WebRTCStatsReportObtainer();
sender_->GetStats(obtainer->GetStatsCallbackWrapper(), {});
return obtainer;
}
......
......@@ -235,8 +235,6 @@ jumbo_static_library("test_support") {
"../public/test/web_contents_tester.h",
"../renderer/media/webrtc/mock_web_rtc_peer_connection_handler_client.cc",
"../renderer/media/webrtc/mock_web_rtc_peer_connection_handler_client.h",
"../renderer/media/webrtc/test/webrtc_stats_report_obtainer.cc",
"../renderer/media/webrtc/test/webrtc_stats_report_obtainer.h",
"appcache_test_helper.cc",
"appcache_test_helper.h",
"barrier_builder.cc",
......
......@@ -111,6 +111,7 @@ source_set("test_headers") {
"web/modules/peerconnection/mock_data_channel_impl.h",
"web/modules/peerconnection/mock_peer_connection_dependency_factory.h",
"web/modules/peerconnection/mock_peer_connection_impl.h",
"web/modules/peerconnection/webrtc_stats_report_obtainer.h",
]
deps = [
":blink_headers",
......
......@@ -8,5 +8,11 @@ include_rules = [
"+base/single_thread_task_runner.h",
"+base/synchronization/waitable_event.h",
"+base/threading/thread.h",
"+testing/gmock/include/gmock/gmock.h",
]
specific_include_rules = {
".*obtainer\.h|mock.*\.h": [
"+base/run_loop.h",
"+testing/gmock/include/gmock/gmock.h",
],
}
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_WEBRTC_TEST_WEBRTC_STATS_REPORT_OBTAINER_H_
#define CONTENT_RENDERER_MEDIA_WEBRTC_TEST_WEBRTC_STATS_REPORT_OBTAINER_H_
#ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_WEBRTC_STATS_REPORT_OBTAINER_H_
#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_WEBRTC_STATS_REPORT_OBTAINER_H_
#include <memory>
......@@ -11,7 +11,7 @@
#include "base/run_loop.h"
#include "third_party/blink/public/platform/web_rtc_stats.h"
namespace content {
namespace blink {
// The obtainer is a test-only helper class capable of waiting for a GetStats()
// callback to be called. It takes ownership of and exposes the resulting
......@@ -20,6 +20,9 @@ namespace content {
// thread are executed (see base::RunLoop::Run()) making it safe to wait on the
// same thread that the stats report callback occurs on without blocking the
// callback.
//
// TODO(crbug.com/787254): Move this class out of the Blink API
// when all its clients get Onion souped.
class WebRTCStatsReportObtainer
: public base::RefCountedThreadSafe<WebRTCStatsReportObtainer> {
public:
......@@ -41,6 +44,6 @@ class WebRTCStatsReportObtainer
std::unique_ptr<blink::WebRTCStatsReport> report_;
};
} // namespace content
} // namespace blink
#endif // CONTENT_RENDERER_MEDIA_WEBRTC_TEST_WEBRTC_STATS_REPORT_OBTAINER_H_
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_WEBRTC_STATS_REPORT_OBTAINER_H_
......@@ -144,6 +144,7 @@ jumbo_source_set("test_support") {
"mock_data_channel_impl.cc",
"mock_peer_connection_dependency_factory.cc",
"mock_peer_connection_impl.cc",
"webrtc_stats_report_obtainer.cc",
]
deps = [
......
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/media/webrtc/test/webrtc_stats_report_obtainer.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_stats_report_obtainer.h"
#include "base/bind.h"
#include "base/callback.h"
namespace content {
namespace blink {
WebRTCStatsReportObtainer::WebRTCStatsReportObtainer() {}
......@@ -33,4 +33,4 @@ void WebRTCStatsReportObtainer::OnStatsDelivered(
run_loop_.Quit();
}
} // namespace content
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment