summaryrefslogtreecommitdiffstats
path: root/chrome/common/ipc_test_sink.cc
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 23:50:27 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 23:50:27 +0000
commit3ff2a10362f73dfaf2b6509f6553f963cdbc7b7d (patch)
tree2b2e824e76b9b6c473ab91933a1759e10c9e685d /chrome/common/ipc_test_sink.cc
parentf63ad079d7c5b1bcd6a8b42aed298de328be0811 (diff)
downloadchromium_src-3ff2a10362f73dfaf2b6509f6553f963cdbc7b7d.zip
chromium_src-3ff2a10362f73dfaf2b6509f6553f963cdbc7b7d.tar.gz
chromium_src-3ff2a10362f73dfaf2b6509f6553f963cdbc7b7d.tar.bz2
Move the TestSink for doing IPC tests from chrome/common into IPC and create a new IPC test_support project that references it.
This is necessary because I want to make a test that uses the sink outside of chrome. TEST=this is a test BUG=none Review URL: http://codereview.chromium.org/6290008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72044 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/ipc_test_sink.cc')
-rw-r--r--chrome/common/ipc_test_sink.cc59
1 files changed, 0 insertions, 59 deletions
diff --git a/chrome/common/ipc_test_sink.cc b/chrome/common/ipc_test_sink.cc
deleted file mode 100644
index 69d328c..0000000
--- a/chrome/common/ipc_test_sink.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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.
-
-#include "chrome/common/ipc_test_sink.h"
-#include "ipc/ipc_message.h"
-
-namespace IPC {
-
-TestSink::TestSink() {
-}
-
-TestSink::~TestSink() {
-}
-
-bool TestSink::Send(IPC::Message* message) {
- OnMessageReceived(*message);
- delete message;
- return true;
-}
-
-bool TestSink::OnMessageReceived(const Message& msg) {
- messages_.push_back(Message(msg));
- return true;
-}
-
-void TestSink::ClearMessages() {
- messages_.clear();
-}
-
-const Message* TestSink::GetMessageAt(size_t index) const {
- if (index >= messages_.size())
- return NULL;
- return &messages_[index];
-}
-
-const Message* TestSink::GetFirstMessageMatching(uint32 id) const {
- for (size_t i = 0; i < messages_.size(); i++) {
- if (messages_[i].type() == id)
- return &messages_[i];
- }
- return NULL;
-}
-
-const Message* TestSink::GetUniqueMessageMatching(uint32 id) const {
- size_t found_index = 0;
- size_t found_count = 0;
- for (size_t i = 0; i < messages_.size(); i++) {
- if (messages_[i].type() == id) {
- found_count++;
- found_index = i;
- }
- }
- if (found_count != 1)
- return NULL; // Didn't find a unique one.
- return &messages_[found_index];
-}
-
-} // namespace IPC