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

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

Issue 1862693002: Replace skia::RefPtr with sk_sp<> in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unget 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 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"
11 #include "media/base/limits.h" 11 #include "media/base/limits.h"
12 #include "skia/ext/refptr.h"
13 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 14 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
17 #include "third_party/WebKit/public/platform/WebSize.h" 16 #include "third_party/WebKit/public/platform/WebSize.h"
18 #include "third_party/WebKit/public/web/WebHeap.h" 17 #include "third_party/WebKit/public/web/WebHeap.h"
19 18
20 using ::testing::_; 19 using ::testing::_;
21 using ::testing::InSequence; 20 using ::testing::InSequence;
22 using ::testing::Mock; 21 using ::testing::Mock;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 MOCK_METHOD1(DoOnVideoCaptureDeviceFormats, 74 MOCK_METHOD1(DoOnVideoCaptureDeviceFormats,
76 void(const media::VideoCaptureFormats&)); 75 void(const media::VideoCaptureFormats&));
77 void OnVideoCaptureDeviceFormats(const media::VideoCaptureFormats& formats) { 76 void OnVideoCaptureDeviceFormats(const media::VideoCaptureFormats& formats) {
78 DoOnVideoCaptureDeviceFormats(formats); 77 DoOnVideoCaptureDeviceFormats(formats);
79 } 78 }
80 79
81 MOCK_METHOD1(DoOnRunning, void(bool)); 80 MOCK_METHOD1(DoOnRunning, void(bool));
82 void OnRunning(bool state) { DoOnRunning(state); } 81 void OnRunning(bool state) { DoOnRunning(state); }
83 82
84 // Verify returned frames. 83 // Verify returned frames.
85 static skia::RefPtr<SkImage> GenerateTestImage(bool opaque) { 84 static sk_sp<SkImage> GenerateTestImage(bool opaque) {
86 85
87 SkBitmap testBitmap; 86 SkBitmap testBitmap;
88 testBitmap.allocN32Pixels(kTestCanvasCaptureFrameWidth, 87 testBitmap.allocN32Pixels(kTestCanvasCaptureFrameWidth,
89 kTestCanvasCaptureFrameHeight, opaque); 88 kTestCanvasCaptureFrameHeight, opaque);
90 testBitmap.eraseARGB(kTestAlphaValue, 30, 60, 200); 89 testBitmap.eraseARGB(kTestAlphaValue, 30, 60, 200);
91 return skia::AdoptRef(SkImage::NewFromBitmap(testBitmap)); 90 return SkImage::MakeFromBitmap(testBitmap);
92 } 91 }
93 92
94 void OnVerifyDeliveredFrame( 93 void OnVerifyDeliveredFrame(
95 bool opaque, 94 bool opaque,
96 const scoped_refptr<media::VideoFrame>& video_frame, 95 const scoped_refptr<media::VideoFrame>& video_frame,
97 base::TimeTicks estimated_capture_time) { 96 base::TimeTicks estimated_capture_time) {
98 if (opaque) 97 if (opaque)
99 EXPECT_EQ(media::PIXEL_FORMAT_I420, video_frame->format()); 98 EXPECT_EQ(media::PIXEL_FORMAT_I420, video_frame->format());
100 else 99 else
101 EXPECT_EQ(media::PIXEL_FORMAT_YV12A, video_frame->format()); 100 EXPECT_EQ(media::PIXEL_FORMAT_YV12A, video_frame->format());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 track_.source().getExtraData())); 227 track_.source().getExtraData()));
229 EXPECT_TRUE(source != nullptr); 228 EXPECT_TRUE(source != nullptr);
230 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame()); 229 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame());
231 source->StopCapture(); 230 source->StopCapture();
232 EXPECT_FALSE(canvas_capture_handler_->needsNewFrame()); 231 EXPECT_FALSE(canvas_capture_handler_->needsNewFrame());
233 } 232 }
234 233
235 INSTANTIATE_TEST_CASE_P(, CanvasCaptureHandlerTest, ::testing::Bool()); 234 INSTANTIATE_TEST_CASE_P(, CanvasCaptureHandlerTest, ::testing::Bool());
236 235
237 } // namespace content 236 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | content/renderer/media/html_video_element_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698