diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-06 08:36:26 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-06 08:36:26 +0000 |
commit | 503d0387804c4ddf22a52857407e885ce737dbba (patch) | |
tree | b207cd83412330671e898e7c9063da60338be86f /chrome | |
parent | cc7b9ccdc9f6eb94a89c0ce6f8e8af341eea4370 (diff) | |
download | chromium_src-503d0387804c4ddf22a52857407e885ce737dbba.zip chromium_src-503d0387804c4ddf22a52857407e885ce737dbba.tar.gz chromium_src-503d0387804c4ddf22a52857407e885ce737dbba.tar.bz2 |
FTP: split the directory listing parser test and re-enable it on TSan bots
The test was disabled on TSan bots becuase it was taking too much time.
This change converts one huge test which parses ~30 directory listings
to ~30 separate test cases.
This change also moves ToLower/ToUpper from ui/base/l10n_util
to base/i18n/case_conversion so that they can be used in net/ftp.
BUG=79022
Review URL: http://codereview.chromium.org/6905027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/autocomplete/search_provider.cc | 3 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_index.cc | 8 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils.cc | 11 | ||||
-rw-r--r-- | chrome/browser/download/download_item.cc | 9 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 3 | ||||
-rw-r--r-- | chrome/browser/enumerate_modules_model_win.cc | 7 | ||||
-rw-r--r-- | chrome/browser/history/in_memory_url_index.cc | 11 | ||||
-rw-r--r-- | chrome/browser/history/query_parser.cc | 5 | ||||
-rw-r--r-- | chrome/browser/history/url_database.cc | 7 | ||||
-rw-r--r-- | chrome/browser/instant/instant_loader.cc | 9 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url.cc | 3 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_model.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/edit_search_engine_dialog.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/shell_dialogs_win.cc | 3 | ||||
-rw-r--r-- | chrome/browser/webdata/autofill_table.cc | 7 | ||||
-rw-r--r-- | chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc | 3 |
16 files changed, 56 insertions, 39 deletions
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index fd40f47..235341c 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -8,6 +8,7 @@ #include <cmath> #include "base/callback.h" +#include "base/i18n/case_conversion.h" #include "base/i18n/icu_string_conversions.h" #include "base/message_loop.h" #include "base/string16.h" @@ -836,7 +837,7 @@ void SearchProvider::AddMatchToMap(const string16& query_string, // NOTE: Keep this ToLower() call in sync with url_database.cc. const std::pair<MatchMap::iterator, bool> i = map->insert( std::pair<string16, AutocompleteMatch>( - l10n_util::ToLower(query_string), match)); + base::i18n::ToLower(query_string), match)); // NOTE: We purposefully do a direct relevance comparison here instead of // using AutocompleteMatch::MoreRelevant(), so that we'll prefer "items added // first" rather than "items alphabetically first" when the scores are equal. diff --git a/chrome/browser/bookmarks/bookmark_index.cc b/chrome/browser/bookmarks/bookmark_index.cc index c247cb5..875140f 100644 --- a/chrome/browser/bookmarks/bookmark_index.cc +++ b/chrome/browser/bookmarks/bookmark_index.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include <iterator> #include <list> +#include "base/i18n/case_conversion.h" #include "base/string16.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -242,8 +243,9 @@ std::vector<string16> BookmarkIndex::ExtractQueryWords(const string16& query) { if (query.empty()) return std::vector<string16>(); QueryParser parser; - // TODO: use ICU normalization. - parser.ExtractQueryWords(l10n_util::ToLower(query), &terms); + // TODO(brettw): use ICU normalization: + // http://userguide.icu-project.org/transforms/normalization + parser.ExtractQueryWords(base::i18n::ToLower(query), &terms); return terms; } diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 6090ea1..d5846a6 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/file_path.h" +#include "base/i18n/case_conversion.h" #include "base/string16.h" #include "base/string_number_conversions.h" #include "base/time.h" @@ -194,10 +195,10 @@ bool DoesBookmarkContainWords(const BookmarkNode* node, const std::string& languages) { return DoesBookmarkTextContainWords( - l10n_util::ToLower(node->GetTitle()), words) || + base::i18n::ToLower(node->GetTitle()), words) || DoesBookmarkTextContainWords( - l10n_util::ToLower(UTF8ToUTF16(node->GetURL().spec())), words) || - DoesBookmarkTextContainWords(l10n_util::ToLower( + base::i18n::ToLower(UTF8ToUTF16(node->GetURL().spec())), words) || + DoesBookmarkTextContainWords(base::i18n::ToLower( net::FormatUrl(node->GetURL(), languages, net::kFormatUrlOmitNothing, UnescapeRule::NORMAL, NULL, NULL, NULL)), words); } @@ -519,7 +520,7 @@ void GetBookmarksContainingText(BookmarkModel* model, std::vector<const BookmarkNode*>* nodes) { std::vector<string16> words; QueryParser parser; - parser.ExtractQueryWords(l10n_util::ToLower(text), &words); + parser.ExtractQueryWords(base::i18n::ToLower(text), &words); if (words.empty()) return; @@ -539,7 +540,7 @@ bool DoesBookmarkContainText(const BookmarkNode* node, const std::string& languages) { std::vector<string16> words; QueryParser parser; - parser.ExtractQueryWords(l10n_util::ToLower(text), &words); + parser.ExtractQueryWords(base::i18n::ToLower(text), &words); if (words.empty()) return false; diff --git a/chrome/browser/download/download_item.cc b/chrome/browser/download/download_item.cc index 54165a9..ffbd4b2a 100644 --- a/chrome/browser/download/download_item.cc +++ b/chrome/browser/download/download_item.cc @@ -7,6 +7,7 @@ #include "base/basictypes.h" #include "base/file_util.h" #include "base/format_macros.h" +#include "base/i18n/case_conversion.h" #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/stringprintf.h" @@ -538,9 +539,9 @@ bool DownloadItem::MatchesQuery(const string16& query) const { if (query.empty()) return true; - DCHECK_EQ(query, l10n_util::ToLower(query)); + DCHECK_EQ(query, base::i18n::ToLower(query)); - string16 url_raw(l10n_util::ToLower(UTF8ToUTF16(url().spec()))); + string16 url_raw(base::i18n::ToLower(UTF8ToUTF16(url().spec()))); if (url_raw.find(query) != string16::npos) return true; @@ -551,11 +552,11 @@ bool DownloadItem::MatchesQuery(const string16& query) const { // "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD" PrefService* prefs = download_manager_->profile()->GetPrefs(); std::string languages(prefs->GetString(prefs::kAcceptLanguages)); - string16 url_formatted(l10n_util::ToLower(net::FormatUrl(url(), languages))); + string16 url_formatted(base::i18n::ToLower(net::FormatUrl(url(), languages))); if (url_formatted.find(query) != string16::npos) return true; - string16 path(l10n_util::ToLower(full_path().LossyDisplayName())); + string16 path(base::i18n::ToLower(full_path().LossyDisplayName())); // This shouldn't just do a substring match; it is wrong for Unicode // due to normalization and we have a fancier search-query system // used elsewhere. diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index f7e05f7..6ef4a2b 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -6,6 +6,7 @@ #include "base/callback.h" #include "base/file_util.h" +#include "base/i18n/case_conversion.h" #include "base/logging.h" #include "base/path_service.h" #include "base/rand_util.h" @@ -191,7 +192,7 @@ void DownloadManager::SearchDownloads(const string16& query, std::vector<DownloadItem*>* result) { DCHECK(result); - string16 query_lower(l10n_util::ToLower(query)); + string16 query_lower(base::i18n::ToLower(query)); for (DownloadMap::iterator it = history_downloads_.begin(); it != history_downloads_.end(); ++it) { diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index 69315e9..78ea9d1 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -11,6 +11,7 @@ #include "base/environment.h" #include "base/file_path.h" #include "base/file_version_info_win.h" +#include "base/i18n/case_conversion.h" #include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/string_util.h" @@ -274,7 +275,7 @@ void ModuleEnumerator::NormalizeModule(Module* module) { if (!ConvertToLongPath(path, &module->location)) module->location = path; - module->location = l10n_util::ToLower(module->location); + module->location = base::i18n::ToLower(module->location); // Location contains the filename, so the last slash is where the path // ends. @@ -586,8 +587,8 @@ void ModuleEnumerator::PreparePathMappings() { std::string path; if (environment->GetVar(WideToASCII(*variable).c_str(), &path)) { path_mapping_.push_back( - std::make_pair(l10n_util::ToLower(UTF8ToWide(path)) + L"\\", - L"%" + l10n_util::ToLower(*variable) + L"%")); + std::make_pair(base::i18n::WideToLower(UTF8ToWide(path)) + L"\\", + L"%" + base::i18n::ToLower(*variable) + L"%")); } } } diff --git a/chrome/browser/history/in_memory_url_index.cc b/chrome/browser/history/in_memory_url_index.cc index 2fc67ec..f2c2bf3 100644 --- a/chrome/browser/history/in_memory_url_index.cc +++ b/chrome/browser/history/in_memory_url_index.cc @@ -12,6 +12,7 @@ #include "base/file_util.h" #include "base/i18n/break_iterator.h" +#include "base/i18n/case_conversion.h" #include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/time.h" @@ -180,7 +181,7 @@ bool InMemoryURLIndex::IndexRow(const URLRow& row) { history_info_map_[history_id] = new_row; // Split URL into individual, unique words then add in the title words. - url = l10n_util::ToLower(url); + url = base::i18n::ToLower(url); String16Set url_words = WordSetFromString16(url); String16Set title_words = WordSetFromString16(row.title()); String16Set words; @@ -353,7 +354,7 @@ ScoredHistoryMatches InMemoryURLIndex::HistoryItemsForTerms( String16Vector lower_terms; for (String16Vector::const_iterator term_iter = terms.begin(); term_iter != terms.end(); ++term_iter) - lower_terms.push_back(l10n_util::ToLower(*term_iter)); + lower_terms.push_back(base::i18n::ToLower(*term_iter)); String16Vector::value_type all_terms(JoinString(lower_terms, ' ')); HistoryIDSet history_id_set = HistoryIDSetFromWords(all_terms); @@ -477,7 +478,7 @@ InMemoryURLIndex::String16Set InMemoryURLIndex::WordSetFromString16( String16Set word_set; for (String16Vector::const_iterator iter = words.begin(); iter != words.end(); ++iter) - word_set.insert(l10n_util::ToLower(*iter)); + word_set.insert(base::i18n::ToLower(*iter)); return word_set; } @@ -710,8 +711,8 @@ ScoredHistoryMatch InMemoryURLIndex::ScoredMatchForURL( // Figure out where each search term appears in the URL and/or page title // so that we can score as well as provide autocomplete highlighting. - string16 url = l10n_util::ToLower(UTF8ToUTF16(gurl.spec())); - string16 title = l10n_util::ToLower(row.title()); + string16 url = base::i18n::ToLower(UTF8ToUTF16(gurl.spec())); + string16 title = base::i18n::ToLower(row.title()); int term_num = 0; for (String16Vector::const_iterator iter = terms.begin(); iter != terms.end(); ++iter, ++term_num) { diff --git a/chrome/browser/history/query_parser.cc b/chrome/browser/history/query_parser.cc index d2957f3..628879b 100644 --- a/chrome/browser/history/query_parser.cc +++ b/chrome/browser/history/query_parser.cc @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/i18n/break_iterator.h" +#include "base/i18n/case_conversion.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string_util.h" @@ -313,7 +314,7 @@ int QueryParser::ParseQuery(const string16& query, string16* sqlite_query) { void QueryParser::ParseQuery(const string16& query, std::vector<QueryNode*>* nodes) { QueryNodeList root; - if (ParseQueryImpl(l10n_util::ToLower(query), &root)) + if (ParseQueryImpl(base::i18n::ToLower(query), &root)) nodes->swap(*root.children()); } @@ -333,7 +334,7 @@ bool QueryParser::DoesQueryMatch(const string16& text, return false; std::vector<QueryWord> query_words; - string16 lower_text = l10n_util::ToLower(text); + string16 lower_text = base::i18n::ToLower(text); ExtractQueryWords(lower_text, &query_words); if (query_words.empty()) diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc index 78ca0c5..cc9bf9e 100644 --- a/chrome/browser/history/url_database.cc +++ b/chrome/browser/history/url_database.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ #include <vector> #include "app/sql/statement.h" +#include "base/i18n/case_conversion.h" #include "base/utf_string_conversions.h" #include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" @@ -426,7 +427,7 @@ bool URLDatabase::SetKeywordSearchTermsForURL(URLID url_id, statement.BindInt64(0, keyword_id); statement.BindInt64(1, url_id); - statement.BindString16(2, l10n_util::ToLower(term)); + statement.BindString16(2, base::i18n::ToLower(term)); statement.BindString16(3, term); return statement.Run(); } @@ -485,7 +486,7 @@ void URLDatabase::GetMostRecentKeywordSearchTerms( return; // NOTE: Keep this ToLower() call in sync with search_provider.cc. - string16 lower_prefix = l10n_util::ToLower(prefix); + string16 lower_prefix = base::i18n::ToLower(prefix); // This magic gives us a prefix search. string16 next_prefix = lower_prefix; next_prefix[next_prefix.size() - 1] = diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index a1920a0..ca99bea 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -10,6 +10,7 @@ #include <vector> #include "base/command_line.h" +#include "base/i18n/case_conversion.h" #include "base/string_number_conversions.h" #include "base/timer.h" #include "base/utf_string_conversions.h" @@ -685,9 +686,9 @@ bool InstantLoader::Update(TabContentsWrapper* tab_contents, host->Send(new ViewMsg_SearchBoxChange( host->routing_id(), user_text_, verbatim, text_length, text_length)); - string16 complete_suggested_text_lower = l10n_util::ToLower( + string16 complete_suggested_text_lower = base::i18n::ToLower( complete_suggested_text_); - string16 user_text_lower = l10n_util::ToLower(user_text_); + string16 user_text_lower = base::i18n::ToLower(user_text_); if (!verbatim && complete_suggested_text_lower.size() > user_text_lower.size() && !complete_suggested_text_lower.compare(0, user_text_lower.size(), @@ -841,8 +842,8 @@ void InstantLoader::SetCompleteSuggestedText( return; } - string16 user_text_lower = l10n_util::ToLower(user_text_); - string16 complete_suggested_text_lower = l10n_util::ToLower( + string16 user_text_lower = base::i18n::ToLower(user_text_); + string16 complete_suggested_text_lower = base::i18n::ToLower( complete_suggested_text); last_suggestion_.clear(); if (user_text_lower.compare(0, user_text_lower.size(), diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc index 5952fdb3..1d276aa6 100644 --- a/chrome/browser/search_engines/template_url.cc +++ b/chrome/browser/search_engines/template_url.cc @@ -4,6 +4,7 @@ #include "chrome/browser/search_engines/template_url.h" +#include "base/i18n/case_conversion.h" #include "base/i18n/icu_string_conversions.h" #include "base/i18n/rtl.h" #include "base/logging.h" @@ -628,7 +629,7 @@ void TemplateURL::SetInstantURL(const std::string& url, void TemplateURL::set_keyword(const string16& keyword) { // Case sensitive keyword matching is confusing. As such, we force all // keywords to be lower case. - keyword_ = l10n_util::ToLower(keyword); + keyword_ = base::i18n::ToLower(keyword); autogenerate_keyword_ = false; } diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc index 5e3d234..a2def18 100644 --- a/chrome/browser/search_engines/template_url_model.cc +++ b/chrome/browser/search_engines/template_url_model.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/environment.h" +#include "base/i18n/case_conversion.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/string_split.h" @@ -153,7 +154,7 @@ string16 TemplateURLModel::GenerateKeyword(const GURL& url, // static string16 TemplateURLModel::CleanUserInputKeyword(const string16& keyword) { // Remove the scheme. - string16 result(l10n_util::ToLower(keyword)); + string16 result(base::i18n::ToLower(keyword)); url_parse::Component scheme_component; if (url_parse::ExtractScheme(UTF16ToUTF8(keyword).c_str(), static_cast<int>(keyword.length()), diff --git a/chrome/browser/ui/gtk/edit_search_engine_dialog.cc b/chrome/browser/ui/gtk/edit_search_engine_dialog.cc index a3e4940..24863f6 100644 --- a/chrome/browser/ui/gtk/edit_search_engine_dialog.cc +++ b/chrome/browser/ui/gtk/edit_search_engine_dialog.cc @@ -6,6 +6,7 @@ #include <gtk/gtk.h> +#include "base/i18n/case_conversion.h" #include "base/i18n/rtl.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" @@ -33,7 +34,7 @@ std::string GetDisplayURL(const TemplateURL& turl) { void LowercaseInsertTextHandler(GtkEditable *editable, const gchar *text, gint length, gint *position, gpointer data) { string16 original_text = UTF8ToUTF16(text); - string16 lower_text = l10n_util::ToLower(original_text); + string16 lower_text = base::i18n::ToLower(original_text); if (lower_text != original_text) { std::string result = UTF16ToUTF8(lower_text); // Prevent ourselves getting called recursively about our own edit. diff --git a/chrome/browser/ui/views/shell_dialogs_win.cc b/chrome/browser/ui/views/shell_dialogs_win.cc index 5eba0de4..691f050 100644 --- a/chrome/browser/ui/views/shell_dialogs_win.cc +++ b/chrome/browser/ui/views/shell_dialogs_win.cc @@ -13,6 +13,7 @@ #include "base/file_path.h" #include "base/file_util.h" +#include "base/i18n/case_conversion.h" #include "base/message_loop.h" #include "base/string_split.h" #include "base/threading/thread.h" @@ -143,7 +144,7 @@ std::wstring FormatFilterForExtensions( // the we create a description "QQQ File (.qqq)"). include_all_files = true; desc = l10n_util::GetStringFUTF16(IDS_APP_SAVEAS_EXTENSION_FORMAT, - l10n_util::ToUpper(ext_name), + base::i18n::WideToUpper(ext_name), ext_name); } if (desc.empty()) diff --git a/chrome/browser/webdata/autofill_table.cc b/chrome/browser/webdata/autofill_table.cc index 75a9503..8e5242a 100644 --- a/chrome/browser/webdata/autofill_table.cc +++ b/chrome/browser/webdata/autofill_table.cc @@ -12,6 +12,7 @@ #include <vector> #include "app/sql/statement.h" +#include "base/i18n/case_conversion.h" #include "base/logging.h" #include "base/string_number_conversions.h" #include "base/time.h" @@ -429,7 +430,7 @@ bool AutofillTable::GetFormValuesForElementName(const string16& name, s.BindString16(0, name); s.BindInt(1, limit); } else { - string16 prefix_lower = l10n_util::ToLower(prefix); + string16 prefix_lower = base::i18n::ToLower(prefix); string16 next_prefix = prefix_lower; next_prefix[next_prefix.length() - 1]++; @@ -625,7 +626,7 @@ bool AutofillTable::InsertFormElement(const FormField& element, s.BindString16(0, element.name); s.BindString16(1, element.value); - s.BindString16(2, l10n_util::ToLower(element.value)); + s.BindString16(2, base::i18n::ToLower(element.value)); if (!s.Run()) { NOTREACHED(); @@ -824,7 +825,7 @@ bool AutofillTable::InsertAutofillEntry(const AutofillEntry& entry) { s.BindString16(0, entry.key().name()); s.BindString16(1, entry.key().value()); - s.BindString16(2, l10n_util::ToLower(entry.key().value())); + s.BindString16(2, base::i18n::ToLower(entry.key().value())); s.BindInt(3, entry.timestamps().size()); if (!s.Run()) { diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc index 251cc75..73db09b 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc @@ -8,6 +8,7 @@ #include <map> #include "base/compiler_specific.h" +#include "base/i18n/case_conversion.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" @@ -199,7 +200,7 @@ void PhishingTermFeatureExtractor::ExtractFeaturesWithTimeout() { } void PhishingTermFeatureExtractor::HandleWord(const string16& word) { - std::string word_lower = UTF16ToUTF8(l10n_util::ToLower(word)); + std::string word_lower = UTF16ToUTF8(base::i18n::ToLower(word)); std::string word_hash = crypto::SHA256HashString(word_lower); // Quick out if the word is not part of any term, which is the common case. |