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

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

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

Powered by Google App Engine
This is Rietveld 408576698