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

Side by Side Diff: remoting/host/chromeos/aura_desktop_capturer_unittest.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "remoting/host/chromeos/aura_desktop_capturer.h" 5 #include "remoting/host/chromeos/aura_desktop_capturer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 public webrtc::DesktopCapturer::Callback { 43 public webrtc::DesktopCapturer::Callback {
44 public: 44 public:
45 AuraDesktopCapturerTest() {} 45 AuraDesktopCapturerTest() {}
46 46
47 void SetUp() override; 47 void SetUp() override;
48 48
49 MOCK_METHOD1(OnCaptureCompleted, void(webrtc::DesktopFrame* frame)); 49 MOCK_METHOD1(OnCaptureCompleted, void(webrtc::DesktopFrame* frame));
50 50
51 protected: 51 protected:
52 void SimulateFrameCapture() { 52 void SimulateFrameCapture() {
53 scoped_ptr<SkBitmap> bitmap(new SkBitmap()); 53 std::unique_ptr<SkBitmap> bitmap(new SkBitmap());
54 const SkImageInfo& info = 54 const SkImageInfo& info =
55 SkImageInfo::Make(3, 4, kBGRA_8888_SkColorType, kPremul_SkAlphaType); 55 SkImageInfo::Make(3, 4, kBGRA_8888_SkColorType, kPremul_SkAlphaType);
56 bitmap->installPixels(info, const_cast<unsigned char*>(frame_data), 12); 56 bitmap->installPixels(info, const_cast<unsigned char*>(frame_data), 12);
57 57
58 capturer_->OnFrameCaptured( 58 capturer_->OnFrameCaptured(
59 cc::CopyOutputResult::CreateBitmapResult(std::move(bitmap))); 59 cc::CopyOutputResult::CreateBitmapResult(std::move(bitmap)));
60 } 60 }
61 61
62 scoped_ptr<AuraDesktopCapturer> capturer_; 62 std::unique_ptr<AuraDesktopCapturer> capturer_;
63 }; 63 };
64 64
65 void AuraDesktopCapturerTest::SetUp() { 65 void AuraDesktopCapturerTest::SetUp() {
66 capturer_.reset(new AuraDesktopCapturer()); 66 capturer_.reset(new AuraDesktopCapturer());
67 } 67 }
68 68
69 TEST_F(AuraDesktopCapturerTest, ConvertSkBitmapToDesktopFrame) { 69 TEST_F(AuraDesktopCapturerTest, ConvertSkBitmapToDesktopFrame) {
70 webrtc::DesktopFrame* captured_frame = nullptr; 70 webrtc::DesktopFrame* captured_frame = nullptr;
71 71
72 EXPECT_CALL(*this, OnCaptureCompleted(_)).Times(1).WillOnce( 72 EXPECT_CALL(*this, OnCaptureCompleted(_)).Times(1).WillOnce(
73 SaveArg<0>(&captured_frame)); 73 SaveArg<0>(&captured_frame));
74 capturer_->Start(this); 74 capturer_->Start(this);
75 75
76 SimulateFrameCapture(); 76 SimulateFrameCapture();
77 77
78 ASSERT_TRUE(captured_frame != nullptr); 78 ASSERT_TRUE(captured_frame != nullptr);
79 uint8_t* captured_data = captured_frame->data(); 79 uint8_t* captured_data = captured_frame->data();
80 EXPECT_EQ( 80 EXPECT_EQ(
81 0, 81 0,
82 memcmp( 82 memcmp(
83 frame_data, captured_data, sizeof(frame_data))); 83 frame_data, captured_data, sizeof(frame_data)));
84 84
85 delete captured_frame; 85 delete captured_frame;
86 } 86 }
87 87
88 } // namespace remoting 88 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromeos/aura_desktop_capturer.cc ('k') | remoting/host/chromeos/clipboard_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698