diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-05 20:11:02 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-05 20:11:02 +0000 |
commit | 21861f27de14a1af8dae37a3bba5e98c3ed59e6c (patch) | |
tree | 2bee8fdaed60665c768317459c96159abfea7283 /chrome/browser/autofill/form_structure_browsertest.cc | |
parent | aa742b4f9495fc201d68ccd29f0f6c4bbbef64e9 (diff) | |
download | chromium_src-21861f27de14a1af8dae37a3bba5e98c3ed59e6c.zip chromium_src-21861f27de14a1af8dae37a3bba5e98c3ed59e6c.tar.gz chromium_src-21861f27de14a1af8dae37a3bba5e98c3ed59e6c.tar.bz2 |
Autofill heuristics regular expressions should be stored in external data files.
This change moves the Autofill heuristics regular expressions out to a new autofill_resources.grd file. This grd file is not meant to be localized. Eventually it will contain the locale-specific regular expressions as well as the English versions. This CL, however, just moves the English versions out of source.
BUG=55787
TEST=FormStructureBrowserTest.HTMLFiles
Review URL: http://codereview.chromium.org/6026010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/form_structure_browsertest.cc')
-rw-r--r-- | chrome/browser/autofill/form_structure_browsertest.cc | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc index ae38f7d..f6bda60 100644 --- a/chrome/browser/autofill/form_structure_browsertest.cc +++ b/chrome/browser/autofill/form_structure_browsertest.cc @@ -47,19 +47,13 @@ const std::string ConvertToURLFormat(const std::string& html) { return std::string("data:text/html;charset=utf-8,") + html; } -// Compare |output_file_source| with |form_string|. Returns true when they are -// identical. -bool CompareText(const std::string& output_file_source, - const std::string& form_string) { - std::string output_file = output_file_source; - std::string form = form_string; - - ReplaceSubstringsAfterOffset(&output_file, 0, "\r\n", " "); - ReplaceSubstringsAfterOffset(&output_file, 0, "\r", " "); - ReplaceSubstringsAfterOffset(&output_file, 0, "\n", " "); - ReplaceSubstringsAfterOffset(&form, 0, "\n", " "); - - return (output_file == form); +// Convert strings with platform end-of-line characters with spaces. +const std::string NormalizeText(const std::string& text) { + std::string normalized = text; + ReplaceSubstringsAfterOffset(&normalized, 0, "\r\n", " "); + ReplaceSubstringsAfterOffset(&normalized, 0, "\r", " "); + ReplaceSubstringsAfterOffset(&normalized, 0, "\n", " "); + return normalized; } } // namespace @@ -253,9 +247,9 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, HTMLFiles) { std::string output_file_source; if (file_util::ReadFileToString(output_file_path, &output_file_source)) { - ASSERT_TRUE(CompareText( - output_file_source, - FormStructureBrowserTest::FormStructuresToString(forms))); + ASSERT_EQ(NormalizeText(output_file_source), + NormalizeText( + FormStructureBrowserTest::FormStructuresToString(forms))); } else { ASSERT_TRUE(WriteFile( |