Chromium Code Reviews| Index: remoting/host/screen_resolution_unittest.cc |
| diff --git a/remoting/host/screen_resolution_unittest.cc b/remoting/host/screen_resolution_unittest.cc |
| index dce7bc0cd2c7defa0c032a2f8ec3efdfb7e7dfc0..01de134b9690f6a006afd7214e079f7ed253b8d6 100644 |
| --- a/remoting/host/screen_resolution_unittest.cc |
| +++ b/remoting/host/screen_resolution_unittest.cc |
| @@ -12,69 +12,38 @@ |
| namespace remoting { |
| TEST(ScreenResolutionTest, Empty) { |
| - ScreenResolution resolution; |
| - EXPECT_TRUE(resolution.IsEmpty()); |
| + ScreenResolution resolution1( |
| + webrtc::DesktopSize(100, 100), webrtc::DesktopVector(10, 10)); |
| + EXPECT_FALSE(resolution1.IsEmpty()); |
| - resolution.dimensions_.set(-1, 0); |
| - EXPECT_TRUE(resolution.IsEmpty()); |
| + ScreenResolution resolution2( |
| + webrtc::DesktopSize(), webrtc::DesktopVector(10, 10)); |
| + EXPECT_TRUE(resolution2.IsEmpty()); |
| - resolution.dimensions_.set(0, -1); |
| - EXPECT_TRUE(resolution.IsEmpty()); |
| - |
| - resolution.dimensions_.set(-1, -1); |
| - EXPECT_TRUE(resolution.IsEmpty()); |
| - |
| - resolution.dpi_.set(-1, 0); |
| - EXPECT_TRUE(resolution.IsEmpty()); |
| - |
| - resolution.dpi_.set(0, -1); |
| - EXPECT_TRUE(resolution.IsEmpty()); |
| - |
| - resolution.dpi_.set(-1, -1); |
| - EXPECT_TRUE(resolution.IsEmpty()); |
| -} |
| - |
| -TEST(ScreenResolutionTest, Invalid) { |
| - ScreenResolution resolution; |
| - EXPECT_TRUE(resolution.IsValid()); |
| - |
| - resolution.dimensions_.set(-1, 0); |
| - EXPECT_FALSE(resolution.IsValid()); |
| - |
| - resolution.dimensions_.set(0, -1); |
| - EXPECT_FALSE(resolution.IsValid()); |
| - |
| - resolution.dimensions_.set(-1, -1); |
| - EXPECT_FALSE(resolution.IsValid()); |
| - |
| - resolution.dpi_.set(-1, 0); |
| - EXPECT_FALSE(resolution.IsValid()); |
| - |
| - resolution.dpi_.set(0, -1); |
| - EXPECT_FALSE(resolution.IsValid()); |
| - |
| - resolution.dpi_.set(-1, -1); |
| - EXPECT_FALSE(resolution.IsValid()); |
| + ScreenResolution resolution3( |
| + 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
|
| + EXPECT_TRUE(resolution3.IsEmpty()); |
| } |
| TEST(ScreenResolutionTest, Scaling) { |
| ScreenResolution resolution( |
| - SkISize::Make(100, 100), SkIPoint::Make(10, 10)); |
| + webrtc::DesktopSize(100, 100), webrtc::DesktopVector(10, 10)); |
| - EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(5, 5)), |
| - SkISize::Make(50, 50)); |
| + EXPECT_TRUE(webrtc::DesktopSize(50, 50).equals( |
| + resolution.ScaleDimensionsToDpi(webrtc::DesktopVector(5, 5)))); |
| - EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(20, 20)), |
| - SkISize::Make(200, 200)); |
| + EXPECT_TRUE(webrtc::DesktopSize(200, 200).equals( |
| + resolution.ScaleDimensionsToDpi(webrtc::DesktopVector(20, 20)))); |
| } |
| TEST(ScreenResolutionTest, ScalingSaturation) { |
| ScreenResolution resolution( |
| - SkISize::Make(10000000, 1000000), SkIPoint::Make(1, 1)); |
| + webrtc::DesktopSize(10000000, 1000000), webrtc::DesktopVector(1, 1)); |
| - EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(1000000, 1000000)), |
| - SkISize::Make(std::numeric_limits<int32>::max(), |
| - std::numeric_limits<int32>::max())); |
| + int32 max_int = std::numeric_limits<int32>::max(); |
| + EXPECT_TRUE(webrtc::DesktopSize(max_int, max_int).equals( |
| + resolution.ScaleDimensionsToDpi( |
| + webrtc::DesktopVector(1000000, 1000000)))); |
| } |
| } // namespace remoting |