| OLD | NEW |
| 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/codec/video_encoder_helper.h" | 5 #include "remoting/codec/video_encoder_helper.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "remoting/proto/video.pb.h" | 8 #include "remoting/proto/video.pb.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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 VideoEncoderHelper helper; | 29 VideoEncoderHelper helper; |
| 30 scoped_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame)); | 30 scoped_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame)); |
| 31 | 31 |
| 32 ASSERT_TRUE(packet->has_format()); | 32 ASSERT_TRUE(packet->has_format()); |
| 33 EXPECT_FALSE(packet->format().has_encoding()); | 33 EXPECT_FALSE(packet->format().has_encoding()); |
| 34 EXPECT_TRUE(packet->format().has_screen_width()); | 34 EXPECT_TRUE(packet->format().has_screen_width()); |
| 35 EXPECT_TRUE(packet->format().has_screen_height()); | 35 EXPECT_TRUE(packet->format().has_screen_height()); |
| 36 EXPECT_TRUE(packet->format().has_x_dpi()); | 36 EXPECT_TRUE(packet->format().has_x_dpi()); |
| 37 EXPECT_TRUE(packet->format().has_y_dpi()); | 37 EXPECT_TRUE(packet->format().has_y_dpi()); |
| 38 | 38 |
| 39 EXPECT_TRUE(packet->has_capture_time_ms()); | |
| 40 EXPECT_EQ(1, packet->dirty_rects().size()); | 39 EXPECT_EQ(1, packet->dirty_rects().size()); |
| 41 | 40 |
| 42 ASSERT_TRUE(packet->has_use_desktop_shape()); | 41 ASSERT_TRUE(packet->has_use_desktop_shape()); |
| 43 EXPECT_TRUE(packet->use_desktop_shape()); | 42 EXPECT_TRUE(packet->use_desktop_shape()); |
| 44 | 43 |
| 45 EXPECT_EQ(1, packet->desktop_shape_rects().size()); | 44 EXPECT_EQ(1, packet->desktop_shape_rects().size()); |
| 46 } | 45 } |
| 47 | 46 |
| 48 TEST(VideoEncoderHelperTest, ZeroDpi) { | 47 TEST(VideoEncoderHelperTest, ZeroDpi) { |
| 49 BasicDesktopFrame frame(DesktopSize(32, 32)); | 48 BasicDesktopFrame frame(DesktopSize(32, 32)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Process a different-sized frame to trigger size to be emitted. | 97 // Process a different-sized frame to trigger size to be emitted. |
| 99 BasicDesktopFrame frame2(DesktopSize(48, 48)); | 98 BasicDesktopFrame frame2(DesktopSize(48, 48)); |
| 100 packet = helper.CreateVideoPacket(frame2); | 99 packet = helper.CreateVideoPacket(frame2); |
| 101 | 100 |
| 102 ASSERT_TRUE(packet->has_format()); | 101 ASSERT_TRUE(packet->has_format()); |
| 103 EXPECT_TRUE(packet->format().has_screen_width()); | 102 EXPECT_TRUE(packet->format().has_screen_width()); |
| 104 EXPECT_TRUE(packet->format().has_screen_height()); | 103 EXPECT_TRUE(packet->format().has_screen_height()); |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace remoting | 106 } // namespace remoting |
| OLD | NEW |