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

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

Issue 2468853002: Do not kill renderer when enumerateDevices is called from about:blank. (Closed)
Patch Set: rebase Created 4 years, 1 month 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 a050760cc58304f5b8dbaac7b6423bb42a47425c..1b0b18053ce89ce39751fa960fbb1b38d545f3f2 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
@@ -103,6 +103,11 @@ class MediaDevicesDispatcherHostTest : public testing::Test {
ASSERT_GT(physical_devices_[MEDIA_DEVICE_TYPE_AUDIO_OUTPUT].size(), 0u);
}
+ MOCK_METHOD1(UniqueOriginCallback,
+ void(const std::vector<std::vector<MediaDeviceInfo>>&));
+ MOCK_METHOD1(ValidOriginCallback,
+ void(const std::vector<std::vector<MediaDeviceInfo>>&));
+
protected:
void DevicesEnumerated(
const base::Closure& closure,
@@ -307,4 +312,21 @@ 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.
+ EXPECT_CALL(*this, ValidOriginCallback(testing::_));
+ host_->EnumerateDevices(
+ true, true, true, url::Origin(GURL("http://localhost")),
+ base::Bind(&MediaDevicesDispatcherHostTest::ValidOriginCallback,
+ base::Unretained(this)));
+ base::RunLoop().RunUntilIdle();
+}
+
}; // namespace content

Powered by Google App Engine
This is Rietveld 408576698