Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: ipc/mojo/ipc_channel_mojo_unittest.cc

Issue 536213002: Add ipc_mojo_perftests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed garbage Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/mojo/ipc_channel_mojo.cc ('k') | ipc/mojo/ipc_mojo.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo_unittest.cc
diff --git a/ipc/mojo/ipc_channel_mojo_unittest.cc b/ipc/mojo/ipc_channel_mojo_unittest.cc
index 60069b7dfdfad3d2b4d6b7c541ea40ba6c083151..8ea828f4fb01f131848f65d431df9dfd4aad7d79 100644
--- a/ipc/mojo/ipc_channel_mojo_unittest.cc
+++ b/ipc/mojo/ipc_channel_mojo_unittest.cc
@@ -55,33 +55,11 @@ class ListenerThatExpectsOK : public IPC::Listener {
bool received_ok_;
};
-class ListenerThatShouldBeNeverCalled : public IPC::Listener {
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
- NOTREACHED();
- return true;
- }
-
- virtual void OnChannelError() OVERRIDE {
- NOTREACHED();
- }
-
- virtual void OnChannelConnected(int32 peer_pid) OVERRIDE {
- NOTREACHED();
- }
-
- virtual void OnBadMessageReceived(const IPC::Message& message) OVERRIDE {
- NOTREACHED();
- }
-};
-
class ChannelClient {
public:
explicit ChannelClient(IPC::Listener* listener, const char* name) {
- scoped_ptr<IPC::Channel> bootstrap(IPC::Channel::CreateClient(
- IPCTestBase::GetChannelName(name),
- &never_called_));
channel_ = IPC::ChannelMojo::Create(
- bootstrap.Pass(), IPC::Channel::MODE_CLIENT, listener,
+ IPCTestBase::GetChannelName(name), IPC::Channel::MODE_CLIENT, listener,
main_message_loop_.message_loop_proxy());
}
@@ -93,31 +71,20 @@ class ChannelClient {
private:
scoped_ptr<IPC::ChannelMojo> channel_;
- ListenerThatShouldBeNeverCalled never_called_;
base::MessageLoopForIO main_message_loop_;
};
class IPCChannelMojoTest : public IPCTestBase {
- public:
- void CreateMojoChannel(IPC::Listener* listener);
-
protected:
- virtual void SetUp() OVERRIDE {
- IPCTestBase::SetUp();
+ virtual scoped_ptr<IPC::ChannelFactory> CreateChannelFactory(
+ const IPC::ChannelHandle& handle,
+ base::TaskRunner* runner) OVERRIDE {
+ return IPC::ChannelMojo::CreateFactory(
+ handle, IPC::Channel::MODE_SERVER, runner);
}
-
- ListenerThatShouldBeNeverCalled never_called_;
};
-void IPCChannelMojoTest::CreateMojoChannel(IPC::Listener* listener) {
- CreateChannel(&never_called_);
- scoped_ptr<IPC::Channel> mojo_channel = IPC::ChannelMojo::Create(
- ReleaseChannel(), IPC::Channel::MODE_SERVER, listener,
- task_runner()).PassAs<IPC::Channel>();
- SetChannel(mojo_channel.PassAs<IPC::Channel>());
-}
-
class TestChannelListenerWithExtraExpectations
: public IPC::TestChannelListener {
public:
@@ -142,7 +109,7 @@ TEST_F(IPCChannelMojoTest, ConnectedFromClient) {
// Set up IPC channel and start client.
TestChannelListenerWithExtraExpectations listener;
- CreateMojoChannel(&listener);
+ CreateChannel(&listener);
listener.Init(sender());
ASSERT_TRUE(ConnectChannel());
ASSERT_TRUE(StartClient());
@@ -236,7 +203,7 @@ TEST_F(IPCChannelMojoTest, SendPlatformHandle) {
Init("IPCChannelMojoTestSendPlatformHandleClient");
ListenerThatExpectsOK listener;
- CreateMojoChannel(&listener);
+ CreateChannel(&listener);
ASSERT_TRUE(ConnectChannel());
ASSERT_TRUE(StartClient());
« no previous file with comments | « ipc/mojo/ipc_channel_mojo.cc ('k') | ipc/mojo/ipc_mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698