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

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

Issue 1939313003: Revert of Add support for device-change notifications to MediaStreamDispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_stream_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
index 6ef2152923e8e1f322d4a47ed7a431a83d758b15..8e435a785a91d82fd2beb40f19a54a77a9f6b569 100644
--- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
@@ -15,7 +15,6 @@
#include "base/location.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
-#include "base/system_monitor/system_monitor.h"
#include "base/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "content/browser/browser_thread_impl.h"
@@ -66,7 +65,7 @@
const ResourceContext::SaltCallback salt_callback,
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
MediaStreamManager* manager)
- : MediaStreamDispatcherHost(kProcessId, salt_callback, manager, true),
+ : MediaStreamDispatcherHost(kProcessId, salt_callback, manager),
task_runner_(task_runner),
current_ipc_(NULL) {}
@@ -117,20 +116,6 @@
render_frame_id, page_request_id, type, security_origin);
}
- void OnCancelEnumerateDevices(int render_frame_id, int page_request_id) {
- MediaStreamDispatcherHost::OnCancelEnumerateDevices(render_frame_id,
- page_request_id);
- }
-
- void OnSubscribeToDeviceChangeNotifications(
- int render_frame_id,
- const url::Origin& security_origin,
- const base::Closure& quit_closure) {
- quit_closures_.push(quit_closure);
- MediaStreamDispatcherHost::OnSubscribeToDeviceChangeNotifications(
- render_frame_id, security_origin);
- }
-
std::string label_;
StreamDeviceInfoArray audio_devices_;
StreamDeviceInfoArray video_devices_;
@@ -147,8 +132,8 @@
CHECK(message);
current_ipc_ = message;
- // In this method we dispatch the messages to the corresponding handlers as
- // if we are the renderer.
+ // In this method we dispatch the messages to the according handlers as if
+ // we are the renderer.
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(MockMediaStreamDispatcherHost, *message)
IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerated,
@@ -158,7 +143,6 @@
IPC_MESSAGE_HANDLER(MediaStreamMsg_DeviceStopped, OnDeviceStoppedInternal)
IPC_MESSAGE_HANDLER(MediaStreamMsg_DeviceOpened, OnDeviceOpenedInternal)
IPC_MESSAGE_HANDLER(MediaStreamMsg_DevicesEnumerated, OnDevicesEnumerated)
- IPC_MESSAGE_HANDLER(MediaStreamMsg_DevicesChanged, OnDevicesChanged)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
EXPECT_TRUE(handled);
@@ -225,12 +209,6 @@
quit_closures_.pop();
task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&quit_closure));
enumerated_devices_ = devices;
- }
-
- void OnDevicesChanged() {
- base::Closure quit_closure = quit_closures_.front();
- quit_closures_.pop();
- task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&quit_closure));
}
const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
@@ -373,20 +351,6 @@
ASSERT_FALSE(host_->enumerated_devices_.empty());
EXPECT_FALSE(DoesContainRawIds(host_->enumerated_devices_));
EXPECT_TRUE(DoesEveryDeviceMapToRawId(host_->enumerated_devices_, origin_));
- // Enumeration requests must be cancelled manually.
- host_->OnCancelEnumerateDevices(render_frame_id, page_request_id);
- }
-
- void SubscribeToDeviceChangeNotificationsAndWaitForNotification(
- int render_frame_id) {
- base::RunLoop run_loop;
- host_->OnSubscribeToDeviceChangeNotifications(render_frame_id, origin_,
- run_loop.QuitClosure());
- // Simulate a change in the set of devices.
- video_capture_device_factory_->set_number_of_devices(5);
- media_stream_manager_->OnDevicesChanged(
- base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE);
- run_loop.Run();
}
bool DoesContainRawIds(const StreamDeviceInfoArray& devices) {
@@ -952,12 +916,4 @@
EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_));
}
-TEST_F(MediaStreamDispatcherHostTest, DeviceChangeNotification) {
- SetupFakeUI(false);
- // warm up the cache
- EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
- MEDIA_DEVICE_VIDEO_CAPTURE);
- SubscribeToDeviceChangeNotificationsAndWaitForNotification(kRenderId);
-}
-
}; // namespace content

Powered by Google App Engine
This is Rietveld 408576698