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

Side by Side Diff: ipc/ipc_channel_posix_unittest.cc

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_channel.h ('k') | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // These tests are POSIX only. 5 // These tests are POSIX only.
6 6
7 #include "ipc/ipc_channel_posix.h" 7 #include "ipc/ipc_channel_posix.h"
8 8
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 25 matching lines...) Expand all
36 CONNECTED, 36 CONNECTED,
37 DENIED, 37 DENIED,
38 LISTEN_ERROR 38 LISTEN_ERROR
39 }; 39 };
40 40
41 IPCChannelPosixTestListener(bool quit_only_on_message) 41 IPCChannelPosixTestListener(bool quit_only_on_message)
42 : status_(DISCONNECTED), quit_only_on_message_(quit_only_on_message) {} 42 : status_(DISCONNECTED), quit_only_on_message_(quit_only_on_message) {}
43 43
44 virtual ~IPCChannelPosixTestListener() {} 44 virtual ~IPCChannelPosixTestListener() {}
45 45
46 virtual void OnMessageReceived(const IPC::Message& message) { 46 virtual bool OnMessageReceived(const IPC::Message& message) {
47 EXPECT_EQ(message.type(), QUIT_MESSAGE); 47 EXPECT_EQ(message.type(), QUIT_MESSAGE);
48 status_ = MESSAGE_RECEIVED; 48 status_ = MESSAGE_RECEIVED;
49 QuitRunLoop(); 49 QuitRunLoop();
50 return true;
50 } 51 }
51 52
52 virtual void OnChannelConnected(int32 peer_pid) { 53 virtual void OnChannelConnected(int32 peer_pid) {
53 status_ = CONNECTED; 54 status_ = CONNECTED;
54 if (!quit_only_on_message_) { 55 if (!quit_only_on_message_) {
55 QuitRunLoop(); 56 QuitRunLoop();
56 } 57 }
57 } 58 }
58 59
59 virtual void OnChannelError() { 60 virtual void OnChannelError() {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 bool connected = channel.Connect(); 347 bool connected = channel.Connect();
347 if (connected) { 348 if (connected) {
348 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms()); 349 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms());
349 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); 350 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
350 } else { 351 } else {
351 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); 352 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status());
352 } 353 }
353 return 0; 354 return 0;
354 } 355 }
355 356
OLDNEW
« no previous file with comments | « ipc/ipc_channel.h ('k') | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698