summaryrefslogtreecommitdiffstats
path: root/base/string_util_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Pass through non-character codepoints in UTF-8,16,32 and Wide conversion ↵jshin@chromium.org2009-06-241-7/+14
| | | | | | | | | | | | | | | | | | | | functions. They're structurally valid code points unlike malformed byte/surrogate sequences. I believe it's better to leave them alone in conversion functions. This CL was triggered by file_util_unittest failure on Linux/Mac with my upcoming change to file_util::ReplaceIllegalCharacters (a part of http://codereview.chromium.org/126223 ). In addition, the upper bound for the output length in CodepageToWide was tightened. TEST=pass string_util and file_util unittests BUG=NONE Review URL: http://codereview.chromium.org/147038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19132 0039d316-1c4b-4281-b951-d872f2087c98
* add CollapseWhitespaceASCIIrafaelw@chromium.org2009-06-041-0/+30
| | | | | | | | R=erikkay Review URL: http://codereview.chromium.org/119199 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17689 0039d316-1c4b-4281-b951-d872f2087c98
* Re-land of earlier NTP theme patch; now with mac and linux compatibility.glen@chromium.org2009-05-151-4/+39
| | | | | | Review URL: http://codereview.chromium.org/115413 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16205 0039d316-1c4b-4281-b951-d872f2087c98
* Undo 16020glen@chromium.org2009-05-141-39/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16021 0039d316-1c4b-4281-b951-d872f2087c98
* Allow the new tab page to be themed (you may want to review DOMUIThemeSource ↵glen@chromium.org2009-05-141-4/+39
| | | | | | | | | | | | | as a whole and not just these changes). Change global std::strings to chars* in browser theme provider. Add ability for ReplaceStringPlaceHolder to take up to 9 replacements. BUG=11235,11685 Review URL: http://codereview.chromium.org/115172 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16020 0039d316-1c4b-4281-b951-d872f2087c98
* Lands http://codereview.chromium.org/99349 for Ryan.sky@chromium.org2009-05-041-0/+9
| | | | | | | | | | | | | | Comments from Ryan: Some small changes to get chromium building on ARM. I tested these using the standard Linux tool chain and crosstools-ng. BUG=none TEST=none Review URL: http://codereview.chromium.org/99365 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15241 0039d316-1c4b-4281-b951-d872f2087c98
* Convert the internal GetStringF to use string16. This saves atc@google.com2009-04-141-2/+6
| | | | | | | | | | | | | | | conversion from string16 to wstring on the linux side when calling GetStringFUTF8 methods. It actually adds extra conversions when calling GetStringF, but we're going to get rid of all those, right? BUG=9911 Review URL: http://codereview.chromium.org/67112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13666 0039d316-1c4b-4281-b951-d872f2087c98
* Remove logging.h from cc files that don't use it.thestig@chromium.org2009-03-121-1/+0
| | | | | | Review URL: http://codereview.chromium.org/42155 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11593 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes Issue 7377: Regression: Omnibox trims URL ending with 0x85 (Take 2)hbono@chromium.org2009-03-051-1/+46
| | | | | | | | | This is the same change as "http://codereview.chromium.org/20219/show", which I reverted it because it caused build breaks on sandbox. To investigate this build break, it seems this build break is somehow caused by "base/string_util.cc" that includes the TrimWhiteSpaceUTF8() function. To fix this build break, I moved the TrimWhiteSpaceUTF8() function to "base/string_util_icu.cc". BUG=7377 Review URL: http://codereview.chromium.org/28310 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10970 0039d316-1c4b-4281-b951-d872f2087c98
* NO CODE CHANGE (except one global std::wstring changed to const wchar_t* ↵maruel@chromium.org2009-03-031-6/+5
| | | | | | | | | | | const per style compliance). Preliminary work to enforce new PRESUBMIT.py rules: - <=80 cols - no trailing whitespaces - svn:eol-style=LF git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10791 0039d316-1c4b-4281-b951-d872f2087c98
* Port Replace(First)SubstringsAfterOffset to string16.dsh@google.com2009-03-031-39/+41
| | | | | | Review URL: http://codereview.chromium.org/28324 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10767 0039d316-1c4b-4281-b951-d872f2087c98
* Get rid of wstring variants of StringToFoo.dsh@google.com2009-02-281-13/+19
| | | | | | Review URL: http://codereview.chromium.org/28281 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10664 0039d316-1c4b-4281-b951-d872f2087c98
* Add ToUpperASCII and StringToUpperASCII.wtc@chromium.org2009-02-271-0/+26
| | | | | | | R=darin,eroman Review URL: http://codereview.chromium.org/28227 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10576 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 10456.hbono@chromium.org2009-02-261-46/+1
| | | | | | Review URL: http://codereview.chromium.org/28180 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10458 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes Issue 7377: Regression: Omnibox trims URL ending with 0x85hbono@chromium.org2009-02-261-1/+46
| | | | | | | | | | To fix this issue, this change adds a new function TrimWhitespaceUTF8(), which trims space characters (including non-printable characters and broken UTF-8 characters) from either end of a UTF-8 string. Please feel free to give me your comments since I'm not sure this implimentation is correct. (Maybe this implementation trims too aggressively.) BUG=7377 Review URL: http://codereview.chromium.org/20219 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10456 0039d316-1c4b-4281-b951-d872f2087c98
* Introduce UrlPattern. This is basically me resuming work onaa@chromium.org2009-02-021-0/+18
| | | | | | | | | | | | issue 14106, but as it is a complete rewrite, I have started a new issue. I also added supporting JoinString() and ReplaceAll() utility functions. Review URL: http://codereview.chromium.org/19704 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9031 0039d316-1c4b-4281-b951-d872f2087c98
* Add HexStringToBytes which takes an arbitrary length hex string and creates ↵erikkay@google.com2009-01-271-0/+52
| | | | | | | | a vector of bytes. Review URL: http://codereview.chromium.org/18814 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8716 0039d316-1c4b-4281-b951-d872f2087c98
* Simplify HexEncode.deanm@chromium.org2009-01-221-2/+2
| | | | | | | Review URL: http://codereview.chromium.org/18659 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8450 0039d316-1c4b-4281-b951-d872f2087c98
* Adding a HexEncode function to string_utils.tommi@chromium.org2009-01-221-0/+8
| | | | | | | | This function takes a pointer to a chunk of memory and formats the bytes as hex. Review URL: http://codereview.chromium.org/18452 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8420 0039d316-1c4b-4281-b951-d872f2087c98
* Add a replace_all param to ReplaceSubstringsAfterOffset and update call sites.aa@chromium.org2009-01-211-0/+29
| | | | | | Review URL: http://codereview.chromium.org/18603 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8413 0039d316-1c4b-4281-b951-d872f2087c98
* This CL adds the autofill UI in forms.jcampan@chromium.org2008-11-051-5/+21
| | | | | | | | | | | | When the user types text in a text field in a form, the renderer queries the browser for suggestion based on the entered text and displays the suggestions in a popup. Listeners are set on the form text field in a similar fashion than for password save. The popup showing the suggestion uses the same mechanism as the select popup. Note that a difference between the select and the autofill popup is that the autofill should not take focus, so the page still has focus and the user can still type in while it shows. The creation of the render widget was modified for that purpose so we can specify the popup should not be focused when shown. Review URL: http://codereview.chromium.org/8885 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4804 0039d316-1c4b-4281-b951-d872f2087c98
* This CL adds prompting for dangerous types of files (executable) when they ↵jcampan@chromium.org2008-10-101-0/+26
| | | | | | | | | | | | | | | | are automatically downloaded. The file is saved with a temporary name (dangerous_download_xxxx.download) in the download directory and the user is presented (in the download shelf and the download tab if opened) with a warning message and buttons to save/discard the download. If discarded the download is removed (and its file deleted). If saved, download goes as usual. Dangerous downloads not confirmed by the user are deleted on shutdown. TEST=Download a small exe file, try using the save/discard button from the download shelf and from the download tab (the intent is that the file has been entirely downloaded by the time you take action). Try again with a slow/big download (that time the download is expected not to be finished when approved/discarded). Review URL: http://codereview.chromium.org/6043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3228 0039d316-1c4b-4281-b951-d872f2087c98
* Add UTF-8 check for JSON deserializer.jungshik@google.com2008-09-251-0/+65
| | | | | | | | | | | Add tests for IsStringUTF8 Make IsStringUTF8 accept std::string/std::wstring rather than char*/wchar_t* Review URL: http://codereview.chromium.org/4268 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2610 0039d316-1c4b-4281-b951-d872f2087c98
* Use a more compact license header in source files.license.bot2008-08-241-28/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a new[] / delete mismatch in a unittest.deanm@google.com2008-08-191-1/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1030 0039d316-1c4b-4281-b951-d872f2087c98
* To pass string_util_unittest, we need the ICU data file. To get the ICU ↵evanm@google.com2008-08-151-5/+8
| | | | | | data file, we need some of PathService, which brings along with it a bunch of other needed functions. So here are a bunch of stubs, along with another file's worth of passing tests. (Based on a patch from Dean.) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@921 0039d316-1c4b-4281-b951-d872f2087c98
* fix unit test bustagedarin@google.com2008-08-141-4/+2
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@887 0039d316-1c4b-4281-b951-d872f2087c98
* Fix some compiler warnings, and cleanup EXPECT_EQ comparisons. Hello "U" ↵darin@google.com2008-08-141-31/+31
| | | | | | suffix :-) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@882 0039d316-1c4b-4281-b951-d872f2087c98
* DCHECK vswprintf format string cross-platform portability. Use %ls, not %s, ↵mmentovai@google.com2008-08-141-2/+34
| | | | | | for wchar_t* fields. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@849 0039d316-1c4b-4281-b951-d872f2087c98
* Implement an interface compatible wcslcpy and strlcpy. Possibly slightlydeanm@google.com2008-08-131-0/+53
| | | | | | | | | | slower than the OpenBSD implementation, but a bit clearer and fits our style. Move file_util_posix to use it now that we have it everywhere. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@798 0039d316-1c4b-4281-b951-d872f2087c98
* Implement IntToString-type methods without using a format string. I'm not ↵deanm@google.com2008-08-131-11/+42
| | | | | | sure if this will actually be more efficient. Also will make Int64ToString work on other platforms, since the old code used msvc-only %I64. Added a bunch of methods to have the whole Int/Int64 String/WString suite. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@784 0039d316-1c4b-4281-b951-d872f2087c98
* Fix string_util and its tests for the Mac, GCC, UTF-32 wchar_t platforms, ↵mmentovai@google.com2008-08-131-67/+80
| | | | | | and POSIX systems generally. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@771 0039d316-1c4b-4281-b951-d872f2087c98
* Back out r736 due to breakagemmentovai@google.com2008-08-121-80/+67
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@738 0039d316-1c4b-4281-b951-d872f2087c98
* Fix string_util and its tests for the Mac, GCC, UTF-32 wchar_t platforms, ↵mmentovai@google.com2008-08-121-67/+80
| | | | | | and POSIX systems generally. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@736 0039d316-1c4b-4281-b951-d872f2087c98
* Add some extra test cases for whitespace at start/end of number.ericroman@google.com2008-08-081-0/+6
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@598 0039d316-1c4b-4281-b951-d872f2087c98
* Add UTF-16 <-> Wide conversions for Mac.brettw@google.com2008-08-071-8/+3
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@534 0039d316-1c4b-4281-b951-d872f2087c98
* Add defines for the size of wchar_t to build_config.h. Use this in places ↵brettw@google.com2008-08-071-9/+9
| | | | | | | | | | where we currently have an OS-specific check. Remove all WIN32 ifdefs from base and replace them with proper defined(OS...). I also fixed random style bits when I encountered them. I made major style fixes to string16. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@524 0039d316-1c4b-4281-b951-d872f2087c98
* Cross-platform portability fixes for JSONReader. Adds generic ↵mmentovai@google.com2008-08-071-0/+63
| | | | | | | | string-to-double parsing and tests in string_util. There is one behavior change here: numbers which "look" like integers by virtue of being free of '.', 'e', and 'E' are no longer rejected if they're not within the [INT_MIN .. INT_MAX] range. Instead, they'll be parsed and stored internally as doubles. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@519 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the old NativeMB functions from string util, and use the new ones in ↵brettw@google.com2008-08-071-0/+117
| | | | | | sys_strings.h. I also removed duplicated code from the sandbox that can now use this, and fixed one case in the bug reporter that should not have been using the native multibyte encoding. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@515 0039d316-1c4b-4281-b951-d872f2087c98
* Allow string-to-int conversions to provide a return value indicating ↵mmentovai@google.com2008-08-051-0/+182
| | | | | | success. Implement them consistently on all platforms. Fill in a couple of necessary missing pieces. Eliminate the need for many uses of sscanf. Add tests. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@405 0039d316-1c4b-4281-b951-d872f2087c98
* Revert my UTF change until we can figure out what to do with the sandbox.brettw@google.com2008-08-011-117/+0
| | | | | | BUG=1201008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215 0039d316-1c4b-4281-b951-d872f2087c98
* Write our own utf8<->wide conversion functions. This gives us more control ↵brettw@google.com2008-08-011-0/+117
| | | | | | over error handling instead of getting a blank string for invalid encodings. It also allows us to decrease the amount of platform-specific code. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211 0039d316-1c4b-4281-b951-d872f2087c98
* Add base to the repository.initial.commit2008-07-261-0/+848
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8 0039d316-1c4b-4281-b951-d872f2087c98