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

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

Issue 13989003: Replace MediaStreamUIController with MediaStreamUIProxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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_manager_unittest.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager_unittest.cc b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
index a515a36084f8505db9fdc6a0de73ab9936fa69a6..b800d7504dee46e909ba9430cbec1eb3c8302687 100644
--- a/content/browser/renderer_host/media/media_stream_manager_unittest.cc
+++ b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
@@ -8,6 +8,7 @@
#include "base/message_loop.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
+#include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
#include "content/common/media/media_stream_options.h"
#include "media/audio/audio_manager_base.h"
#if defined(OS_ANDROID)
@@ -63,10 +64,11 @@ class MediaStreamManagerTest : public ::testing::Test {
public:
MediaStreamManagerTest() {}
- MOCK_METHOD1(Response, void(const std::string&));
- void ResponseCallback(const std::string& label,
- const MediaStreamDevices& devices) {
- Response(label);
+ MOCK_METHOD1(Response, void(int index));
+ void ResponseCallback(int index,
+ const MediaStreamDevices& devices,
+ scoped_ptr<MediaStreamUIProxy> ui_proxy) {
+ Response(index);
message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
}
@@ -95,15 +97,15 @@ class MediaStreamManagerTest : public ::testing::Test {
message_loop_.reset();
}
- std::string MakeMediaAccessRequest() {
+ std::string MakeMediaAccessRequest(int index) {
const int render_process_id = 1;
const int render_view_id = 1;
StreamOptions components(MEDIA_DEVICE_AUDIO_CAPTURE,
MEDIA_DEVICE_VIDEO_CAPTURE);
const GURL security_origin;
- MediaRequestResponseCallback callback =
+ MediaStreamManager::MediaRequestResponseCallback callback =
base::Bind(&MediaStreamManagerTest::ResponseCallback,
- base::Unretained(this));
+ base::Unretained(this), index);
return media_stream_manager_->MakeMediaAccessRequest(render_process_id,
render_view_id,
components,
@@ -122,22 +124,22 @@ class MediaStreamManagerTest : public ::testing::Test {
};
TEST_F(MediaStreamManagerTest, MakeMediaAccessRequest) {
- std::string label = MakeMediaAccessRequest();
+ MakeMediaAccessRequest(0);
// Expecting the callback will be triggered and quit the test.
- EXPECT_CALL(*this, Response(label));
+ EXPECT_CALL(*this, Response(0));
WaitForResult();
}
TEST_F(MediaStreamManagerTest, MakeAndCancelMediaAccessRequest) {
- std::string label = MakeMediaAccessRequest();
+ std::string label = MakeMediaAccessRequest(0);
// No callback is expected.
media_stream_manager_->CancelRequest(label);
}
TEST_F(MediaStreamManagerTest, MakeMultipleRequests) {
// First request.
- std::string label1 = MakeMediaAccessRequest();
+ std::string label1 = MakeMediaAccessRequest(0);
// Second request.
int render_process_id = 2;
@@ -145,9 +147,9 @@ TEST_F(MediaStreamManagerTest, MakeMultipleRequests) {
StreamOptions components(MEDIA_DEVICE_AUDIO_CAPTURE,
MEDIA_DEVICE_VIDEO_CAPTURE);
GURL security_origin;
- MediaRequestResponseCallback callback =
+ MediaStreamManager::MediaRequestResponseCallback callback =
base::Bind(&MediaStreamManagerTest::ResponseCallback,
- base::Unretained(this));
+ base::Unretained(this), 1);
std::string label2 = media_stream_manager_->MakeMediaAccessRequest(
render_process_id,
render_view_id,
@@ -158,18 +160,19 @@ TEST_F(MediaStreamManagerTest, MakeMultipleRequests) {
// Expecting the callbackS from requests will be triggered and quit the test.
// Note, the callbacks might come in a different order depending on the
// value of labels.
- EXPECT_CALL(*this, Response(_)).Times(2);
+ EXPECT_CALL(*this, Response(0));
+ EXPECT_CALL(*this, Response(1));
WaitForResult();
}
TEST_F(MediaStreamManagerTest, MakeAndCancelMultipleRequests) {
- std::string label1 = MakeMediaAccessRequest();
- std::string label2 = MakeMediaAccessRequest();
+ std::string label1 = MakeMediaAccessRequest(0);
+ std::string label2 = MakeMediaAccessRequest(1);
media_stream_manager_->CancelRequest(label1);
// Expecting the callback from the second request will be triggered and
// quit the test.
- EXPECT_CALL(*this, Response(label2));
+ EXPECT_CALL(*this, Response(1));
WaitForResult();
}

Powered by Google App Engine
This is Rietveld 408576698