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

Switch MediaStreamVideoWebRTCSinkTest to operate over MediaStreamComponent

... instead of WebMediaStreamTrack.

This is part of the effort to reduce the needless use of
public Blink APIs (wrappers) within renderer/modules.

Additionally, CL also removes the left-over use of
WebMediaStream in MockMediaStreamRegistry.

BUG=704136
R=guidou@chromium.org

Change-Id: I4c033e3460d30df7ad3fd0f2850e5e151fa685a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2254087
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780771}
parent 0115e76c
......@@ -8,7 +8,6 @@
#include <string>
#include "base/optional.h"
#include "third_party/blink/public/platform/web_media_stream.h"
#include "third_party/blink/renderer/modules/mediastream/mock_media_stream_video_source.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_descriptor.h"
......@@ -35,11 +34,7 @@ class MockMediaStreamRegistry final {
MockMediaStreamVideoSource* AddVideoTrack(const std::string& track_id);
void AddAudioTrack(const std::string& track_id);
// TODO(https://crbug.com/704136): Switch to return MediaStreamDescriptor and
// rename this method.
const WebMediaStream test_stream() const {
return WebMediaStream(descriptor_);
}
MediaStreamDescriptor* test_stream() const { return descriptor_.Get(); }
void reset() { descriptor_ = nullptr; }
......
......@@ -9,6 +9,7 @@
#include "third_party/blink/renderer/modules/mediastream/mock_media_stream_registry.h"
#include "third_party/blink/renderer/modules/mediastream/video_track_adapter_settings.h"
#include "third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_component.h"
#include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h"
namespace blink {
......@@ -18,10 +19,9 @@ class MediaStreamVideoWebRtcSinkTest : public ::testing::Test {
void SetVideoTrack() {
registry_.Init();
registry_.AddVideoTrack("test video track");
blink::WebVector<blink::WebMediaStreamTrack> video_tracks =
registry_.test_stream().VideoTracks();
track_ = video_tracks[0];
// TODO(hta): Verify that track_ is valid. When constraints produce
auto video_components = registry_.test_stream()->VideoComponents();
component_ = video_components[0];
// TODO(hta): Verify that component_ is valid. When constraints produce
// no valid format, using the track will cause a crash.
}
......@@ -30,15 +30,14 @@ class MediaStreamVideoWebRtcSinkTest : public ::testing::Test {
registry_.AddVideoTrack("test video track",
blink::VideoTrackAdapterSettings(), noise_reduction,
false, 0.0);
blink::WebVector<blink::WebMediaStreamTrack> video_tracks =
registry_.test_stream().VideoTracks();
track_ = video_tracks[0];
// TODO(hta): Verify that track_ is valid. When constraints produce
auto video_components = registry_.test_stream()->VideoComponents();
component_ = video_components[0];
// TODO(hta): Verify that component_ is valid. When constraints produce
// no valid format, using the track will cause a crash.
}
protected:
blink::WebMediaStreamTrack track_;
Persistent<MediaStreamComponent> component_;
blink::MockPeerConnectionDependencyFactory dependency_factory_;
private:
......@@ -50,7 +49,7 @@ class MediaStreamVideoWebRtcSinkTest : public ::testing::Test {
TEST_F(MediaStreamVideoWebRtcSinkTest, NoiseReductionDefaultsToNotSet) {
SetVideoTrack();
blink::MediaStreamVideoWebRtcSink my_sink(
track_, &dependency_factory_,
component_.Get(), &dependency_factory_,
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
EXPECT_TRUE(my_sink.webrtc_video_track());
EXPECT_FALSE(my_sink.SourceNeedsDenoisingForTesting());
......
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