| 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "ipc/ipc_message.h" | 6 #include "ipc/ipc_message.h" |
| 7 #include "ipc/ipc_message_utils.h" | 7 #include "ipc/ipc_message_utils.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace IPC { | 10 using namespace IPC; |
| 11 |
| 12 namespace { |
| 11 | 13 |
| 12 // Tests nesting of messages as parameters to other messages. | 14 // Tests nesting of messages as parameters to other messages. |
| 13 TEST(IPCMessageUtilsTest, NestedMessages) { | 15 TEST(IPCMessageUtilsTest, NestedMessages) { |
| 14 int32 nested_routing = 12; | 16 int32 nested_routing = 12; |
| 15 uint32 nested_type = 78; | 17 uint32 nested_type = 78; |
| 16 int nested_content = 456789; | 18 int nested_content = 456789; |
| 17 Message::PriorityValue nested_priority = Message::PRIORITY_HIGH; | 19 Message::PriorityValue nested_priority = Message::PRIORITY_HIGH; |
| 18 Message nested_msg(nested_routing, nested_type, nested_priority); | 20 Message nested_msg(nested_routing, nested_type, nested_priority); |
| 19 nested_msg.set_sync(); | 21 nested_msg.set_sync(); |
| 20 ParamTraits<int>::Write(&nested_msg, nested_content); | 22 ParamTraits<int>::Write(&nested_msg, nested_content); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 FilePath okPath(okString); | 61 FilePath okPath(okString); |
| 60 FilePath badPath(badString); | 62 FilePath badPath(badString); |
| 61 ParamTraits<FilePath>::Write(&message, okPath); | 63 ParamTraits<FilePath>::Write(&message, okPath); |
| 62 ParamTraits<FilePath>::Write(&message, badPath); | 64 ParamTraits<FilePath>::Write(&message, badPath); |
| 63 | 65 |
| 64 PickleIterator iter(message); | 66 PickleIterator iter(message); |
| 65 ASSERT_TRUE(ParamTraits<FilePath>::Read(&message, &iter, &okPath)); | 67 ASSERT_TRUE(ParamTraits<FilePath>::Read(&message, &iter, &okPath)); |
| 66 ASSERT_FALSE(ParamTraits<FilePath>::Read(&message, &iter, &badPath)); | 68 ASSERT_FALSE(ParamTraits<FilePath>::Read(&message, &iter, &badPath)); |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace IPC | 71 } // namespace |
| OLD | NEW |