summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorrouslan@chromium.org <rouslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-07 00:08:21 +0000
committerrouslan@chromium.org <rouslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-07 00:08:21 +0000
commitb3fda4fe7d5a12b57a991cec23f55a6a7b85f73f (patch)
tree6a98a97265468589da077e0296c6708fb494f7c5 /third_party
parent9b448c120f907635a7ae419e3774460a7b25f2b3 (diff)
downloadchromium_src-b3fda4fe7d5a12b57a991cec23f55a6a7b85f73f.zip
chromium_src-b3fda4fe7d5a12b57a991cec23f55a6a7b85f73f.tar.gz
chromium_src-b3fda4fe7d5a12b57a991cec23f55a6a7b85f73f.tar.bz2
Include language-specific rules in fake downloader for libaddressinput.
BUG=349644 Review URL: https://codereview.chromium.org/187553004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc b/third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc
index d6b63f3..4000d20 100644
--- a/third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc
+++ b/third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc
@@ -34,6 +34,14 @@ const char kDataFileName[] = TEST_DATA_DIR "/countryinfo.txt";
// The number of characters in the fake data URL prefix.
const size_t kFakeDataUrlLength = sizeof FakeDownloader::kFakeDataUrl - 1;
+// Returns "data/HK" for "data/HK--en".
+std::string RemoveLanguageCode(const std::string& key) {
+ std::string::size_type language_code_pos = key.find("--");
+ return language_code_pos == std::string::npos
+ ? key
+ : key.substr(0, language_code_pos);
+}
+
std::string CCKey(const std::string& key) {
const char kSplitChar = '/';
@@ -64,7 +72,7 @@ std::map<std::string, std::string> InitData() {
}
std::string key = line.substr(0, divider);
- std::string cc_key = CCKey(key);
+ std::string cc_key = RemoveLanguageCode(CCKey(key));
std::string value = line.substr(divider + 1);
std::string url = FakeDownloader::kFakeDataUrl + cc_key;
std::map<std::string, std::string>::iterator data_it = data.find(url);