Commit 3ff2a103 authored by brettw@google.com's avatar brettw@google.com

Move the TestSink for doing IPC tests from chrome/common into IPC and create a...

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
parent f63ad079
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
#include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/test_tab_contents.h" #include "chrome/browser/tab_contents/test_tab_contents.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/common/ipc_test_sink.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h" #include "chrome/common/render_messages.h"
#include "chrome/test/testing_profile.h" #include "chrome/test/testing_profile.h"
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "ipc/ipc_test_sink.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/form_data.h" #include "webkit/glue/form_data.h"
#include "webkit/glue/form_field.h" #include "webkit/glue/form_field.h"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/scoped_vector.h" #include "base/scoped_vector.h"
#include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/common/ipc_test_sink.h" #include "ipc/ipc_test_sink.h"
class MockRenderProcessHostFactory; class MockRenderProcessHostFactory;
class TransportDIB; class TransportDIB;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "chrome/browser/translate/translate_infobar_delegate.h" #include "chrome/browser/translate/translate_infobar_delegate.h"
#include "chrome/browser/translate/translate_manager.h" #include "chrome/browser/translate/translate_manager.h"
#include "chrome/browser/translate/translate_prefs.h" #include "chrome/browser/translate/translate_prefs.h"
#include "chrome/common/ipc_test_sink.h"
#include "chrome/common/notification_details.h" #include "chrome/common/notification_details.h"
#include "chrome/common/notification_observer_mock.h" #include "chrome/common/notification_observer_mock.h"
#include "chrome/common/notification_registrar.h" #include "chrome/common/notification_registrar.h"
...@@ -26,6 +25,7 @@ ...@@ -26,6 +25,7 @@
#include "chrome/test/testing_browser_process.h" #include "chrome/test/testing_browser_process.h"
#include "chrome/test/testing_profile.h" #include "chrome/test/testing_profile.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "ipc/ipc_test_sink.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "third_party/cld/languages/public/languages.h" #include "third_party/cld/languages/public/languages.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
'browser/policy/proto/device_management_proto.gyp:device_management_proto_cpp', 'browser/policy/proto/device_management_proto.gyp:device_management_proto_cpp',
'theme_resources', 'theme_resources',
'../base/base.gyp:test_support_base', '../base/base.gyp:test_support_base',
'../ipc/ipc.gyp:test_support_ipc',
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
'../testing/gmock.gyp:gmock', '../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest', '../testing/gtest.gyp:gtest',
...@@ -82,8 +83,6 @@ ...@@ -82,8 +83,6 @@
'browser/sync/profile_sync_service_mock.h', 'browser/sync/profile_sync_service_mock.h',
'browser/ui/browser.h', 'browser/ui/browser.h',
'browser/ui/cocoa/browser_test_helper.h', 'browser/ui/cocoa/browser_test_helper.h',
'common/ipc_test_sink.cc',
'common/ipc_test_sink.h',
'common/net/test_url_fetcher_factory.cc', 'common/net/test_url_fetcher_factory.cc',
'common/net/test_url_fetcher_factory.h', 'common/net/test_url_fetcher_factory.h',
'common/notification_observer_mock.cc', 'common/notification_observer_mock.cc',
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#include <string> #include <string>
#include "chrome/common/ipc_test_sink.h"
#include "chrome/renderer/mock_printer.h" #include "chrome/renderer/mock_printer.h"
#include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_thread.h"
#include "ipc/ipc_test_sink.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h"
namespace IPC { namespace IPC {
......
...@@ -74,6 +74,18 @@ ...@@ -74,6 +74,18 @@
}] }]
], ],
}, },
{
'target_name': 'test_support_ipc',
'type': '<(library)',
'dependencies': [
'ipc',
'../base/base.gyp:base',
],
'sources': [
'ipc_test_sink.cc',
'ipc_test_sink.h',
],
},
], ],
} }
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/common/ipc_test_sink.h" #include "ipc/ipc_test_sink.h"
#include "ipc/ipc_message.h" #include "ipc/ipc_message.h"
namespace IPC { namespace IPC {
...@@ -13,7 +14,7 @@ TestSink::TestSink() { ...@@ -13,7 +14,7 @@ TestSink::TestSink() {
TestSink::~TestSink() { TestSink::~TestSink() {
} }
bool TestSink::Send(IPC::Message* message) { bool TestSink::Send(Message* message) {
OnMessageReceived(*message); OnMessageReceived(*message);
delete message; delete message;
return true; return true;
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_COMMON_IPC_TEST_SINK_H_ #ifndef IPC_IPC_TEST_SINK_H_
#define CHROME_COMMON_IPC_TEST_SINK_H_ #define IPC_IPC_TEST_SINK_H_
#pragma once #pragma once
#include <utility> #include <utility>
...@@ -43,7 +43,7 @@ class Message; ...@@ -43,7 +43,7 @@ class Message;
// //
// To hook up the sink, all you need to do is call OnMessageReceived when a // To hook up the sink, all you need to do is call OnMessageReceived when a
// message is received. // message is received.
class TestSink : public IPC::Channel { class TestSink : public Channel {
public: public:
TestSink(); TestSink();
~TestSink(); ~TestSink();
...@@ -88,4 +88,4 @@ class TestSink : public IPC::Channel { ...@@ -88,4 +88,4 @@ class TestSink : public IPC::Channel {
} // namespace IPC } // namespace IPC
#endif // CHROME_COMMON_IPC_TEST_SINK_H_ #endif // IPC_IPC_TEST_SINK_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment