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

Unified Diff: content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc

Issue 2872913003: Do not pass the origin to MediaDevicesDispatcherHost. (Closed)
Patch Set: fix Created 3 years, 7 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
Index: content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
index 488ea461cf37acfb30dfce353b074fa025d7a080..310a09ffdd839b87205ce5ddee91c9f01684e163 100644
--- a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
@@ -90,6 +90,7 @@ class MediaDevicesDispatcherHostTest : public testing::Test {
host_ = base::MakeUnique<MediaDevicesDispatcherHost>(
kProcessId, kRenderId, browser_context_.GetMediaDeviceIDSalt(),
media_stream_manager_.get());
+ host_->SetSecurityOriginForTesting(origin_);
}
void SetUp() override {
@@ -157,8 +158,8 @@ class MediaDevicesDispatcherHostTest : public testing::Test {
base::RunLoop run_loop;
host_->EnumerateDevices(
enumerate_audio_input, enumerate_video_input, enumerate_audio_output,
- origin_, base::Bind(&MediaDevicesDispatcherHostTest::DevicesEnumerated,
- base::Unretained(this), run_loop.QuitClosure()));
+ base::Bind(&MediaDevicesDispatcherHostTest::DevicesEnumerated,
+ base::Unretained(this), run_loop.QuitClosure()));
run_loop.Run();
ASSERT_FALSE(enumerated_devices_.empty());
@@ -256,12 +257,9 @@ class MediaDevicesDispatcherHostTest : public testing::Test {
host_->SetPermissionChecker(
base::MakeUnique<MediaDevicesPermissionChecker>(has_permission));
uint32_t subscription_id = 0u;
- uint32_t unique_origin_subscription_id = 1u;
- url::Origin origin(GURL("http://localhost"));
- url::Origin unique_origin;
for (size_t i = 0; i < NUM_MEDIA_DEVICE_TYPES; ++i) {
MediaDeviceType type = static_cast<MediaDeviceType>(i);
- host_->SubscribeDeviceChangeNotifications(type, subscription_id, origin);
+ host_->SubscribeDeviceChangeNotifications(type, subscription_id);
MockMediaDevicesListener device_change_listener;
host_->SetDeviceChangeListenerForTesting(
device_change_listener.CreateInterfacePtrAndBind());
@@ -269,12 +267,6 @@ class MediaDevicesDispatcherHostTest : public testing::Test {
EXPECT_CALL(device_change_listener,
OnDevicesChanged(type, subscription_id, testing::_))
.WillRepeatedly(SaveArg<2>(&changed_devices));
- // The subscription with unique origin is ignored, so it should not get
- // notifications.
- EXPECT_CALL(
- device_change_listener,
- OnDevicesChanged(type, unique_origin_subscription_id, testing::_))
- .Times(0);
// Simulate device-change notification
MediaDeviceInfoArray updated_devices = {
@@ -356,46 +348,15 @@ TEST_F(MediaDevicesDispatcherHostTest, SubscribeDeviceChangeNoAccess) {
SubscribeAndWaitForResult(false);
}
-TEST_F(MediaDevicesDispatcherHostTest, EnumerateAllDevicesUniqueOrigin) {
- EXPECT_CALL(*this, UniqueOriginCallback(testing::_)).Times(0);
- host_->EnumerateDevices(
- true, true, true, url::Origin(),
- base::Bind(&MediaDevicesDispatcherHostTest::UniqueOriginCallback,
- base::Unretained(this)));
- base::RunLoop().RunUntilIdle();
-
- // Verify that the callback for a valid origin does get called.
- base::RunLoop run_loop;
- EXPECT_CALL(*this, ValidOriginCallback(testing::_))
- .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
- host_->EnumerateDevices(
- true, true, true, url::Origin(GURL("http://localhost")),
- base::Bind(&MediaDevicesDispatcherHostTest::ValidOriginCallback,
- base::Unretained(this)));
- run_loop.Run();
-}
-
TEST_F(MediaDevicesDispatcherHostTest, GetVideoInputCapabilities) {
base::RunLoop run_loop;
EXPECT_CALL(*this, MockVideoInputCapabilitiesCallback())
.WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
host_->GetVideoInputCapabilities(
- origin_,
base::Bind(
&MediaDevicesDispatcherHostTest::VideoInputCapabilitiesCallback,
base::Unretained(this)));
run_loop.Run();
}
-TEST_F(MediaDevicesDispatcherHostTest, GetVideoInputCapabilitiesUniqueOrigin) {
- base::RunLoop run_loop;
- EXPECT_CALL(*this, MockVideoInputCapabilitiesCallback())
- .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
- host_->GetVideoInputCapabilities(
- url::Origin(), base::Bind(&MediaDevicesDispatcherHostTest::
- VideoInputCapabilitiesUniqueOriginCallback,
- base::Unretained(this)));
- run_loop.Run();
-}
-
}; // namespace content

Powered by Google App Engine
This is Rietveld 408576698