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 { |
19 | 21 |
20 TEST(IBusTextTest, WriteReadTest) { | 22 TEST(IBusTextTest, WriteReadTest) { |
21 const char kSampleText[] = "Sample Text"; | 23 const char kSampleText[] = "Sample Text"; |
22 const IBusText::UnderlineAttribute kSampleUnderlineAttribute1 = { | 24 const IBusText::UnderlineAttribute kSampleUnderlineAttribute1 = { |
23 IBusText::IBUS_TEXT_UNDERLINE_SINGLE, 10, 20}; | 25 IBusText::IBUS_TEXT_UNDERLINE_SINGLE, 10, 20}; |
24 | 26 |
25 const IBusText::UnderlineAttribute kSampleUnderlineAttribute2 = { | 27 const IBusText::UnderlineAttribute kSampleUnderlineAttribute2 = { |
26 IBusText::IBUS_TEXT_UNDERLINE_DOUBLE, 11, 21}; | 28 IBusText::IBUS_TEXT_UNDERLINE_DOUBLE, 11, 21}; |
27 | 29 |
28 const IBusText::UnderlineAttribute kSampleUnderlineAttribute3 = { | 30 const IBusText::UnderlineAttribute kSampleUnderlineAttribute3 = { |
(...skipping 20 matching lines...) Expand all Loading... |
49 | 51 |
50 // Read from Response object. | 52 // Read from Response object. |
51 dbus::MessageReader reader(response.get()); | 53 dbus::MessageReader reader(response.get()); |
52 IBusText expected_text; | 54 IBusText expected_text; |
53 ASSERT_TRUE(PopIBusText(&reader, &expected_text)); | 55 ASSERT_TRUE(PopIBusText(&reader, &expected_text)); |
54 EXPECT_EQ(expected_text.text(), kSampleText); | 56 EXPECT_EQ(expected_text.text(), kSampleText); |
55 EXPECT_EQ(3U, expected_text.underline_attributes().size()); | 57 EXPECT_EQ(3U, expected_text.underline_attributes().size()); |
56 EXPECT_EQ(1U, expected_text.selection_attributes().size()); | 58 EXPECT_EQ(1U, expected_text.selection_attributes().size()); |
57 } | 59 } |
58 | 60 |
| 61 } // namespace ibus |
59 } // namespace chromeos | 62 } // namespace chromeos |
OLD | NEW |