| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "content/common/media/media_stream_messages.h" | 10 #include "content/common/media/media_stream_messages.h" |
| 11 #include "content/public/common/media_stream_request.h" | 11 #include "content/public/common/media_stream_request.h" |
| 12 #include "content/renderer/media/media_stream_dispatcher.h" | 12 #include "content/renderer/media/media_stream_dispatcher.h" |
| 13 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" | 13 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace content { |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 const int kRouteId = 0; | 20 const int kRouteId = 0; |
| 20 const int kAudioSessionId = 3; | 21 const int kAudioSessionId = 3; |
| 21 const int kVideoSessionId = 5; | 22 const int kVideoSessionId = 5; |
| 22 const int kRequestId1 = 10; | 23 const int kRequestId1 = 10; |
| 23 const int kRequestId2 = 20; | 24 const int kRequestId2 = 20; |
| 24 const int kRequestId3 = 30; | 25 const int kRequestId3 = 30; |
| 25 const int kRequestId4 = 40; | 26 const int kRequestId4 = 40; |
| 26 static const char kLabel[] = "test"; | 27 static const char kLabel[] = "test"; |
| 27 | 28 |
| 28 const content::MediaStreamDeviceType kAudioType = | 29 const MediaStreamDeviceType kAudioType = MEDIA_DEVICE_AUDIO_CAPTURE; |
| 29 content::MEDIA_DEVICE_AUDIO_CAPTURE; | 30 const MediaStreamDeviceType kVideoType = MEDIA_DEVICE_VIDEO_CAPTURE; |
| 30 const content::MediaStreamDeviceType kVideoType = | 31 const MediaStreamDeviceType kNoAudioType = MEDIA_NO_SERVICE; |
| 31 content::MEDIA_DEVICE_VIDEO_CAPTURE; | |
| 32 const content::MediaStreamDeviceType kNoAudioType = | |
| 33 content::MEDIA_NO_SERVICE; | |
| 34 | 32 |
| 35 class MockMediaStreamDispatcherEventHandler | 33 class MockMediaStreamDispatcherEventHandler |
| 36 : public MediaStreamDispatcherEventHandler, | 34 : public MediaStreamDispatcherEventHandler, |
| 37 public base::SupportsWeakPtr<MockMediaStreamDispatcherEventHandler> { | 35 public base::SupportsWeakPtr<MockMediaStreamDispatcherEventHandler> { |
| 38 public: | 36 public: |
| 39 MockMediaStreamDispatcherEventHandler() | 37 MockMediaStreamDispatcherEventHandler() |
| 40 : request_id_(-1) {} | 38 : request_id_(-1) {} |
| 41 | 39 |
| 42 virtual void OnStreamGenerated( | 40 virtual void OnStreamGenerated( |
| 43 int request_id, | 41 int request_id, |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 video_device_array[0] = video_device_info; | 399 video_device_array[0] = video_device_info; |
| 402 | 400 |
| 403 std::string stream_label1 = "stream1"; | 401 std::string stream_label1 = "stream1"; |
| 404 dispatcher->OnMessageReceived(MediaStreamMsg_StreamGenerated( | 402 dispatcher->OnMessageReceived(MediaStreamMsg_StreamGenerated( |
| 405 kRouteId, ipc_request_id1, stream_label1, | 403 kRouteId, ipc_request_id1, stream_label1, |
| 406 audio_device_array, video_device_array)); | 404 audio_device_array, video_device_array)); |
| 407 EXPECT_EQ(handler->request_id_, kRequestId1); | 405 EXPECT_EQ(handler->request_id_, kRequestId1); |
| 408 EXPECT_EQ(handler->label_, stream_label1); | 406 EXPECT_EQ(handler->label_, stream_label1); |
| 409 EXPECT_EQ(0u, dispatcher->requests_.size()); | 407 EXPECT_EQ(0u, dispatcher->requests_.size()); |
| 410 } | 408 } |
| 409 |
| 410 } // namespace content |
| OLD | NEW |