| OLD | NEW |
| 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 "ipc/ipc_message.h" | 5 #include "ipc/ipc_message.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bad_msg.WriteInt(99); | 81 bad_msg.WriteInt(99); |
| 82 iter = PickleIterator(bad_msg); | 82 iter = PickleIterator(bad_msg); |
| 83 EXPECT_FALSE(IPC::ReadParam(&bad_msg, &iter, &output)); | 83 EXPECT_FALSE(IPC::ReadParam(&bad_msg, &iter, &output)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 class IPCMessageParameterTest : public testing::Test { | 86 class IPCMessageParameterTest : public testing::Test { |
| 87 public: | 87 public: |
| 88 IPCMessageParameterTest() : extra_param_("extra_param"), called_(false) {} | 88 IPCMessageParameterTest() : extra_param_("extra_param"), called_(false) {} |
| 89 | 89 |
| 90 bool OnMessageReceived(const IPC::Message& message) { | 90 bool OnMessageReceived(const IPC::Message& message) { |
| 91 bool msg_is_ok = true; | |
| 92 bool handled = true; | 91 bool handled = true; |
| 93 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(IPCMessageParameterTest, message, | 92 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(IPCMessageParameterTest, message, |
| 94 msg_is_ok, &extra_param_) | 93 &extra_param_) |
| 95 IPC_MESSAGE_HANDLER(TestMsgClassEmpty, OnEmpty) | 94 IPC_MESSAGE_HANDLER(TestMsgClassEmpty, OnEmpty) |
| 96 IPC_MESSAGE_HANDLER(TestMsgClassI, OnInt) | 95 IPC_MESSAGE_HANDLER(TestMsgClassI, OnInt) |
| 97 //IPC_MESSAGE_HANDLER(TestMsgClassIS, OnSync) | 96 //IPC_MESSAGE_HANDLER(TestMsgClassIS, OnSync) |
| 98 IPC_MESSAGE_UNHANDLED(handled = false) | 97 IPC_MESSAGE_UNHANDLED(handled = false) |
| 99 IPC_END_MESSAGE_MAP() | 98 IPC_END_MESSAGE_MAP() |
| 100 | 99 |
| 101 return handled; | 100 return handled; |
| 102 } | 101 } |
| 103 | 102 |
| 104 void OnEmpty(std::string* extra_param) { | 103 void OnEmpty(std::string* extra_param) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 /* TODO: handle sync IPCs | 143 /* TODO: handle sync IPCs |
| 145 TEST_F(IPCMessageParameterTest, Sync) { | 144 TEST_F(IPCMessageParameterTest, Sync) { |
| 146 std::string output; | 145 std::string output; |
| 147 TestMsgClassIS message(42, &output); | 146 TestMsgClassIS message(42, &output); |
| 148 EXPECT_TRUE(OnMessageReceived(message)); | 147 EXPECT_TRUE(OnMessageReceived(message)); |
| 149 EXPECT_TRUE(called_); | 148 EXPECT_TRUE(called_); |
| 150 EXPECT_EQ(output, std::string("out")); | 149 EXPECT_EQ(output, std::string("out")); |
| 151 }*/ | 150 }*/ |
| 152 | 151 |
| 153 } // namespace | 152 } // namespace |
| OLD | NEW |