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

Side by Side Diff: ipc/sync_socket_unittest.cc

Issue 645623006: Standardize usage of virtual/override/final in ipc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/sync_socket.h" 5 #include "base/sync_socket.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string> 8 #include <string>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // messages from the client. 51 // messages from the client.
52 class SyncSocketServerListener : public IPC::Listener { 52 class SyncSocketServerListener : public IPC::Listener {
53 public: 53 public:
54 SyncSocketServerListener() : chan_(NULL) { 54 SyncSocketServerListener() : chan_(NULL) {
55 } 55 }
56 56
57 void Init(IPC::Channel* chan) { 57 void Init(IPC::Channel* chan) {
58 chan_ = chan; 58 chan_ = chan;
59 } 59 }
60 60
61 virtual bool OnMessageReceived(const IPC::Message& msg) override { 61 bool OnMessageReceived(const IPC::Message& msg) override {
62 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 62 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
63 IPC_BEGIN_MESSAGE_MAP(SyncSocketServerListener, msg) 63 IPC_BEGIN_MESSAGE_MAP(SyncSocketServerListener, msg)
64 IPC_MESSAGE_HANDLER(MsgClassSetHandle, OnMsgClassSetHandle) 64 IPC_MESSAGE_HANDLER(MsgClassSetHandle, OnMsgClassSetHandle)
65 IPC_MESSAGE_HANDLER(MsgClassShutdown, OnMsgClassShutdown) 65 IPC_MESSAGE_HANDLER(MsgClassShutdown, OnMsgClassShutdown)
66 IPC_END_MESSAGE_MAP() 66 IPC_END_MESSAGE_MAP()
67 } 67 }
68 return true; 68 return true;
69 } 69 }
70 70
71 private: 71 private:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 class SyncSocketClientListener : public IPC::Listener { 122 class SyncSocketClientListener : public IPC::Listener {
123 public: 123 public:
124 SyncSocketClientListener() { 124 SyncSocketClientListener() {
125 } 125 }
126 126
127 void Init(base::SyncSocket* socket, IPC::Channel* chan) { 127 void Init(base::SyncSocket* socket, IPC::Channel* chan) {
128 socket_ = socket; 128 socket_ = socket;
129 chan_ = chan; 129 chan_ = chan;
130 } 130 }
131 131
132 virtual bool OnMessageReceived(const IPC::Message& msg) override { 132 bool OnMessageReceived(const IPC::Message& msg) override {
133 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 133 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
134 IPC_BEGIN_MESSAGE_MAP(SyncSocketClientListener, msg) 134 IPC_BEGIN_MESSAGE_MAP(SyncSocketClientListener, msg)
135 IPC_MESSAGE_HANDLER(MsgClassResponse, OnMsgClassResponse) 135 IPC_MESSAGE_HANDLER(MsgClassResponse, OnMsgClassResponse)
136 IPC_END_MESSAGE_MAP() 136 IPC_END_MESSAGE_MAP()
137 } 137 }
138 return true; 138 return true;
139 } 139 }
140 140
141 private: 141 private:
142 // When a response is received from the server, it sends the same 142 // When a response is received from the server, it sends the same
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 // Read from another socket to free some space for a new write. 300 // Read from another socket to free some space for a new write.
301 char hello[kHelloStringLength] = {0}; 301 char hello[kHelloStringLength] = {0};
302 pair[1].Receive(&hello[0], sizeof(hello)); 302 pair[1].Receive(&hello[0], sizeof(hello));
303 303
304 // Should be able to write more data to the buffer now. 304 // Should be able to write more data to the buffer now.
305 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength)); 305 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength));
306 } 306 }
307 307
308 } // namespace 308 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698