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

Side by Side Diff: ios/web/string_util_unittest.cc

Issue 1544743002: Switch to standard integer types in ios/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « ios/web/string_util.cc ('k') | ios/web/test/test_web_thread.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 4
5 #include "ios/web/public/string_util.h" 5 #include "ios/web/public/string_util.h"
6 6
7 #include <stddef.h>
8
7 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
9 11
10 namespace web { 12 namespace web {
11 13
12 // Tests that a regular sentence is clipped correctly. 14 // Tests that a regular sentence is clipped correctly.
13 TEST(StringByClippingLastWordTest, ClipRegularSentence) { 15 TEST(StringByClippingLastWordTest, ClipRegularSentence) {
14 const base::string16 kInput = 16 const base::string16 kInput =
15 base::UTF8ToUTF16("\nSome text here and there."); 17 base::UTF8ToUTF16("\nSome text here and there.");
16 EXPECT_EQ(kInput, GetStringByClippingLastWord(kInput, 100)); 18 EXPECT_EQ(kInput, GetStringByClippingLastWord(kInput, 100));
(...skipping 19 matching lines...) Expand all
36 // A string slightly longer than |kLongStringLength|. 38 // A string slightly longer than |kLongStringLength|.
37 base::string16 long_string(kLongStringLength + 10, 'a'); 39 base::string16 long_string(kLongStringLength + 10, 'a');
38 // Block of text with no space should be truncated to kLongStringLength. 40 // Block of text with no space should be truncated to kLongStringLength.
39 base::string16 result = 41 base::string16 result =
40 GetStringByClippingLastWord(long_string, kLongStringLength); 42 GetStringByClippingLastWord(long_string, kLongStringLength);
41 EXPECT_EQ(kLongStringLength, result.size()); 43 EXPECT_EQ(kLongStringLength, result.size());
42 EXPECT_EQ(0u, long_string.find_first_of(result)); 44 EXPECT_EQ(0u, long_string.find_first_of(result));
43 } 45 }
44 46
45 } // namespace web 47 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/string_util.cc ('k') | ios/web/test/test_web_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698