diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 00:18:24 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 00:18:24 +0000 |
commit | 0a071a315daf2a8af0f7b85c84127cda268db2f5 (patch) | |
tree | 6927656c616bb451c2b31605a964b9cf7529632b /remoting | |
parent | cfbf0a1af6efcfdfdb540a59d8c167a9736a405c (diff) | |
download | chromium_src-0a071a315daf2a8af0f7b85c84127cda268db2f5.zip chromium_src-0a071a315daf2a8af0f7b85c84127cda268db2f5.tar.gz chromium_src-0a071a315daf2a8af0f7b85c84127cda268db2f5.tar.bz2 |
More out-of-lining of test code, along with a bunch of GMOCK objects.
Most notably, rename various mock_objects.h files in remoting/ because after deinlining, there were compile failures. This fixes Windows compiling because you can't have two implementation files with the same name in a project, even if they are in different directories. (The output from one compile will clobber the others!)
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6250198
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/chromoting_host_unittest.cc | 4 | ||||
-rw-r--r-- | remoting/host/host_mock_objects.cc | 17 | ||||
-rw-r--r-- | remoting/host/host_mock_objects.h (renamed from remoting/host/mock_objects.h) | 14 | ||||
-rw-r--r-- | remoting/host/screen_recorder_unittest.cc | 4 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_glue_mock_objects.cc | 13 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_glue_mock_objects.h (renamed from remoting/jingle_glue/mock_objects.h) | 11 | ||||
-rw-r--r-- | remoting/jingle_glue/stream_socket_adapter_unittest.cc | 2 | ||||
-rw-r--r-- | remoting/protocol/connection_to_client_unittest.cc | 2 | ||||
-rw-r--r-- | remoting/protocol/protocol_mock_objects.cc | 39 | ||||
-rw-r--r-- | remoting/protocol/protocol_mock_objects.h (renamed from remoting/protocol/mock_objects.h) | 31 | ||||
-rw-r--r-- | remoting/remoting.gyp | 13 |
11 files changed, 116 insertions, 34 deletions
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index 2a4be8c..a72b504 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc @@ -6,10 +6,10 @@ #include "remoting/host/capturer_fake.h" #include "remoting/host/chromoting_host.h" #include "remoting/host/chromoting_host_context.h" +#include "remoting/host/host_mock_objects.h" #include "remoting/host/in_memory_host_config.h" -#include "remoting/host/mock_objects.h" #include "remoting/proto/video.pb.h" -#include "remoting/protocol/mock_objects.h" +#include "remoting/protocol/protocol_mock_objects.h" #include "remoting/protocol/session_config.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/remoting/host/host_mock_objects.cc b/remoting/host/host_mock_objects.cc new file mode 100644 index 0000000..8cfddec --- /dev/null +++ b/remoting/host/host_mock_objects.cc @@ -0,0 +1,17 @@ +// Copyright (c) 2011 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. + +#include "remoting/host/host_mock_objects.h" + +namespace remoting { + +MockCapturer::MockCapturer() : Capturer(NULL) {} + +MockCapturer::~MockCapturer() {} + +MockChromotingHostContext::MockChromotingHostContext() {} + +MockChromotingHostContext::~MockChromotingHostContext() {} + +} // namespace remoting diff --git a/remoting/host/mock_objects.h b/remoting/host/host_mock_objects.h index 1c705d4..de1fe72 100644 --- a/remoting/host/mock_objects.h +++ b/remoting/host/host_mock_objects.h @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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_ +#ifndef REMOTING_HOST_HOST_MOCK_OBJECTS_H_ +#define REMOTING_HOST_HOST_MOCK_OBJECTS_H_ #include "remoting/host/capturer.h" #include "remoting/host/chromoting_host_context.h" @@ -13,7 +13,8 @@ namespace remoting { class MockCapturer : public Capturer { public: - MockCapturer() : Capturer(NULL) {} + MockCapturer(); + virtual ~MockCapturer(); MOCK_METHOD0(ScreenConfigurationChanged, void()); MOCK_METHOD1(InvalidateRects, void(const InvalidRects& inval_rects)); @@ -31,7 +32,8 @@ class MockCapturer : public Capturer { class MockChromotingHostContext : public ChromotingHostContext { public: - MockChromotingHostContext() {} + MockChromotingHostContext(); + virtual ~MockChromotingHostContext(); MOCK_METHOD0(Start, void()); MOCK_METHOD0(Stop, void()); @@ -46,4 +48,4 @@ class MockChromotingHostContext : public ChromotingHostContext { } // namespace remoting -#endif // REMOTING_HOST_MOCK_OBJECTS_H_ +#endif // REMOTING_HOST_HOST_MOCK_OBJECTS_H_ diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc index 6f61051..ebf484b 100644 --- a/remoting/host/screen_recorder_unittest.cc +++ b/remoting/host/screen_recorder_unittest.cc @@ -5,10 +5,10 @@ #include "base/message_loop.h" #include "base/task.h" #include "remoting/base/mock_objects.h" -#include "remoting/host/mock_objects.h" +#include "remoting/host/host_mock_objects.h" #include "remoting/host/screen_recorder.h" #include "remoting/proto/video.pb.h" -#include "remoting/protocol/mock_objects.h" +#include "remoting/protocol/protocol_mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/remoting/jingle_glue/jingle_glue_mock_objects.cc b/remoting/jingle_glue/jingle_glue_mock_objects.cc new file mode 100644 index 0000000..4ec59e7 --- /dev/null +++ b/remoting/jingle_glue/jingle_glue_mock_objects.cc @@ -0,0 +1,13 @@ +// Copyright (c) 2011 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. + +#include "remoting/jingle_glue/jingle_glue_mock_objects.h" + +namespace remoting { + +MockStream::MockStream() {} + +MockStream::~MockStream() {} + +} // namespace remoting diff --git a/remoting/jingle_glue/mock_objects.h b/remoting/jingle_glue/jingle_glue_mock_objects.h index 08e3cea..505e563 100644 --- a/remoting/jingle_glue/mock_objects.h +++ b/remoting/jingle_glue/jingle_glue_mock_objects.h @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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_JINGLE_GLUE_MOCK_OBJECTS_H_ -#define REMOTING_JINGLE_GLUE_MOCK_OBJECTS_H_ +#ifndef REMOTING_JINGLE_GLUE_JINGLE_GLUE_MOCK_OBJECTS_H_ +#define REMOTING_JINGLE_GLUE_JINGLE_GLUE_MOCK_OBJECTS_H_ #include "testing/gmock/include/gmock/gmock.h" #include "third_party/libjingle/source/talk/base/stream.h" @@ -12,7 +12,8 @@ namespace remoting { class MockStream : public talk_base::StreamInterface { public: - virtual ~MockStream() { } + MockStream(); + virtual ~MockStream(); MOCK_CONST_METHOD0(GetState, talk_base::StreamState()); @@ -28,4 +29,4 @@ class MockStream : public talk_base::StreamInterface { } // namespace remoting -#endif // REMOTING_JINGLE_GLUE_MOCK_OBJECTS_H_ +#endif // REMOTING_JINGLE_GLUE_JINGLE_GLUE_MOCK_OBJECTS_H_ diff --git a/remoting/jingle_glue/stream_socket_adapter_unittest.cc b/remoting/jingle_glue/stream_socket_adapter_unittest.cc index 01997dc..3a7df0f 100644 --- a/remoting/jingle_glue/stream_socket_adapter_unittest.cc +++ b/remoting/jingle_glue/stream_socket_adapter_unittest.cc @@ -9,7 +9,7 @@ #include "net/base/net_errors.h" #include "net/socket/socket.h" #include "remoting/jingle_glue/stream_socket_adapter.h" -#include "remoting/jingle_glue/mock_objects.h" +#include "remoting/jingle_glue/jingle_glue_mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libjingle/source/talk/p2p/base/transportchannel.h" diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc index 1420392..42ac018 100644 --- a/remoting/protocol/connection_to_client_unittest.cc +++ b/remoting/protocol/connection_to_client_unittest.cc @@ -6,7 +6,7 @@ #include "remoting/base/mock_objects.h" #include "remoting/protocol/fake_session.h" #include "remoting/protocol/connection_to_client.h" -#include "remoting/protocol/mock_objects.h" +#include "remoting/protocol/protocol_mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" using ::testing::_; diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc new file mode 100644 index 0000000..8b38954 --- /dev/null +++ b/remoting/protocol/protocol_mock_objects.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2011 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. + +#include "remoting/protocol/protocol_mock_objects.h" + +namespace remoting { +namespace protocol { + +MockConnectionToClient::MockConnectionToClient() {} + +MockConnectionToClient::~MockConnectionToClient() {} + +MockConnectionToClientEventHandler::MockConnectionToClientEventHandler() {} + +MockConnectionToClientEventHandler::~MockConnectionToClientEventHandler() {} + +MockInputStub::MockInputStub() {} + +MockInputStub::~MockInputStub() {} + +MockHostStub::MockHostStub() {} + +MockHostStub::~MockHostStub() {} + +MockClientStub::MockClientStub() {} + +MockClientStub::~MockClientStub() {} + +MockVideoStub::MockVideoStub() {} + +MockVideoStub::~MockVideoStub() {} + +MockSession::MockSession() {} + +MockSession::~MockSession() {} + +} // namespace protocol +} // namespace remoting diff --git a/remoting/protocol/mock_objects.h b/remoting/protocol/protocol_mock_objects.h index c1535d1..e9dd57e 100644 --- a/remoting/protocol/mock_objects.h +++ b/remoting/protocol/protocol_mock_objects.h @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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_PROTOCOL_MOCK_OBJECTS_H_ -#define REMOTING_PROTOCOL_MOCK_OBJECTS_H_ +#ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ +#define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ #include "remoting/proto/internal.pb.h" #include "remoting/protocol/client_stub.h" @@ -21,7 +21,8 @@ class ChromotocolConnection; class MockConnectionToClient : public ConnectionToClient { public: - MockConnectionToClient() {} + MockConnectionToClient(); + virtual ~MockConnectionToClient(); MOCK_METHOD1(Init, void(Session* session)); MOCK_METHOD0(video_stub, VideoStub*()); @@ -34,9 +35,10 @@ class MockConnectionToClient : public ConnectionToClient { }; class MockConnectionToClientEventHandler : - public ConnectionToClient::EventHandler { + public ConnectionToClient::EventHandler { public: - MockConnectionToClientEventHandler() {} + MockConnectionToClientEventHandler(); + virtual ~MockConnectionToClientEventHandler(); MOCK_METHOD1(OnConnectionOpened, void(ConnectionToClient* connection)); MOCK_METHOD1(OnConnectionClosed, void(ConnectionToClient* connection)); @@ -48,7 +50,8 @@ class MockConnectionToClientEventHandler : class MockInputStub : public InputStub { public: - MockInputStub() {} + MockInputStub(); + virtual ~MockInputStub(); MOCK_METHOD2(InjectKeyEvent, void(const KeyEvent* event, Task* done)); MOCK_METHOD2(InjectMouseEvent, void(const MouseEvent* event, Task* done)); @@ -59,7 +62,8 @@ class MockInputStub : public InputStub { class MockHostStub : public HostStub { public: - MockHostStub() {} + MockHostStub(); + ~MockHostStub(); MOCK_METHOD2(SuggestResolution, void(const SuggestResolutionRequest* msg, Task* done)); @@ -72,7 +76,8 @@ class MockHostStub : public HostStub { class MockClientStub : public ClientStub { public: - MockClientStub() {} + MockClientStub(); + virtual ~MockClientStub(); MOCK_METHOD2(NotifyResolution, void(const NotifyResolutionRequest* msg, Task* done)); @@ -85,7 +90,8 @@ class MockClientStub : public ClientStub { class MockVideoStub : public VideoStub { public: - MockVideoStub() {} + MockVideoStub(); + virtual ~MockVideoStub(); MOCK_METHOD2(ProcessVideoPacket, void(const VideoPacket* video_packet, Task* done)); @@ -97,7 +103,8 @@ class MockVideoStub : public VideoStub { class MockSession : public Session { public: - MockSession() {} + MockSession(); + virtual ~MockSession(); MOCK_METHOD1(SetStateChangeCallback, void(StateChangeCallback* callback)); MOCK_METHOD0(control_channel, net::Socket*()); @@ -123,4 +130,4 @@ class MockSession : public Session { } // namespace protocol } // namespace remoting -#endif // REMOTING_PROTOCOL_MOCK_OBJECTS_H_ +#endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 88b75ce..0ee8142 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -468,19 +468,21 @@ 'host/access_verifier_unittest.cc', 'host/chromoting_host_context_unittest.cc', 'host/chromoting_host_unittest.cc', - 'host/differ_unittest.cc', 'host/differ_block_unittest.cc', + 'host/differ_unittest.cc', 'host/heartbeat_sender_unittest.cc', 'host/host_key_pair_unittest.cc', + 'host/host_mock_objects.cc', + 'host/host_mock_objects.h', 'host/json_host_config_unittest.cc', - 'host/mock_objects.h', 'host/screen_recorder_unittest.cc', 'host/test_key_pair.h', 'jingle_glue/channel_socket_adapter_unittest.cc', + 'jingle_glue/iq_request_unittest.cc', 'jingle_glue/jingle_client_unittest.cc', + 'jingle_glue/jingle_glue_mock_objects.cc', + 'jingle_glue/jingle_glue_mock_objects.h', 'jingle_glue/jingle_thread_unittest.cc', - 'jingle_glue/iq_request_unittest.cc', - 'jingle_glue/mock_objects.h', 'jingle_glue/stream_socket_adapter_unittest.cc', 'protocol/connection_to_client_unittest.cc', 'protocol/fake_session.cc', @@ -488,7 +490,8 @@ 'protocol/jingle_session_unittest.cc', 'protocol/message_decoder_unittest.cc', 'protocol/message_reader_unittest.cc', - 'protocol/mock_objects.h', + 'protocol/protocol_mock_objects.cc', + 'protocol/protocol_mock_objects.h', 'protocol/rtp_video_reader_unittest.cc', 'protocol/rtp_video_writer_unittest.cc', 'protocol/session_manager_pair.cc', |