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 // TODO(nona): Add more tests. | 4 // TODO(nona): Add more tests. |
5 | 5 |
6 #include "chromeos/dbus/ibus/ibus_text.h" | 6 #include "chromeos/dbus/ibus/ibus_text.h" |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chromeos/dbus/ibus/ibus_object.h" | 13 #include "chromeos/dbus/ibus/ibus_object.h" |
14 #include "dbus/message.h" | 14 #include "dbus/message.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 // TODO(nona): Remove ibus namespace after complete libibus removal. | |
20 namespace ibus { | |
21 | 19 |
22 TEST(IBusTextTest, WriteReadTest) { | 20 TEST(IBusTextTest, WriteReadTest) { |
23 const char kSampleText[] = "Sample Text"; | 21 const char kSampleText[] = "Sample Text"; |
24 const char kAnnotation[] = "Annotation"; | 22 const char kAnnotation[] = "Annotation"; |
25 const char kDescriptionTitle[] = "Description Title"; | 23 const char kDescriptionTitle[] = "Description Title"; |
26 const char kDescriptionBody[] = "Description Body"; | 24 const char kDescriptionBody[] = "Description Body"; |
27 const IBusText::UnderlineAttribute kSampleUnderlineAttribute1 = { | 25 const IBusText::UnderlineAttribute kSampleUnderlineAttribute1 = { |
28 IBusText::IBUS_TEXT_UNDERLINE_SINGLE, 10, 20}; | 26 IBusText::IBUS_TEXT_UNDERLINE_SINGLE, 10, 20}; |
29 | 27 |
30 const IBusText::UnderlineAttribute kSampleUnderlineAttribute2 = { | 28 const IBusText::UnderlineAttribute kSampleUnderlineAttribute2 = { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 dbus::MessageWriter writer(response.get()); | 90 dbus::MessageWriter writer(response.get()); |
93 AppendStringAsIBusText(kSampleText, &writer); | 91 AppendStringAsIBusText(kSampleText, &writer); |
94 | 92 |
95 // Read from Response object. | 93 // Read from Response object. |
96 dbus::MessageReader reader(response.get()); | 94 dbus::MessageReader reader(response.get()); |
97 std::string result; | 95 std::string result; |
98 ASSERT_TRUE(PopStringFromIBusText(&reader, &result)); | 96 ASSERT_TRUE(PopStringFromIBusText(&reader, &result)); |
99 EXPECT_EQ(kSampleText, result); | 97 EXPECT_EQ(kSampleText, result); |
100 } | 98 } |
101 | 99 |
102 } // namespace ibus | |
103 } // namespace chromeos | 100 } // namespace chromeos |
OLD | NEW |