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

Side by Side Diff: content/renderer/media/media_stream_dispatcher_unittest.cc

Issue 1875463002: Remove unused fields from //content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scythe-root
Patch Set: Reverting not really needed changes under //gpu. 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 unified diff | Download patch
OLDNEW
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 "content/renderer/media/media_stream_dispatcher.h" 5 #include "content/renderer/media/media_stream_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 using MediaStreamDispatcher::GetNextIpcIdForTest; 110 using MediaStreamDispatcher::GetNextIpcIdForTest;
111 using RenderFrameObserver::OnMessageReceived; 111 using RenderFrameObserver::OnMessageReceived;
112 }; 112 };
113 113
114 class MediaStreamDispatcherTest : public ::testing::Test { 114 class MediaStreamDispatcherTest : public ::testing::Test {
115 public: 115 public:
116 MediaStreamDispatcherTest() 116 MediaStreamDispatcherTest()
117 : dispatcher_(new MediaStreamDispatcherUnderTest()), 117 : dispatcher_(new MediaStreamDispatcherUnderTest()),
118 handler_(new MockMediaStreamDispatcherEventHandler), 118 handler_(new MockMediaStreamDispatcherEventHandler),
119 security_origin_("http://test.com"), 119 security_origin_("http://test.com") {}
120 request_id_(10) {
121 }
122 120
123 // Generates a request for a MediaStream and returns the request id that is 121 // Generates a request for a MediaStream and returns the request id that is
124 // used in IPC. Use this returned id in CompleteGenerateStream to identify 122 // used in IPC. Use this returned id in CompleteGenerateStream to identify
125 // the request. 123 // the request.
126 int GenerateStream(const StreamControls& controls, int request_id) { 124 int GenerateStream(const StreamControls& controls, int request_id) {
127 int next_ipc_id = dispatcher_->GetNextIpcIdForTest(); 125 int next_ipc_id = dispatcher_->GetNextIpcIdForTest();
128 dispatcher_->GenerateStream(request_id, handler_.get()->AsWeakPtr(), 126 dispatcher_->GenerateStream(request_id, handler_.get()->AsWeakPtr(),
129 controls, security_origin_); 127 controls, security_origin_);
130 return next_ipc_id; 128 return next_ipc_id;
131 } 129 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 EXPECT_EQ(dispatcher_->video_session_id(label, 0), kVideoSessionId); 169 EXPECT_EQ(dispatcher_->video_session_id(label, 0), kVideoSessionId);
172 170
173 return label; 171 return label;
174 } 172 }
175 173
176 protected: 174 protected:
177 base::MessageLoop message_loop_; 175 base::MessageLoop message_loop_;
178 std::unique_ptr<MediaStreamDispatcherUnderTest> dispatcher_; 176 std::unique_ptr<MediaStreamDispatcherUnderTest> dispatcher_;
179 std::unique_ptr<MockMediaStreamDispatcherEventHandler> handler_; 177 std::unique_ptr<MockMediaStreamDispatcherEventHandler> handler_;
180 GURL security_origin_; 178 GURL security_origin_;
181 int request_id_;
182 }; 179 };
183 180
184 } // namespace 181 } // namespace
185 182
186 TEST_F(MediaStreamDispatcherTest, GenerateStreamAndStopDevices) { 183 TEST_F(MediaStreamDispatcherTest, GenerateStreamAndStopDevices) {
187 StreamControls controls(true, true); 184 StreamControls controls(true, true);
188 185
189 int ipc_request_id1 = GenerateStream(controls, kRequestId1); 186 int ipc_request_id1 = GenerateStream(controls, kRequestId1);
190 int ipc_request_id2 = GenerateStream(controls, kRequestId2); 187 int ipc_request_id2 = GenerateStream(controls, kRequestId2);
191 EXPECT_NE(ipc_request_id1, ipc_request_id2); 188 EXPECT_NE(ipc_request_id1, ipc_request_id2);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 dispatcher_->OnMessageReceived( 403 dispatcher_->OnMessageReceived(
407 MediaStreamMsg_DeviceStopped(kRouteId, label, handler_->video_device_)); 404 MediaStreamMsg_DeviceStopped(kRouteId, label, handler_->video_device_));
408 // Verify that MediaStreamDispatcherEventHandler::OnDeviceStopped has been 405 // Verify that MediaStreamDispatcherEventHandler::OnDeviceStopped has been
409 // called. 406 // called.
410 EXPECT_EQ(label, handler_->device_stopped_label_); 407 EXPECT_EQ(label, handler_->device_stopped_label_);
411 EXPECT_EQ(dispatcher_->video_session_id(label, 0), 408 EXPECT_EQ(dispatcher_->video_session_id(label, 0),
412 StreamDeviceInfo::kNoId); 409 StreamDeviceInfo::kNoId);
413 } 410 }
414 411
415 } // namespace content 412 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/child_frame_compositing_helper.h ('k') | content/renderer/media/webaudio_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698