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 "dbus/message.h" | 5 #include "dbus/message.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/eintr_wrapper.h" | 8 #include "base/eintr_wrapper.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 EXPECT_EQ(5U, uint32_value); | 90 EXPECT_EQ(5U, uint32_value); |
91 EXPECT_EQ(6, int64_value); | 91 EXPECT_EQ(6, int64_value); |
92 EXPECT_EQ(7U, uint64_value); | 92 EXPECT_EQ(7U, uint64_value); |
93 EXPECT_DOUBLE_EQ(8.0, double_value); | 93 EXPECT_DOUBLE_EQ(8.0, double_value); |
94 EXPECT_EQ("string", string_value); | 94 EXPECT_EQ("string", string_value); |
95 EXPECT_EQ(dbus::ObjectPath("/object/path"), object_path_value); | 95 EXPECT_EQ(dbus::ObjectPath("/object/path"), object_path_value); |
96 } | 96 } |
97 | 97 |
98 // Check all basic types can be properly written and read. | 98 // Check all basic types can be properly written and read. |
99 TEST(MessageTest, AppendAndPopFileDescriptor) { | 99 TEST(MessageTest, AppendAndPopFileDescriptor) { |
100 if (!dbus::kDBusTypeUnixFdIsSupported) { | 100 if (!dbus::IsDBusTypeUnixFdSupported()) { |
101 LOG(WARNING) << "FD passing is not supported"; | 101 LOG(WARNING) << "FD passing is not supported"; |
102 return; | 102 return; |
103 } | 103 } |
104 | 104 |
105 scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty()); | 105 scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty()); |
106 dbus::MessageWriter writer(message.get()); | 106 dbus::MessageWriter writer(message.get()); |
107 | 107 |
108 // Append stdout. | 108 // Append stdout. |
109 dbus::FileDescriptor temp(1); | 109 dbus::FileDescriptor temp(1); |
110 // Descriptor should not be valid until checked. | 110 // Descriptor should not be valid until checked. |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 dbus::MessageWriter writer(message.get()); | 621 dbus::MessageWriter writer(message.get()); |
622 writer.AppendString(kLongString); | 622 writer.AppendString(kLongString); |
623 | 623 |
624 ASSERT_EQ("message_type: MESSAGE_METHOD_RETURN\n" | 624 ASSERT_EQ("message_type: MESSAGE_METHOD_RETURN\n" |
625 "signature: s\n\n" | 625 "signature: s\n\n" |
626 "string \"oooooooooooooooooooooooooooooooooooooooooooooooo" | 626 "string \"oooooooooooooooooooooooooooooooooooooooooooooooo" |
627 "oooooooooooooooooooooooooooooooooooooooooooooooooooo... " | 627 "oooooooooooooooooooooooooooooooooooooooooooooooooooo... " |
628 "(1000 bytes in total)\"\n", | 628 "(1000 bytes in total)\"\n", |
629 message->ToString()); | 629 message->ToString()); |
630 } | 630 } |
OLD | NEW |