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

Unified Diff: third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc

Issue 137443009: libaddressinput - merge LookupKeyUtil into Retriever (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc
diff --git a/third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc b/third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc
index fab1ecb2384f5238946752f35a155cfc402dd3df..602231266bf0444e7762f0b46748c7947c484538 100644
--- a/third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc
+++ b/third_party/libaddressinput/chromium/cpp/test/fake_downloader.cc
@@ -20,8 +20,6 @@
#include <string>
#include <utility>
-#include "lookup_key_util.h"
-
namespace i18n {
namespace addressinput {
@@ -36,11 +34,6 @@ 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;
-const LookupKeyUtil& GetLookupKeyUtil() {
- static const LookupKeyUtil kLookupKeyUtil(FakeDownloader::kFakeDataUrl);
- return kLookupKeyUtil;
-}
-
std::map<std::string, std::string> InitData() {
std::map<std::string, std::string> data;
std::ifstream file(kDataFileName);
@@ -52,7 +45,7 @@ std::map<std::string, std::string> InitData() {
std::string::size_type divider = line.find('=');
if (divider != std::string::npos) {
data.insert(std::make_pair(
- GetLookupKeyUtil().GetUrlForKey(line.substr(0, divider)),
+ FakeDownloader::kFakeDataUrl + (line.substr(0, divider)),
line.substr(divider + 1)));
}
}
@@ -77,7 +70,7 @@ void FakeDownloader::Download(const std::string& url,
GetData().find(url);
bool success = data_it != GetData().end();
std::string data = success ? data_it->second : std::string();
- if (!success && GetLookupKeyUtil().IsValidationDataUrl(url)) {
+ if (!success && !url.compare(0, kFakeDataUrlLength, kFakeDataUrl)) {
// URLs that start with "https://i18napis.appspot.com/ssl-address/" prefix,
// but do not have associated data will always return "{}" with status code
// 200. FakeDownloader imitates this behavior for URLs that start with

Powered by Google App Engine
This is Rietveld 408576698