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

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

Issue 13983010: Use webrtc::DesktopCapturer for screen capturer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: q Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/screen_resolution.h" 5 #include "remoting/host/screen_resolution.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace remoting { 12 namespace remoting {
13 13
14 TEST(ScreenResolutionTest, Empty) { 14 TEST(ScreenResolutionTest, Empty) {
15 ScreenResolution resolution; 15 ScreenResolution resolution1(
16 EXPECT_TRUE(resolution.IsEmpty()); 16 webrtc::DesktopSize(100, 100), webrtc::DesktopVector(10, 10));
17 EXPECT_FALSE(resolution1.IsEmpty());
17 18
18 resolution.dimensions_.set(-1, 0); 19 ScreenResolution resolution2(
19 EXPECT_TRUE(resolution.IsEmpty()); 20 webrtc::DesktopSize(), webrtc::DesktopVector(10, 10));
21 EXPECT_TRUE(resolution2.IsEmpty());
20 22
21 resolution.dimensions_.set(0, -1); 23 ScreenResolution resolution3(
22 EXPECT_TRUE(resolution.IsEmpty()); 24 webrtc::DesktopSize(1, 1), webrtc::DesktopVector(0, 0));
alexeypa (please no reviews) 2013/04/26 21:33:58 Can |ScreenResolution| deserialized from an IPC ch
Sergey Ulanov 2013/05/07 22:25:50 No
23 25 EXPECT_TRUE(resolution3.IsEmpty());
24 resolution.dimensions_.set(-1, -1);
25 EXPECT_TRUE(resolution.IsEmpty());
26
27 resolution.dpi_.set(-1, 0);
28 EXPECT_TRUE(resolution.IsEmpty());
29
30 resolution.dpi_.set(0, -1);
31 EXPECT_TRUE(resolution.IsEmpty());
32
33 resolution.dpi_.set(-1, -1);
34 EXPECT_TRUE(resolution.IsEmpty());
35 }
36
37 TEST(ScreenResolutionTest, Invalid) {
38 ScreenResolution resolution;
39 EXPECT_TRUE(resolution.IsValid());
40
41 resolution.dimensions_.set(-1, 0);
42 EXPECT_FALSE(resolution.IsValid());
43
44 resolution.dimensions_.set(0, -1);
45 EXPECT_FALSE(resolution.IsValid());
46
47 resolution.dimensions_.set(-1, -1);
48 EXPECT_FALSE(resolution.IsValid());
49
50 resolution.dpi_.set(-1, 0);
51 EXPECT_FALSE(resolution.IsValid());
52
53 resolution.dpi_.set(0, -1);
54 EXPECT_FALSE(resolution.IsValid());
55
56 resolution.dpi_.set(-1, -1);
57 EXPECT_FALSE(resolution.IsValid());
58 } 26 }
59 27
60 TEST(ScreenResolutionTest, Scaling) { 28 TEST(ScreenResolutionTest, Scaling) {
61 ScreenResolution resolution( 29 ScreenResolution resolution(
62 SkISize::Make(100, 100), SkIPoint::Make(10, 10)); 30 webrtc::DesktopSize(100, 100), webrtc::DesktopVector(10, 10));
63 31
64 EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(5, 5)), 32 EXPECT_TRUE(webrtc::DesktopSize(50, 50).equals(
65 SkISize::Make(50, 50)); 33 resolution.ScaleDimensionsToDpi(webrtc::DesktopVector(5, 5))));
66 34
67 EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(20, 20)), 35 EXPECT_TRUE(webrtc::DesktopSize(200, 200).equals(
68 SkISize::Make(200, 200)); 36 resolution.ScaleDimensionsToDpi(webrtc::DesktopVector(20, 20))));
69 } 37 }
70 38
71 TEST(ScreenResolutionTest, ScalingSaturation) { 39 TEST(ScreenResolutionTest, ScalingSaturation) {
72 ScreenResolution resolution( 40 ScreenResolution resolution(
73 SkISize::Make(10000000, 1000000), SkIPoint::Make(1, 1)); 41 webrtc::DesktopSize(10000000, 1000000), webrtc::DesktopVector(1, 1));
74 42
75 EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(1000000, 1000000)), 43 int32 max_int = std::numeric_limits<int32>::max();
76 SkISize::Make(std::numeric_limits<int32>::max(), 44 EXPECT_TRUE(webrtc::DesktopSize(max_int, max_int).equals(
77 std::numeric_limits<int32>::max())); 45 resolution.ScaleDimensionsToDpi(
46 webrtc::DesktopVector(1000000, 1000000))));
78 } 47 }
79 48
80 } // namespace remoting 49 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698