| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/task.h" | 6 #include "base/task.h" |
| 7 #include "remoting/host/mock_objects.h" | 7 #include "remoting/host/mock_objects.h" |
| 8 #include "remoting/host/session_manager.h" | 8 #include "remoting/host/session_manager.h" |
| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static int kStride[3] = { | 21 static int kStride[3] = { |
| 22 kWidth * 4, | 22 kWidth * 4, |
| 23 kWidth * 4, | 23 kWidth * 4, |
| 24 kWidth * 4, | 24 kWidth * 4, |
| 25 }; | 25 }; |
| 26 static uint8* kData[3] = { | 26 static uint8* kData[3] = { |
| 27 reinterpret_cast<uint8*>(0x01), | 27 reinterpret_cast<uint8*>(0x01), |
| 28 reinterpret_cast<uint8*>(0x02), | 28 reinterpret_cast<uint8*>(0x02), |
| 29 reinterpret_cast<uint8*>(0x03), | 29 reinterpret_cast<uint8*>(0x03), |
| 30 }; | 30 }; |
| 31 static const chromotocol_pb::PixelFormat kFormat = | 31 static const PixelFormat kFormat = |
| 32 chromotocol_pb::PixelFormatRgb32; | 32 PixelFormatRgb32; |
| 33 | 33 |
| 34 class SessionManagerTest : public testing::Test { | 34 class SessionManagerTest : public testing::Test { |
| 35 public: | 35 public: |
| 36 SessionManagerTest() { | 36 SessionManagerTest() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 void Init() { | 40 void Init() { |
| 41 capturer_ = new MockCapturer(); | 41 capturer_ = new MockCapturer(); |
| 42 encoder_ = new MockEncoder(); | 42 encoder_ = new MockEncoder(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // TODO(hclam): Return DirtyRects for verification. | 99 // TODO(hclam): Return DirtyRects for verification. |
| 100 EXPECT_CALL(*capturer_, GetDirtyRects(NotNull())); | 100 EXPECT_CALL(*capturer_, GetDirtyRects(NotNull())); |
| 101 EXPECT_CALL(*capturer_, GetData(NotNull())) | 101 EXPECT_CALL(*capturer_, GetData(NotNull())) |
| 102 .WillOnce(AssignCaptureData(kData)); | 102 .WillOnce(AssignCaptureData(kData)); |
| 103 EXPECT_CALL(*capturer_, GetDataStride(NotNull())) | 103 EXPECT_CALL(*capturer_, GetDataStride(NotNull())) |
| 104 .WillOnce(AssignCaptureData(kStride)); | 104 .WillOnce(AssignCaptureData(kStride)); |
| 105 EXPECT_CALL(*capturer_, GetPixelFormat()) | 105 EXPECT_CALL(*capturer_, GetPixelFormat()) |
| 106 .WillOnce(Return(kFormat)); | 106 .WillOnce(Return(kFormat)); |
| 107 | 107 |
| 108 // Expect the encoder be called. | 108 // Expect the encoder be called. |
| 109 chromotocol_pb::UpdateStreamPacketHeader header; | 109 UpdateStreamPacketHeader header; |
| 110 scoped_refptr<media::DataBuffer> buffer = new media::DataBuffer(0); | 110 scoped_refptr<media::DataBuffer> buffer = new media::DataBuffer(0); |
| 111 EXPECT_CALL(*encoder_, SetSize(kWidth, kHeight)); | 111 EXPECT_CALL(*encoder_, SetSize(kWidth, kHeight)); |
| 112 EXPECT_CALL(*encoder_, SetPixelFormat(kFormat)); | 112 EXPECT_CALL(*encoder_, SetPixelFormat(kFormat)); |
| 113 // TODO(hclam): Expect the content of the dirty rects. | 113 // TODO(hclam): Expect the content of the dirty rects. |
| 114 EXPECT_CALL(*encoder_, | 114 EXPECT_CALL(*encoder_, |
| 115 Encode(_, NotNull(), NotNull(), false, NotNull(), | 115 Encode(_, NotNull(), NotNull(), false, NotNull(), |
| 116 NotNull(), NotNull(), NotNull())) | 116 NotNull(), NotNull(), NotNull())) |
| 117 .WillOnce(FinishDecode(header, buffer)); | 117 .WillOnce(FinishDecode(header, buffer)); |
| 118 | 118 |
| 119 // Expect the client be notified. | 119 // Expect the client be notified. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 130 | 130 |
| 131 // Make sure all tasks are completed. | 131 // Make sure all tasks are completed. |
| 132 message_loop_.RunAllPending(); | 132 message_loop_.RunAllPending(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 // TODO(hclam): Add test for double buffering. | 135 // TODO(hclam): Add test for double buffering. |
| 136 // TODO(hclam): Add test for multiple captures. | 136 // TODO(hclam): Add test for multiple captures. |
| 137 // TODO(hclam): Add test for interruption. | 137 // TODO(hclam): Add test for interruption. |
| 138 | 138 |
| 139 } // namespace remoting | 139 } // namespace remoting |
| OLD | NEW |