| Index: chromeos/dbus/ibus/ibus_text_unittest.cc
|
| diff --git a/chromeos/dbus/ibus/ibus_text_unittest.cc b/chromeos/dbus/ibus/ibus_text_unittest.cc
|
| index b3df566b4fa49311fd1140360cd95861effd396b..d87bf39b1c0f2462a1e2bf4bf79603a0bc410648 100644
|
| --- a/chromeos/dbus/ibus/ibus_text_unittest.cc
|
| +++ b/chromeos/dbus/ibus/ibus_text_unittest.cc
|
| @@ -21,6 +21,8 @@ namespace ibus {
|
|
|
| TEST(IBusTextTest, WriteReadTest) {
|
| const char kSampleText[] = "Sample Text";
|
| + const char kAnnotation[] = "Annotation";
|
| + const char kDescription[] = "Description";
|
| const IBusText::UnderlineAttribute kSampleUnderlineAttribute1 = {
|
| IBusText::IBUS_TEXT_UNDERLINE_SINGLE, 10, 20};
|
|
|
| @@ -35,6 +37,8 @@ TEST(IBusTextTest, WriteReadTest) {
|
| // Make IBusText
|
| IBusText text;
|
| text.set_text(kSampleText);
|
| + text.set_annotation(kAnnotation);
|
| + text.set_description(kDescription);
|
| std::vector<IBusText::UnderlineAttribute>* underline_attributes =
|
| text.mutable_underline_attributes();
|
| underline_attributes->push_back(kSampleUnderlineAttribute1);
|
| @@ -53,7 +57,9 @@ TEST(IBusTextTest, WriteReadTest) {
|
| dbus::MessageReader reader(response.get());
|
| IBusText expected_text;
|
| ASSERT_TRUE(PopIBusText(&reader, &expected_text));
|
| - EXPECT_EQ(expected_text.text(), kSampleText);
|
| + EXPECT_EQ(kSampleText, expected_text.text());
|
| + EXPECT_EQ(kAnnotation, expected_text.annotation());
|
| + EXPECT_EQ(kDescription, expected_text.description());
|
| EXPECT_EQ(3U, expected_text.underline_attributes().size());
|
| EXPECT_EQ(1U, expected_text.selection_attributes().size());
|
| }
|
| @@ -90,113 +96,5 @@ TEST(IBusTextTest, PopStringFromIBusTextTest) {
|
| EXPECT_EQ(kSampleText, result);
|
| }
|
|
|
| -TEST(IBusTextTest, ReadAnnotationFieldTest) {
|
| - const char kSampleText[] = "Sample Text";
|
| - const char kSampleAnnotationText[] = "Sample Annotation";
|
| -
|
| - // Create IBusLookupTable.
|
| - scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
|
| - dbus::MessageWriter writer(response.get());
|
| - dbus::MessageWriter top_variant_writer(NULL);
|
| - writer.OpenVariant("(sa{sv}sv)", &top_variant_writer);
|
| - dbus::MessageWriter contents_writer(NULL);
|
| - top_variant_writer.OpenStruct(&contents_writer);
|
| - contents_writer.AppendString("IBusText");
|
| -
|
| - // Write attachment field.
|
| - dbus::MessageWriter attachment_array_writer(NULL);
|
| - contents_writer.OpenArray("{sv}", &attachment_array_writer);
|
| - dbus::MessageWriter entry_writer(NULL);
|
| - attachment_array_writer.OpenDictEntry(&entry_writer);
|
| - entry_writer.AppendString("annotation");
|
| - dbus::MessageWriter variant_writer(NULL);
|
| - entry_writer.OpenVariant("v", &variant_writer);
|
| - dbus::MessageWriter sub_variant_writer(NULL);
|
| - variant_writer.OpenVariant("s", &sub_variant_writer);
|
| - sub_variant_writer.AppendString(kSampleAnnotationText);
|
| -
|
| - // Close attachment field container.
|
| - variant_writer.CloseContainer(&sub_variant_writer);
|
| - entry_writer.CloseContainer(&variant_writer);
|
| - attachment_array_writer.CloseContainer(&entry_writer);
|
| - contents_writer.CloseContainer(&attachment_array_writer);
|
| -
|
| - // Write IBusText contents.
|
| - contents_writer.AppendString(kSampleText);
|
| - IBusObjectWriter ibus_attr_list_writer("IBusAttrList", "av",
|
| - &contents_writer);
|
| - dbus::MessageWriter attribute_array_writer(NULL);
|
| - ibus_attr_list_writer.OpenArray("v", &attribute_array_writer);
|
| - ibus_attr_list_writer.CloseContainer(&attribute_array_writer);
|
| - ibus_attr_list_writer.CloseAll();
|
| -
|
| - // Close all containers.
|
| - top_variant_writer.CloseContainer(&contents_writer);
|
| - writer.CloseContainer(&top_variant_writer);
|
| -
|
| - // Read IBusText.
|
| - IBusText ibus_text;
|
| - dbus::MessageReader reader(response.get());
|
| - PopIBusText(&reader, &ibus_text);
|
| -
|
| - // Check values.
|
| - EXPECT_EQ(kSampleText, ibus_text.text());
|
| - EXPECT_EQ(kSampleAnnotationText, ibus_text.annotation());
|
| -}
|
| -
|
| -TEST(IBusTextTest, ReadDescriptionFieldTest) {
|
| - const char kSampleText[] = "Sample Text";
|
| - const char kSampleDescriptionText[] = "Sample Description";
|
| -
|
| - // Create IBusLookupTable.
|
| - scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
|
| - dbus::MessageWriter writer(response.get());
|
| - dbus::MessageWriter top_variant_writer(NULL);
|
| - writer.OpenVariant("(sa{sv}sv)", &top_variant_writer);
|
| - dbus::MessageWriter contents_writer(NULL);
|
| - top_variant_writer.OpenStruct(&contents_writer);
|
| - contents_writer.AppendString("IBusText");
|
| -
|
| - // Write attachment field.
|
| - dbus::MessageWriter attachment_array_writer(NULL);
|
| - contents_writer.OpenArray("{sv}", &attachment_array_writer);
|
| - dbus::MessageWriter entry_writer(NULL);
|
| - attachment_array_writer.OpenDictEntry(&entry_writer);
|
| - entry_writer.AppendString("description");
|
| - dbus::MessageWriter variant_writer(NULL);
|
| - entry_writer.OpenVariant("v", &variant_writer);
|
| - dbus::MessageWriter sub_variant_writer(NULL);
|
| - variant_writer.OpenVariant("s", &sub_variant_writer);
|
| - sub_variant_writer.AppendString(kSampleDescriptionText);
|
| -
|
| - // Close attachment field container.
|
| - variant_writer.CloseContainer(&sub_variant_writer);
|
| - entry_writer.CloseContainer(&variant_writer);
|
| - attachment_array_writer.CloseContainer(&entry_writer);
|
| - contents_writer.CloseContainer(&attachment_array_writer);
|
| -
|
| - // Write IBusText contents.
|
| - contents_writer.AppendString(kSampleText);
|
| - IBusObjectWriter ibus_attr_list_writer("IBusAttrList", "av",
|
| - &contents_writer);
|
| - dbus::MessageWriter attribute_array_writer(NULL);
|
| - ibus_attr_list_writer.OpenArray("v", &attribute_array_writer);
|
| - ibus_attr_list_writer.CloseContainer(&attribute_array_writer);
|
| - ibus_attr_list_writer.CloseAll();
|
| -
|
| - // Close all containers.
|
| - top_variant_writer.CloseContainer(&contents_writer);
|
| - writer.CloseContainer(&top_variant_writer);
|
| -
|
| - // Read IBusText.
|
| - IBusText ibus_text;
|
| - dbus::MessageReader reader(response.get());
|
| - PopIBusText(&reader, &ibus_text);
|
| -
|
| - // Check values.
|
| - EXPECT_EQ(kSampleText, ibus_text.text());
|
| - EXPECT_EQ(kSampleDescriptionText, ibus_text.description());
|
| -}
|
| -
|
| } // namespace ibus
|
| } // namespace chromeos
|
|
|