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

Side by Side Diff: remoting/host/shaped_desktop_capturer_unittest.cc

Issue 1827043004: Remove shaped desktop support from remoting host and client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « remoting/host/shaped_desktop_capturer.cc ('k') | remoting/proto/video.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "remoting/host/shaped_desktop_capturer.h"
6
7 #include <stddef.h>
8
9 #include "remoting/host/desktop_shape_tracker.h"
10 #include "remoting/protocol/fake_desktop_capturer.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
13 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
15
16 namespace remoting {
17
18 class FakeDesktopShapeTracker : public DesktopShapeTracker {
19 public:
20 FakeDesktopShapeTracker() {}
21 ~FakeDesktopShapeTracker() override {}
22
23 static webrtc::DesktopRegion CreateShape() {
24 webrtc::DesktopRegion result;
25 result.AddRect(webrtc::DesktopRect::MakeXYWH(0, 0, 5, 5));
26 result.AddRect(webrtc::DesktopRect::MakeXYWH(5, 5, 5, 5));
27 return result;
28 }
29
30 void RefreshDesktopShape() override { shape_ = CreateShape(); }
31
32 const webrtc::DesktopRegion& desktop_shape() override {
33 // desktop_shape() can't be called before RefreshDesktopShape().
34 EXPECT_FALSE(shape_.is_empty());
35 return shape_;
36 }
37
38 private:
39 webrtc::DesktopRegion shape_;
40 };
41
42 class ShapedDesktopCapturerTest : public testing::Test,
43 public webrtc::DesktopCapturer::Callback {
44 public:
45 // webrtc::DesktopCapturer::Callback interface
46 void OnCaptureCompleted(webrtc::DesktopFrame* frame) override {
47 last_frame_.reset(frame);
48 }
49
50 scoped_ptr<webrtc::DesktopFrame> last_frame_;
51 };
52
53 // Verify that captured frame have shape.
54 TEST_F(ShapedDesktopCapturerTest, Basic) {
55 ShapedDesktopCapturer capturer(
56 make_scoped_ptr(new protocol::FakeDesktopCapturer()),
57 make_scoped_ptr(new FakeDesktopShapeTracker()));
58 capturer.Start(this);
59 capturer.Capture(webrtc::DesktopRegion());
60 ASSERT_TRUE(last_frame_.get());
61 ASSERT_TRUE(last_frame_->shape());
62 EXPECT_TRUE(
63 FakeDesktopShapeTracker::CreateShape().Equals(*last_frame_->shape()));
64 }
65
66 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/shaped_desktop_capturer.cc ('k') | remoting/proto/video.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698