| 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" | |
| 9 #include "base/logging.h" | 8 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/posix/eintr_wrapper.h" |
| 11 #include "dbus/object_path.h" | 11 #include "dbus/object_path.h" |
| 12 #include "dbus/test_proto.pb.h" | 12 #include "dbus/test_proto.pb.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 // Test that a byte can be properly written and read. We only have this | 15 // Test that a byte can be properly written and read. We only have this |
| 16 // test for byte, as repeating this for other basic types is too redundant. | 16 // test for byte, as repeating this for other basic types is too redundant. |
| 17 TEST(MessageTest, AppendAndPopByte) { | 17 TEST(MessageTest, AppendAndPopByte) { |
| 18 scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty()); | 18 scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty()); |
| 19 dbus::MessageWriter writer(message.get()); | 19 dbus::MessageWriter writer(message.get()); |
| 20 writer.AppendByte(123); // The input is 123. | 20 writer.AppendByte(123); // The input is 123. |
| (...skipping 600 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 |