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 @@ ...@@ -14,7 +14,6 @@
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "content/child/child_process.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 "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/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/platform/web_rtc_stats.h" #include "third_party/blink/public/platform/web_rtc_stats.h"
...@@ -22,6 +21,7 @@ ...@@ -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_dependency_factory.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_impl.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_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/blink/public/web/web_heap.h"
#include "third_party/webrtc/api/stats/rtc_stats_report.h" #include "third_party/webrtc/api/stats/rtc_stats_report.h"
#include "third_party/webrtc/api/stats/rtcstats_objects.h" #include "third_party/webrtc/api/stats/rtcstats_objects.h"
...@@ -81,9 +81,9 @@ class RTCRtpReceiverTest : public ::testing::Test { ...@@ -81,9 +81,9 @@ class RTCRtpReceiverTest : public ::testing::Test {
std::move(state)); std::move(state));
} }
scoped_refptr<WebRTCStatsReportObtainer> GetStats() { scoped_refptr<blink::WebRTCStatsReportObtainer> GetStats() {
scoped_refptr<WebRTCStatsReportObtainer> obtainer = scoped_refptr<blink::WebRTCStatsReportObtainer> obtainer =
new WebRTCStatsReportObtainer(); new blink::WebRTCStatsReportObtainer();
receiver_->GetStats(obtainer->GetStatsCallbackWrapper(), {}); receiver_->GetStats(obtainer->GetStatsCallbackWrapper(), {});
return obtainer; return obtainer;
} }
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/child/child_process.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 "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/modules/mediastream/media_stream_audio_source.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
...@@ -25,6 +24,7 @@ ...@@ -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_dependency_factory.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_impl.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_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/blink/public/web/web_heap.h"
#include "third_party/webrtc/api/stats/rtc_stats_report.h" #include "third_party/webrtc/api/stats/rtc_stats_report.h"
#include "third_party/webrtc/api/stats/rtcstats_objects.h" #include "third_party/webrtc/api/stats/rtcstats_objects.h"
...@@ -119,9 +119,9 @@ class RTCRtpSenderTest : public ::testing::Test { ...@@ -119,9 +119,9 @@ class RTCRtpSenderTest : public ::testing::Test {
std::move(run_loop)); std::move(run_loop));
} }
scoped_refptr<WebRTCStatsReportObtainer> CallGetStats() { scoped_refptr<blink::WebRTCStatsReportObtainer> CallGetStats() {
scoped_refptr<WebRTCStatsReportObtainer> obtainer = scoped_refptr<blink::WebRTCStatsReportObtainer> obtainer =
new WebRTCStatsReportObtainer(); new blink::WebRTCStatsReportObtainer();
sender_->GetStats(obtainer->GetStatsCallbackWrapper(), {}); sender_->GetStats(obtainer->GetStatsCallbackWrapper(), {});
return obtainer; return obtainer;
} }
......
...@@ -235,8 +235,6 @@ jumbo_static_library("test_support") { ...@@ -235,8 +235,6 @@ jumbo_static_library("test_support") {
"../public/test/web_contents_tester.h", "../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.cc",
"../renderer/media/webrtc/mock_web_rtc_peer_connection_handler_client.h", "../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.cc",
"appcache_test_helper.h", "appcache_test_helper.h",
"barrier_builder.cc", "barrier_builder.cc",
......
...@@ -111,6 +111,7 @@ source_set("test_headers") { ...@@ -111,6 +111,7 @@ source_set("test_headers") {
"web/modules/peerconnection/mock_data_channel_impl.h", "web/modules/peerconnection/mock_data_channel_impl.h",
"web/modules/peerconnection/mock_peer_connection_dependency_factory.h", "web/modules/peerconnection/mock_peer_connection_dependency_factory.h",
"web/modules/peerconnection/mock_peer_connection_impl.h", "web/modules/peerconnection/mock_peer_connection_impl.h",
"web/modules/peerconnection/webrtc_stats_report_obtainer.h",
] ]
deps = [ deps = [
":blink_headers", ":blink_headers",
......
...@@ -8,5 +8,11 @@ include_rules = [ ...@@ -8,5 +8,11 @@ include_rules = [
"+base/single_thread_task_runner.h", "+base/single_thread_task_runner.h",
"+base/synchronization/waitable_event.h", "+base/synchronization/waitable_event.h",
"+base/threading/thread.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 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_WEBRTC_TEST_WEBRTC_STATS_REPORT_OBTAINER_H_ #ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_WEBRTC_STATS_REPORT_OBTAINER_H_
#define CONTENT_RENDERER_MEDIA_WEBRTC_TEST_WEBRTC_STATS_REPORT_OBTAINER_H_ #define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_WEBRTC_STATS_REPORT_OBTAINER_H_
#include <memory> #include <memory>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "third_party/blink/public/platform/web_rtc_stats.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() // 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 // callback to be called. It takes ownership of and exposes the resulting
...@@ -20,6 +20,9 @@ namespace content { ...@@ -20,6 +20,9 @@ namespace content {
// thread are executed (see base::RunLoop::Run()) making it safe to wait on the // 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 // same thread that the stats report callback occurs on without blocking the
// callback. // callback.
//
// TODO(crbug.com/787254): Move this class out of the Blink API
// when all its clients get Onion souped.
class WebRTCStatsReportObtainer class WebRTCStatsReportObtainer
: public base::RefCountedThreadSafe<WebRTCStatsReportObtainer> { : public base::RefCountedThreadSafe<WebRTCStatsReportObtainer> {
public: public:
...@@ -41,6 +44,6 @@ class WebRTCStatsReportObtainer ...@@ -41,6 +44,6 @@ class WebRTCStatsReportObtainer
std::unique_ptr<blink::WebRTCStatsReport> report_; 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") { ...@@ -144,6 +144,7 @@ jumbo_source_set("test_support") {
"mock_data_channel_impl.cc", "mock_data_channel_impl.cc",
"mock_peer_connection_dependency_factory.cc", "mock_peer_connection_dependency_factory.cc",
"mock_peer_connection_impl.cc", "mock_peer_connection_impl.cc",
"webrtc_stats_report_obtainer.cc",
] ]
deps = [ deps = [
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/bind.h"
#include "base/callback.h" #include "base/callback.h"
namespace content { namespace blink {
WebRTCStatsReportObtainer::WebRTCStatsReportObtainer() {} WebRTCStatsReportObtainer::WebRTCStatsReportObtainer() {}
...@@ -33,4 +33,4 @@ void WebRTCStatsReportObtainer::OnStatsDelivered( ...@@ -33,4 +33,4 @@ void WebRTCStatsReportObtainer::OnStatsDelivered(
run_loop_.Quit(); 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