Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chromeos/dbus/ibus/ibus_text_unittest.cc

Issue 10332228: Extends IBusText I/O function. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply comments. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/dbus/ibus/ibus_text.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // Read from Response object. 52 // Read from Response object.
53 dbus::MessageReader reader(response.get()); 53 dbus::MessageReader reader(response.get());
54 IBusText expected_text; 54 IBusText expected_text;
55 ASSERT_TRUE(PopIBusText(&reader, &expected_text)); 55 ASSERT_TRUE(PopIBusText(&reader, &expected_text));
56 EXPECT_EQ(expected_text.text(), kSampleText); 56 EXPECT_EQ(expected_text.text(), kSampleText);
57 EXPECT_EQ(3U, expected_text.underline_attributes().size()); 57 EXPECT_EQ(3U, expected_text.underline_attributes().size());
58 EXPECT_EQ(1U, expected_text.selection_attributes().size()); 58 EXPECT_EQ(1U, expected_text.selection_attributes().size());
59 } 59 }
60 60
61 TEST(IBusTextTest, StringAsIBusTextTest) {
62 const char kSampleText[] = "Sample Text";
63
64 // Write to Response object.
65 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
66 dbus::MessageWriter writer(response.get());
67 AppendStringAsIBusText(kSampleText, &writer);
68
69 // Read from Response object.
70 dbus::MessageReader reader(response.get());
71 IBusText ibus_text;
72 ASSERT_TRUE(PopIBusText(&reader, &ibus_text));
73 EXPECT_EQ(kSampleText, ibus_text.text());
74 EXPECT_TRUE(ibus_text.underline_attributes().empty());
75 EXPECT_TRUE(ibus_text.selection_attributes().empty());
76 }
77
78 TEST(IBusTextTest, PopStringFromIBusTextTest) {
79 const char kSampleText[] = "Sample Text";
80
81 // Write to Response object.
82 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
83 dbus::MessageWriter writer(response.get());
84 AppendStringAsIBusText(kSampleText, &writer);
85
86 // Read from Response object.
87 dbus::MessageReader reader(response.get());
88 std::string result;
89 ASSERT_TRUE(PopStringFromIBusText(&reader, &result));
90 EXPECT_EQ(kSampleText, result);
91 }
92
61 } // namespace ibus 93 } // namespace ibus
62 } // namespace chromeos 94 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/ibus/ibus_text.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698