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

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

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: include <utility> Created 5 years 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>
11
10 #include "cc/output/copy_output_result.h" 12 #include "cc/output/copy_output_result.h"
11 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 16 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
15 17
16 using testing::_; 18 using testing::_;
17 using testing::SaveArg; 19 using testing::SaveArg;
18 20
19 namespace remoting { 21 namespace remoting {
(...skipping 27 matching lines...) Expand all
47 MOCK_METHOD1(CreateSharedMemory, webrtc::SharedMemory*(size_t size)); 49 MOCK_METHOD1(CreateSharedMemory, webrtc::SharedMemory*(size_t size));
48 MOCK_METHOD1(OnCaptureCompleted, void(webrtc::DesktopFrame* frame)); 50 MOCK_METHOD1(OnCaptureCompleted, void(webrtc::DesktopFrame* frame));
49 51
50 protected: 52 protected:
51 void SimulateFrameCapture() { 53 void SimulateFrameCapture() {
52 scoped_ptr<SkBitmap> bitmap(new SkBitmap()); 54 scoped_ptr<SkBitmap> bitmap(new SkBitmap());
53 const SkImageInfo& info = 55 const SkImageInfo& info =
54 SkImageInfo::Make(3, 4, kBGRA_8888_SkColorType, kPremul_SkAlphaType); 56 SkImageInfo::Make(3, 4, kBGRA_8888_SkColorType, kPremul_SkAlphaType);
55 bitmap->installPixels(info, const_cast<unsigned char*>(frame_data), 12); 57 bitmap->installPixels(info, const_cast<unsigned char*>(frame_data), 12);
56 58
57 scoped_ptr<cc::CopyOutputResult> output = 59 capturer_->OnFrameCaptured(
58 cc::CopyOutputResult::CreateBitmapResult(bitmap.Pass()); 60 cc::CopyOutputResult::CreateBitmapResult(std::move(bitmap)));
59 capturer_->OnFrameCaptured(output.Pass());
60 } 61 }
61 62
62 scoped_ptr<AuraDesktopCapturer> capturer_; 63 scoped_ptr<AuraDesktopCapturer> capturer_;
63 }; 64 };
64 65
65 void AuraDesktopCapturerTest::SetUp() { 66 void AuraDesktopCapturerTest::SetUp() {
66 capturer_.reset(new AuraDesktopCapturer()); 67 capturer_.reset(new AuraDesktopCapturer());
67 } 68 }
68 69
69 TEST_F(AuraDesktopCapturerTest, ConvertSkBitmapToDesktopFrame) { 70 TEST_F(AuraDesktopCapturerTest, ConvertSkBitmapToDesktopFrame) {
70 webrtc::DesktopFrame* captured_frame = nullptr; 71 webrtc::DesktopFrame* captured_frame = nullptr;
71 72
72 EXPECT_CALL(*this, OnCaptureCompleted(_)).Times(1).WillOnce( 73 EXPECT_CALL(*this, OnCaptureCompleted(_)).Times(1).WillOnce(
73 SaveArg<0>(&captured_frame)); 74 SaveArg<0>(&captured_frame));
74 capturer_->Start(this); 75 capturer_->Start(this);
75 76
76 SimulateFrameCapture(); 77 SimulateFrameCapture();
77 78
78 ASSERT_TRUE(captured_frame != nullptr); 79 ASSERT_TRUE(captured_frame != nullptr);
79 uint8_t* captured_data = captured_frame->data(); 80 uint8_t* captured_data = captured_frame->data();
80 EXPECT_EQ( 81 EXPECT_EQ(
81 0, 82 0,
82 memcmp( 83 memcmp(
83 frame_data, captured_data, sizeof(frame_data))); 84 frame_data, captured_data, sizeof(frame_data)));
84 85
85 delete captured_frame; 86 delete captured_frame;
86 } 87 }
87 88
88 } // namespace remoting 89 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromeos/aura_desktop_capturer.cc ('k') | remoting/host/chromeos/clipboard_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698