Commit 70312812 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Move content/renderer/media/webrtc/mock_data_channel_impl.cc|h to Blink

This CL prepares the move of [1] to Blink, which itself blocks the move of
[2]. [2] holds the move of various headers out of the the Blink exposed
API.

[1] //content/renderer/media/webrtc/mock_peer_connection_impl.h
[2] //content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc

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

Change-Id: I576c86f2a9a5c3efbdd45a1b85ab205f6fa858bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816782
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@{#704673}
parent 34b0d610
......@@ -11,9 +11,9 @@
#include "base/logging.h"
#include "base/stl_util.h"
#include "content/renderer/media/webrtc/mock_data_channel_impl.h"
#include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h"
#include "third_party/blink/public/platform/modules/peerconnection/webrtc_util.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_data_channel_impl.h"
#include "third_party/webrtc/api/rtp_receiver_interface.h"
#include "third_party/webrtc/rtc_base/ref_counted_object.h"
......@@ -405,7 +405,7 @@ MockPeerConnectionImpl::GetReceivers() const {
rtc::scoped_refptr<webrtc::DataChannelInterface>
MockPeerConnectionImpl::CreateDataChannel(const std::string& label,
const webrtc::DataChannelInit* config) {
return new rtc::RefCountedObject<MockDataChannel>(label, config);
return new rtc::RefCountedObject<blink::MockDataChannel>(label, config);
}
bool MockPeerConnectionImpl::GetStats(
......
......@@ -25,7 +25,6 @@
#include "base/values.h"
#include "content/child/child_process.h"
#include "content/renderer/media/audio/mock_audio_device_factory.h"
#include "content/renderer/media/webrtc/mock_data_channel_impl.h"
#include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h"
#include "content/renderer/media/webrtc/mock_peer_connection_impl.h"
#include "content/renderer/media/webrtc/mock_web_rtc_peer_connection_handler_client.h"
......@@ -55,6 +54,7 @@
#include "third_party/blink/public/web/modules/mediastream/media_stream_video_track.h"
#include "third_party/blink/public/web/modules/mediastream/mock_media_stream_video_source.h"
#include "third_party/blink/public/web/modules/mediastream/processed_local_audio_source.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_data_channel_impl.h"
#include "third_party/blink/public/web/modules/webrtc/webrtc_audio_device_impl.h"
#include "third_party/blink/public/web/web_heap.h"
#include "third_party/webrtc/api/peer_connection_interface.h"
......@@ -642,7 +642,7 @@ TEST_F(RTCPeerConnectionHandlerTest, NoCallbacksToClientAfterStop) {
EXPECT_CALL(*mock_client_.get(), DidAddRemoteDataChannel(_)).Times(0);
webrtc::DataChannelInit config;
rtc::scoped_refptr<webrtc::DataChannelInterface> remote_data_channel(
new rtc::RefCountedObject<MockDataChannel>("dummy", &config));
new rtc::RefCountedObject<blink::MockDataChannel>("dummy", &config));
pc_handler_->observer()->OnDataChannel(remote_data_channel);
RunMessageLoopsUntilIdle();
......
......@@ -233,8 +233,6 @@ jumbo_static_library("test_support") {
"../public/test/web_contents_binding_set_test_binder.h",
"../public/test/web_contents_tester.cc",
"../public/test/web_contents_tester.h",
"../renderer/media/webrtc/mock_data_channel_impl.cc",
"../renderer/media/webrtc/mock_data_channel_impl.h",
"../renderer/media/webrtc/mock_peer_connection_dependency_factory.cc",
"../renderer/media/webrtc/mock_peer_connection_dependency_factory.h",
"../renderer/media/webrtc/mock_peer_connection_impl.cc",
......@@ -2111,7 +2109,6 @@ test("content_unittests") {
"//third_party/metrics_proto",
"//third_party/re2",
"//third_party/sqlite",
"//third_party/webrtc/api:libjingle_peerconnection_api",
"//third_party/webrtc/api:media_stream_interface",
"//third_party/webrtc/api:rtc_stats_api",
"//third_party/webrtc/api/task_queue:task_queue_test",
......
......@@ -34,6 +34,7 @@ group("test_support") {
":test_headers",
"//third_party/blink/renderer/modules/exported:test_support",
"//third_party/blink/renderer/modules/mediastream:test_support",
"//third_party/blink/renderer/modules/peerconnection:test_support",
"//third_party/blink/renderer/platform:test_support",
]
}
......@@ -103,12 +104,18 @@ source_set("test_headers") {
"web/modules/mediastream/mock_media_stream_registry.h",
"web/modules/mediastream/mock_media_stream_video_sink.h",
"web/modules/mediastream/mock_media_stream_video_source.h",
# TODO(crbug.com/787254): Remove the group of mock_.h files
# below when content/renderer/media/webrtc Onion souping is
# done.
"web/modules/peerconnection/mock_data_channel_impl.h",
]
deps = [
":blink_headers",
"//base:base",
"//cc:cc",
"//testing/gmock:gmock",
"//third_party/webrtc/api:libjingle_peerconnection_api",
]
}
......
......@@ -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_MOCK_DATA_CHANNEL_IMPL_H_
#define CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_DATA_CHANNEL_IMPL_H_
#ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_MOCK_DATA_CHANNEL_IMPL_H_
#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_MOCK_DATA_CHANNEL_IMPL_H_
#include <stdint.h>
......@@ -12,8 +12,10 @@
#include "base/macros.h"
#include "third_party/webrtc/api/peer_connection_interface.h"
namespace content {
namespace blink {
// TODO(crbug.com/787254): Move this class out of the Blink API
// when all its clients get Onion souped.
class MockDataChannel : public webrtc::DataChannelInterface {
public:
MockDataChannel(const std::string& label,
......@@ -52,6 +54,6 @@ class MockDataChannel : public webrtc::DataChannelInterface {
DISALLOW_COPY_AND_ASSIGN(MockDataChannel);
};
} // namespace content
} // namespace blink
#endif // CONTENT_RENDERER_MEDIA_WEBRTC_MOCK_DATA_CHANNEL_IMPL_H_
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_MOCK_DATA_CHANNEL_IMPL_H_
......@@ -136,3 +136,19 @@ blink_modules_sources("peerconnection") {
"//third_party/webrtc/api:scoped_refptr",
]
}
jumbo_source_set("test_support") {
testonly = true
sources = [
"mock_data_channel_impl.cc",
]
deps = [
"//base",
"//base/test:test_support",
"//testing/gmock",
"//third_party/blink/public:test_headers",
"//third_party/webrtc_overrides:init_webrtc",
]
}
......@@ -2,23 +2,21 @@
// 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/mock_data_channel_impl.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_data_channel_impl.h"
#include "base/logging.h"
namespace content {
namespace blink {
MockDataChannel::MockDataChannel(const std::string& label,
const webrtc::DataChannelInit* config)
const webrtc::DataChannelInit* config)
: label_(label),
reliable_(config->reliable),
state_(webrtc::DataChannelInterface::kConnecting),
config_(*config),
observer_(nullptr) {
}
observer_(nullptr) {}
MockDataChannel::~MockDataChannel() {
}
MockDataChannel::~MockDataChannel() {}
void MockDataChannel::RegisterObserver(webrtc::DataChannelObserver* observer) {
observer_ = observer;
......@@ -28,22 +26,34 @@ void MockDataChannel::UnregisterObserver() {
observer_ = nullptr;
}
std::string MockDataChannel::label() const { return label_; }
std::string MockDataChannel::label() const {
return label_;
}
bool MockDataChannel::reliable() const { return reliable_; }
bool MockDataChannel::reliable() const {
return reliable_;
}
bool MockDataChannel::ordered() const { return config_.ordered; }
bool MockDataChannel::ordered() const {
return config_.ordered;
}
std::string MockDataChannel::protocol() const { return config_.protocol; }
std::string MockDataChannel::protocol() const {
return config_.protocol;
}
bool MockDataChannel::negotiated() const { return config_.negotiated; }
bool MockDataChannel::negotiated() const {
return config_.negotiated;
}
int MockDataChannel::id() const {
NOTIMPLEMENTED();
return 0;
}
MockDataChannel::DataState MockDataChannel::state() const { return state_; }
MockDataChannel::DataState MockDataChannel::state() const {
return state_;
}
uint32_t MockDataChannel::messages_sent() const {
NOTIMPLEMENTED();
......@@ -85,4 +95,4 @@ bool MockDataChannel::Send(const webrtc::DataBuffer& buffer) {
return state_ == webrtc::DataChannelInterface::kOpen;
}
} // 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