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

Side by Side Diff: base/string_util_unittest.cc

Issue 192065: Merge 25487 - Strip .plugin off of Mac plugin names when showing the crash in... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 3 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 | « base/string_util.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/base/string_util_unittest.cc:r69-2775
Merged /trunk/src/base/string_util_unittest.cc:r25487
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <math.h> 5 #include <math.h>
6 #include <stdarg.h> 6 #include <stdarg.h>
7 7
8 #include <limits> 8 #include <limits>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 EXPECT_TRUE(StartsWith(L"javascript:url", L"javascript", false)); 1569 EXPECT_TRUE(StartsWith(L"javascript:url", L"javascript", false));
1570 EXPECT_TRUE(StartsWith(L"JavaScript:url", L"javascript", false)); 1570 EXPECT_TRUE(StartsWith(L"JavaScript:url", L"javascript", false));
1571 EXPECT_FALSE(StartsWith(L"java", L"javascript", true)); 1571 EXPECT_FALSE(StartsWith(L"java", L"javascript", true));
1572 EXPECT_FALSE(StartsWith(L"java", L"javascript", false)); 1572 EXPECT_FALSE(StartsWith(L"java", L"javascript", false));
1573 EXPECT_FALSE(StartsWith(L"", L"javascript", false)); 1573 EXPECT_FALSE(StartsWith(L"", L"javascript", false));
1574 EXPECT_FALSE(StartsWith(L"", L"javascript", true)); 1574 EXPECT_FALSE(StartsWith(L"", L"javascript", true));
1575 EXPECT_TRUE(StartsWith(L"java", L"", false)); 1575 EXPECT_TRUE(StartsWith(L"java", L"", false));
1576 EXPECT_TRUE(StartsWith(L"java", L"", true)); 1576 EXPECT_TRUE(StartsWith(L"java", L"", true));
1577 } 1577 }
1578 1578
1579 TEST(StringUtilTest, EndsWith) {
1580 EXPECT_TRUE(EndsWith(L"Foo.plugin", L".plugin", true));
1581 EXPECT_FALSE(EndsWith(L"Foo.Plugin", L".plugin", true));
1582 EXPECT_TRUE(EndsWith(L"Foo.plugin", L".plugin", false));
1583 EXPECT_TRUE(EndsWith(L"Foo.Plugin", L".plugin", false));
1584 EXPECT_FALSE(EndsWith(L".plug", L".plugin", true));
1585 EXPECT_FALSE(EndsWith(L".plug", L".plugin", false));
1586 EXPECT_FALSE(EndsWith(L"Foo.plugin Bar", L".plugin", true));
1587 EXPECT_FALSE(EndsWith(L"Foo.plugin Bar", L".plugin", false));
1588 EXPECT_FALSE(EndsWith(L"", L".plugin", false));
1589 EXPECT_FALSE(EndsWith(L"", L".plugin", true));
1590 EXPECT_TRUE(EndsWith(L"Foo.plugin", L"", false));
1591 EXPECT_TRUE(EndsWith(L"Foo.plugin", L"", true));
1592 EXPECT_TRUE(EndsWith(L".plugin", L".plugin", false));
1593 EXPECT_TRUE(EndsWith(L".plugin", L".plugin", true));
1594 EXPECT_TRUE(EndsWith(L"", L"", false));
1595 EXPECT_TRUE(EndsWith(L"", L"", true));
1596 }
1597
1579 TEST(StringUtilTest, GetStringFWithOffsets) { 1598 TEST(StringUtilTest, GetStringFWithOffsets) {
1580 std::vector<string16> subst; 1599 std::vector<string16> subst;
1581 subst.push_back(ASCIIToUTF16("1")); 1600 subst.push_back(ASCIIToUTF16("1"));
1582 subst.push_back(ASCIIToUTF16("2")); 1601 subst.push_back(ASCIIToUTF16("2"));
1583 std::vector<size_t> offsets; 1602 std::vector<size_t> offsets;
1584 1603
1585 ReplaceStringPlaceholders(ASCIIToUTF16("Hello, $1. Your number is $2."), 1604 ReplaceStringPlaceholders(ASCIIToUTF16("Hello, $1. Your number is $2."),
1586 subst, 1605 subst,
1587 &offsets); 1606 &offsets);
1588 EXPECT_EQ(2U, offsets.size()); 1607 EXPECT_EQ(2U, offsets.size());
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 } 1820 }
1802 } 1821 }
1803 1822
1804 TEST(StringUtilTest, HexEncode) { 1823 TEST(StringUtilTest, HexEncode) {
1805 std::string hex(HexEncode(NULL, 0)); 1824 std::string hex(HexEncode(NULL, 0));
1806 EXPECT_EQ(hex.length(), 0U); 1825 EXPECT_EQ(hex.length(), 0U);
1807 unsigned char bytes[] = {0x01, 0xff, 0x02, 0xfe, 0x03, 0x80, 0x81}; 1826 unsigned char bytes[] = {0x01, 0xff, 0x02, 0xfe, 0x03, 0x80, 0x81};
1808 hex = HexEncode(bytes, sizeof(bytes)); 1827 hex = HexEncode(bytes, sizeof(bytes));
1809 EXPECT_EQ(hex.compare("01FF02FE038081"), 0); 1828 EXPECT_EQ(hex.compare("01FF02FE038081"), 0);
1810 } 1829 }
OLDNEW
« no previous file with comments | « base/string_util.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698