OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_MOCK_OBJECTS_H_ |
| 6 #define REMOTING_HOST_MOCK_OBJECTS_H_ |
| 7 |
| 8 #include "media/base/data_buffer.h" |
| 9 #include "remoting/base/protocol_decoder.h" |
| 10 #include "remoting/host/capturer.h" |
| 11 #include "remoting/host/client_connection.h" |
| 12 #include "remoting/host/encoder.h" |
| 13 #include "remoting/host/event_executor.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 |
| 16 namespace remoting { |
| 17 |
| 18 class MockCapturer : public Capturer { |
| 19 public: |
| 20 MockCapturer() {} |
| 21 |
| 22 MOCK_METHOD1(CaptureFullScreen, void(Task* done_task)); |
| 23 MOCK_METHOD1(CaptureDirtyRects, void(Task* done_task)); |
| 24 MOCK_METHOD2(CaptureRect, void(const gfx::Rect& rect, Task* done_task)); |
| 25 MOCK_CONST_METHOD1(GetData, void(const uint8* planes[])); |
| 26 MOCK_CONST_METHOD1(GetDataStride, void(int strides[])); |
| 27 MOCK_CONST_METHOD1(GetDirtyRects, void(DirtyRects* rects)); |
| 28 MOCK_CONST_METHOD0(GetWidth, int()); |
| 29 MOCK_CONST_METHOD0(GetHeight, int()); |
| 30 MOCK_CONST_METHOD0(GetPixelFormat, chromotocol_pb::PixelFormat()); |
| 31 |
| 32 private: |
| 33 DISALLOW_COPY_AND_ASSIGN(MockCapturer); |
| 34 }; |
| 35 |
| 36 class MockEncoder : public Encoder { |
| 37 public: |
| 38 MockEncoder() {} |
| 39 |
| 40 MOCK_METHOD8(Encode, void( |
| 41 const DirtyRects& dirty_rects, |
| 42 const uint8** planes, |
| 43 const int* strides, |
| 44 bool key_frame, |
| 45 chromotocol_pb::UpdateStreamPacketHeader* output_data_header, |
| 46 scoped_refptr<media::DataBuffer>* output_data, |
| 47 bool* encode_done, |
| 48 Task* data_available_task)); |
| 49 MOCK_METHOD2(SetSize, void(int width, int height)); |
| 50 MOCK_METHOD1(SetPixelFormat, void(chromotocol_pb::PixelFormat pixel_format)); |
| 51 |
| 52 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(MockEncoder); |
| 54 }; |
| 55 |
| 56 class MockEventExecutor : public EventExecutor { |
| 57 public: |
| 58 MockEventExecutor() {} |
| 59 |
| 60 MOCK_METHOD1(HandleInputEvents, void(ClientMessageList* messages)); |
| 61 |
| 62 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(MockEventExecutor); |
| 64 }; |
| 65 |
| 66 class MockClientConnection : public ClientConnection { |
| 67 public: |
| 68 MockClientConnection(){} |
| 69 |
| 70 MOCK_METHOD2(SendInitClientMessage, void(int width, int height)); |
| 71 MOCK_METHOD0(SendBeginUpdateStreamMessage, void()); |
| 72 MOCK_METHOD2(SendUpdateStreamPacketMessage, |
| 73 void(chromotocol_pb::UpdateStreamPacketHeader* header, |
| 74 scoped_refptr<media::DataBuffer> data)); |
| 75 MOCK_METHOD0(SendEndUpdateStreamMessage, void()); |
| 76 MOCK_METHOD0(GetPendingUpdateStreamMessages, int()); |
| 77 |
| 78 MOCK_METHOD2(OnStateChange, void(JingleChannel* channel, |
| 79 JingleChannel::State state)); |
| 80 MOCK_METHOD2(OnPacketReceived, void(JingleChannel* channel, |
| 81 scoped_refptr<media::DataBuffer> data)); |
| 82 |
| 83 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(MockClientConnection); |
| 85 }; |
| 86 |
| 87 class MockClientConnectionEventHandler : public ClientConnection::EventHandler { |
| 88 public: |
| 89 MockClientConnectionEventHandler() {} |
| 90 |
| 91 MOCK_METHOD2(HandleMessages, |
| 92 void(ClientConnection* viewer, ClientMessageList* messages)); |
| 93 MOCK_METHOD1(OnConnectionOpened, void(ClientConnection* viewer)); |
| 94 MOCK_METHOD1(OnConnectionClosed, void(ClientConnection* viewer)); |
| 95 MOCK_METHOD1(OnConnectionFailed, void(ClientConnection* viewer)); |
| 96 |
| 97 private: |
| 98 DISALLOW_COPY_AND_ASSIGN(MockClientConnectionEventHandler); |
| 99 }; |
| 100 |
| 101 } // namespace remoting |
| 102 |
| 103 #endif // REMOTING_HOST_MOCK_OBJECTS_H_ |
OLD | NEW |