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

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

Issue 1829563002: Handle early destruction of CanvasCaptureHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « content/renderer/media/canvas_capture_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "content/child/child_process.h" 8 #include "content/child/child_process.h"
9 #include "content/renderer/media/canvas_capture_handler.h" 9 #include "content/renderer/media/canvas_capture_handler.h"
10 #include "content/renderer/media/media_stream_video_capturer_source.h" 10 #include "content/renderer/media/media_stream_video_capturer_source.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 private: 135 private:
136 DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandlerTest); 136 DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandlerTest);
137 }; 137 };
138 138
139 // Checks that the initialization-destruction sequence works fine. 139 // Checks that the initialization-destruction sequence works fine.
140 TEST_F(CanvasCaptureHandlerTest, ConstructAndDestruct) { 140 TEST_F(CanvasCaptureHandlerTest, ConstructAndDestruct) {
141 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame()); 141 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame());
142 base::RunLoop().RunUntilIdle(); 142 base::RunLoop().RunUntilIdle();
143 } 143 }
144 144
145 // Checks that the destruction sequence works fine.
146 TEST_F(CanvasCaptureHandlerTest, DestructTrack) {
147 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame());
148 track_.reset();
149 base::RunLoop().RunUntilIdle();
150 }
151
152 // Checks that the destruction sequence works fine.
153 TEST_F(CanvasCaptureHandlerTest, DestructHandler) {
154 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame());
155 canvas_capture_handler_.reset();
156 base::RunLoop().RunUntilIdle();
157 }
158
145 // Checks that VideoCapturerSource call sequence works fine. 159 // Checks that VideoCapturerSource call sequence works fine.
146 TEST_P(CanvasCaptureHandlerTest, GetFormatsStartAndStop) { 160 TEST_P(CanvasCaptureHandlerTest, GetFormatsStartAndStop) {
147 InSequence s; 161 InSequence s;
148 const blink::WebMediaStreamSource& web_media_stream_source = track_.source(); 162 const blink::WebMediaStreamSource& web_media_stream_source = track_.source();
149 EXPECT_FALSE(web_media_stream_source.isNull()); 163 EXPECT_FALSE(web_media_stream_source.isNull());
150 MediaStreamVideoCapturerSource* const ms_source = 164 MediaStreamVideoCapturerSource* const ms_source =
151 static_cast<MediaStreamVideoCapturerSource*>( 165 static_cast<MediaStreamVideoCapturerSource*>(
152 web_media_stream_source.getExtraData()); 166 web_media_stream_source.getExtraData());
153 EXPECT_TRUE(ms_source != nullptr); 167 EXPECT_TRUE(ms_source != nullptr);
154 media::VideoCapturerSource* source = GetVideoCapturerSource(ms_source); 168 media::VideoCapturerSource* source = GetVideoCapturerSource(ms_source);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 track_.source().getExtraData())); 228 track_.source().getExtraData()));
215 EXPECT_TRUE(source != nullptr); 229 EXPECT_TRUE(source != nullptr);
216 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame()); 230 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame());
217 source->StopCapture(); 231 source->StopCapture();
218 EXPECT_FALSE(canvas_capture_handler_->needsNewFrame()); 232 EXPECT_FALSE(canvas_capture_handler_->needsNewFrame());
219 } 233 }
220 234
221 INSTANTIATE_TEST_CASE_P(, CanvasCaptureHandlerTest, ::testing::Bool()); 235 INSTANTIATE_TEST_CASE_P(, CanvasCaptureHandlerTest, ::testing::Bool());
222 236
223 } // namespace content 237 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/canvas_capture_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698