diff options
author | garykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-07 19:58:23 +0000 |
---|---|---|
committer | garykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-07 19:58:23 +0000 |
commit | cb3b1f93130040a150e7fcc57cd4d5a75569685a (patch) | |
tree | ff93665e3c1478c61663d1107cd42dc25b31448d /remoting/host/mock_objects.h | |
parent | b0110e822ac2b2db56d1b1542aad06da573cd544 (diff) | |
download | chromium_src-cb3b1f93130040a150e7fcc57cd4d5a75569685a.zip chromium_src-cb3b1f93130040a150e7fcc57cd4d5a75569685a.tar.gz chromium_src-cb3b1f93130040a150e7fcc57cd4d5a75569685a.tar.bz2 |
Copy the (early prototype of) remoting in Chrome into the public tree.
At the moment, this is a semi-functional demo.
BUG=none
TEST=build/run all unittests on linux
Review URL: http://codereview.chromium.org/2690003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/mock_objects.h')
-rw-r--r-- | remoting/host/mock_objects.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/remoting/host/mock_objects.h b/remoting/host/mock_objects.h new file mode 100644 index 0000000..1f33263 --- /dev/null +++ b/remoting/host/mock_objects.h @@ -0,0 +1,103 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef REMOTING_HOST_MOCK_OBJECTS_H_ +#define REMOTING_HOST_MOCK_OBJECTS_H_ + +#include "media/base/data_buffer.h" +#include "remoting/base/protocol_decoder.h" +#include "remoting/host/capturer.h" +#include "remoting/host/client_connection.h" +#include "remoting/host/encoder.h" +#include "remoting/host/event_executor.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace remoting { + +class MockCapturer : public Capturer { + public: + MockCapturer() {} + + MOCK_METHOD1(CaptureFullScreen, void(Task* done_task)); + MOCK_METHOD1(CaptureDirtyRects, void(Task* done_task)); + MOCK_METHOD2(CaptureRect, void(const gfx::Rect& rect, Task* done_task)); + MOCK_CONST_METHOD1(GetData, void(const uint8* planes[])); + MOCK_CONST_METHOD1(GetDataStride, void(int strides[])); + MOCK_CONST_METHOD1(GetDirtyRects, void(DirtyRects* rects)); + MOCK_CONST_METHOD0(GetWidth, int()); + MOCK_CONST_METHOD0(GetHeight, int()); + MOCK_CONST_METHOD0(GetPixelFormat, chromotocol_pb::PixelFormat()); + + private: + DISALLOW_COPY_AND_ASSIGN(MockCapturer); +}; + +class MockEncoder : public Encoder { + public: + MockEncoder() {} + + MOCK_METHOD8(Encode, void( + const DirtyRects& dirty_rects, + const uint8** planes, + const int* strides, + bool key_frame, + chromotocol_pb::UpdateStreamPacketHeader* output_data_header, + scoped_refptr<media::DataBuffer>* output_data, + bool* encode_done, + Task* data_available_task)); + MOCK_METHOD2(SetSize, void(int width, int height)); + MOCK_METHOD1(SetPixelFormat, void(chromotocol_pb::PixelFormat pixel_format)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockEncoder); +}; + +class MockEventExecutor : public EventExecutor { + public: + MockEventExecutor() {} + + MOCK_METHOD1(HandleInputEvents, void(ClientMessageList* messages)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockEventExecutor); +}; + +class MockClientConnection : public ClientConnection { + public: + MockClientConnection(){} + + MOCK_METHOD2(SendInitClientMessage, void(int width, int height)); + MOCK_METHOD0(SendBeginUpdateStreamMessage, void()); + MOCK_METHOD2(SendUpdateStreamPacketMessage, + void(chromotocol_pb::UpdateStreamPacketHeader* header, + scoped_refptr<media::DataBuffer> data)); + MOCK_METHOD0(SendEndUpdateStreamMessage, void()); + MOCK_METHOD0(GetPendingUpdateStreamMessages, int()); + + MOCK_METHOD2(OnStateChange, void(JingleChannel* channel, + JingleChannel::State state)); + MOCK_METHOD2(OnPacketReceived, void(JingleChannel* channel, + scoped_refptr<media::DataBuffer> data)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockClientConnection); +}; + +class MockClientConnectionEventHandler : public ClientConnection::EventHandler { + public: + MockClientConnectionEventHandler() {} + + MOCK_METHOD2(HandleMessages, + void(ClientConnection* viewer, ClientMessageList* messages)); + MOCK_METHOD1(OnConnectionOpened, void(ClientConnection* viewer)); + MOCK_METHOD1(OnConnectionClosed, void(ClientConnection* viewer)); + MOCK_METHOD1(OnConnectionFailed, void(ClientConnection* viewer)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockClientConnectionEventHandler); +}; + +} // namespace remoting + +#endif // REMOTING_HOST_MOCK_OBJECTS_H_ |