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

Side by Side Diff: chromeos/ime/composition_text_unittest.cc

Issue 163023002: Use base::string16 for CompositionText.Text instead of converting to utf-8 and back unnecessarily. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test compile Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/ime/composition_text.h ('k') | ui/base/ime/input_method_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ime/composition_text.h" 6 #include "chromeos/ime/composition_text.h"
7 7
8 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 namespace chromeos { 11 namespace chromeos {
11 12
12 TEST(CompositionTextTest, CopyTest) { 13 TEST(CompositionTextTest, CopyTest) {
13 const char kSampleText[] = "Sample Text"; 14 const base::string16 kSampleText = base::UTF8ToUTF16("Sample Text");
14 const CompositionText::UnderlineAttribute kSampleUnderlineAttribute1 = { 15 const CompositionText::UnderlineAttribute kSampleUnderlineAttribute1 = {
15 CompositionText::COMPOSITION_TEXT_UNDERLINE_SINGLE, 10, 20}; 16 CompositionText::COMPOSITION_TEXT_UNDERLINE_SINGLE, 10, 20};
16 17
17 const CompositionText::UnderlineAttribute kSampleUnderlineAttribute2 = { 18 const CompositionText::UnderlineAttribute kSampleUnderlineAttribute2 = {
18 CompositionText::COMPOSITION_TEXT_UNDERLINE_DOUBLE, 11, 21}; 19 CompositionText::COMPOSITION_TEXT_UNDERLINE_DOUBLE, 11, 21};
19 20
20 const CompositionText::UnderlineAttribute kSampleUnderlineAttribute3 = { 21 const CompositionText::UnderlineAttribute kSampleUnderlineAttribute3 = {
21 CompositionText::COMPOSITION_TEXT_UNDERLINE_ERROR, 12, 22}; 22 CompositionText::COMPOSITION_TEXT_UNDERLINE_ERROR, 12, 22};
22 23
23 // Make CompositionText 24 // Make CompositionText
(...skipping 20 matching lines...) Expand all
44 text2.underline_attributes()[i].start_index); 45 text2.underline_attributes()[i].start_index);
45 EXPECT_EQ(text.underline_attributes()[i].end_index, 46 EXPECT_EQ(text.underline_attributes()[i].end_index,
46 text2.underline_attributes()[i].end_index); 47 text2.underline_attributes()[i].end_index);
47 } 48 }
48 49
49 EXPECT_EQ(text.selection_start(), text2.selection_start()); 50 EXPECT_EQ(text.selection_start(), text2.selection_start());
50 EXPECT_EQ(text.selection_end(), text2.selection_end()); 51 EXPECT_EQ(text.selection_end(), text2.selection_end());
51 } 52 }
52 53
53 } // namespace chromeos 54 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/ime/composition_text.h ('k') | ui/base/ime/input_method_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698