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

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

Issue 54863002: Implement a salt for MediaSource IDs that can be cleared by a user. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed more comments. Created 7 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_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 895b821aceb57aacd294797136a3c5189bc0fe3f..1a4413cabd4e8b7bf70a9980fb9bdc3a007ef71e 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
@@ -17,6 +17,7 @@
#include "content/common/media/media_stream_options.h"
#include "content/public/browser/media_device_id.h"
#include "content/public/test/mock_resource_context.h"
+#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/test/test_content_browser_client.h"
#include "content/test/test_content_client.h"
@@ -84,9 +85,10 @@ class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost,
public TestContentBrowserClient {
public:
MockMediaStreamDispatcherHost(
+ ResourceContext* resource_context,
const scoped_refptr<base::MessageLoopProxy>& message_loop,
MediaStreamManager* manager)
- : MediaStreamDispatcherHost(kProcessId, manager),
+ : MediaStreamDispatcherHost(kProcessId, resource_context, manager),
message_loop_(message_loop) {}
// A list of mock methods.
@@ -257,8 +259,10 @@ class MediaStreamDispatcherHostTest : public testing::Test {
// Make sure we use fake devices to avoid long delays.
media_stream_manager_->UseFakeDevice();
- host_ = new MockMediaStreamDispatcherHost(base::MessageLoopProxy::current(),
- media_stream_manager_.get());
+ host_ = new MockMediaStreamDispatcherHost(
+ browser_context_.GetResourceContext(),
+ base::MessageLoopProxy::current(),
+ media_stream_manager_.get());
// Use the fake content client and browser.
content_client_.reset(new TestContentClient());
@@ -392,6 +396,7 @@ class MediaStreamDispatcherHostTest : public testing::Test {
physical_audio_devices_.begin();
for (; audio_it != physical_audio_devices_.end(); ++audio_it) {
if (content::DoesMediaDeviceIDMatchHMAC(
+ browser_context_.GetResourceContext(),
origin,
devices[i].device.id,
audio_it->unique_id)) {
@@ -403,6 +408,7 @@ class MediaStreamDispatcherHostTest : public testing::Test {
physical_video_devices_.begin();
for (; video_it != physical_video_devices_.end(); ++video_it) {
if (content::DoesMediaDeviceIDMatchHMAC(
+ browser_context_.GetResourceContext(),
origin,
devices[i].device.id,
video_it->id())) {
@@ -422,6 +428,7 @@ class MediaStreamDispatcherHostTest : public testing::Test {
ContentBrowserClient* old_browser_client_;
scoped_ptr<ContentClient> content_client_;
content::TestBrowserThreadBundle thread_bundle_;
+ content::TestBrowserContext browser_context_;
media::AudioDeviceNames physical_audio_devices_;
media::VideoCaptureDevice::Names physical_video_devices_;
GURL origin_;
@@ -574,6 +581,7 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithSourceId) {
StreamOptions options(MEDIA_DEVICE_AUDIO_CAPTURE,
MEDIA_DEVICE_VIDEO_CAPTURE);
options.audio_device_id = content::GetHMACForMediaDeviceID(
+ browser_context_.GetResourceContext(),
origin_,
audio_it->unique_id);
ASSERT_FALSE(options.audio_device_id.empty());
@@ -590,8 +598,9 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithSourceId) {
StreamOptions options(MEDIA_DEVICE_AUDIO_CAPTURE,
MEDIA_DEVICE_VIDEO_CAPTURE);
options.video_device_id = content::GetHMACForMediaDeviceID(
- origin_,
- video_it->id());
+ browser_context_.GetResourceContext(),
+ origin_,
+ video_it->id());
ASSERT_FALSE(options.video_device_id.empty());
// Generate first stream.

Powered by Google App Engine
This is Rietveld 408576698