| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <iostream> | 6 #include <iostream> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 CLIENT_MALFORMED_IPC, // Sent to client if server detects bad message. | 109 CLIENT_MALFORMED_IPC, // Sent to client if server detects bad message. |
| 110 CLIENT_UNHANDLED_IPC // Sent to client if server detects unhanded IPC. | 110 CLIENT_UNHANDLED_IPC // Sent to client if server detects unhanded IPC. |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 // Generic message class that is an int followed by a wstring. | 113 // Generic message class that is an int followed by a wstring. |
| 114 class MsgClassIS : public IPC::MessageWithTuple< Tuple2<int, std::wstring> > { | 114 class MsgClassIS : public IPC::MessageWithTuple< Tuple2<int, std::wstring> > { |
| 115 public: | 115 public: |
| 116 enum { ID = SERVER_FIRST_IPC_TYPE }; | 116 enum { ID = SERVER_FIRST_IPC_TYPE }; |
| 117 MsgClassIS(const int& arg1, const std::wstring& arg2) | 117 MsgClassIS(const int& arg1, const std::wstring& arg2) |
| 118 : IPC::MessageWithTuple< Tuple2<int, std::wstring> >( | 118 : IPC::MessageWithTuple< Tuple2<int, std::wstring> >( |
| 119 MSG_ROUTING_CONTROL, ID, MakeTuple(arg1, arg2)) {} | 119 MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2)) {} |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 // Generic message class that is a wstring followed by an int. | 122 // Generic message class that is a wstring followed by an int. |
| 123 class MsgClassSI : public IPC::MessageWithTuple< Tuple2<std::wstring, int> > { | 123 class MsgClassSI : public IPC::MessageWithTuple< Tuple2<std::wstring, int> > { |
| 124 public: | 124 public: |
| 125 enum { ID = SERVER_SECOND_IPC_TYPE }; | 125 enum { ID = SERVER_SECOND_IPC_TYPE }; |
| 126 MsgClassSI(const std::wstring& arg1, const int& arg2) | 126 MsgClassSI(const std::wstring& arg1, const int& arg2) |
| 127 : IPC::MessageWithTuple< Tuple2<std::wstring, int> >( | 127 : IPC::MessageWithTuple< Tuple2<std::wstring, int> >( |
| 128 MSG_ROUTING_CONTROL, ID, MakeTuple(arg1, arg2)) {} | 128 MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2)) {} |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 // Message to create a mutex in the IPC server, using the received name. | 131 // Message to create a mutex in the IPC server, using the received name. |
| 132 class MsgDoMutex : public IPC::MessageWithTuple< Tuple2<std::wstring, int> > { | 132 class MsgDoMutex : public IPC::MessageWithTuple< Tuple2<std::wstring, int> > { |
| 133 public: | 133 public: |
| 134 enum { ID = SERVER_THIRD_IPC_TYPE }; | 134 enum { ID = SERVER_THIRD_IPC_TYPE }; |
| 135 MsgDoMutex(const std::wstring& mutex_name, const int& unused) | 135 MsgDoMutex(const std::wstring& mutex_name, const int& unused) |
| 136 : IPC::MessageWithTuple< Tuple2<std::wstring, int> >( | 136 : IPC::MessageWithTuple< Tuple2<std::wstring, int> >( |
| 137 MSG_ROUTING_CONTROL, ID, MakeTuple(mutex_name, unused)) {} | 137 MSG_ROUTING_CONTROL, ID, MakeRefTuple(mutex_name, unused)) {} |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 class SimpleListener : public IPC::Channel::Listener { | 140 class SimpleListener : public IPC::Channel::Listener { |
| 141 public: | 141 public: |
| 142 SimpleListener() : other_(NULL) { | 142 SimpleListener() : other_(NULL) { |
| 143 } | 143 } |
| 144 void Init(IPC::Message::Sender* s) { | 144 void Init(IPC::Message::Sender* s) { |
| 145 other_ = s; | 145 other_ = s; |
| 146 } | 146 } |
| 147 protected: | 147 protected: |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID, | 421 msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID, |
| 422 IPC::Message::PRIORITY_NORMAL); | 422 IPC::Message::PRIORITY_NORMAL); |
| 423 msg->WriteInt(0x64); | 423 msg->WriteInt(0x64); |
| 424 msg->WriteInt(0x32); | 424 msg->WriteInt(0x32); |
| 425 EXPECT_FALSE(server.OnMessageReceived(*msg)); | 425 EXPECT_FALSE(server.OnMessageReceived(*msg)); |
| 426 delete msg; | 426 delete msg; |
| 427 | 427 |
| 428 EXPECT_EQ(0, server.unhandled_msgs()); | 428 EXPECT_EQ(0, server.unhandled_msgs()); |
| 429 #endif | 429 #endif |
| 430 } | 430 } |
| OLD | NEW |