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

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

Issue 140823005: [rac] Download country code data in a single HTTP request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Temporarily switch to staging URL. 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_test.cc
diff --git a/third_party/libaddressinput/chromium/cpp/test/fake_downloader_test.cc b/third_party/libaddressinput/chromium/cpp/test/fake_downloader_test.cc
index e6d077185c2842974dc10656f99c6fbc1ae28b71..f39749055a9075ba24f5cbab746322fff9779101 100644
--- a/third_party/libaddressinput/chromium/cpp/test/fake_downloader_test.cc
+++ b/third_party/libaddressinput/chromium/cpp/test/fake_downloader_test.cc
@@ -63,13 +63,14 @@ testing::AssertionResult DataIsValid(const std::string& data,
return testing::AssertionFailure() << "empty data";
}
- std::string expected_data_begin = "{\"id\":\"" + key + "\"";
- if (data.compare(0, expected_data_begin.length(), expected_data_begin) != 0) {
+ static const char kDataBegin[] = "{\"data/";
+ static const size_t kDataBeginLength = sizeof kDataBegin - 1;
+ if (data.compare(0, kDataBeginLength, kDataBegin, kDataBeginLength) != 0) {
return testing::AssertionFailure() << data << " does not begin with "
- << expected_data_begin;
+ << kDataBegin;
}
- static const char kDataEnd[] = "\"}";
+ static const char kDataEnd[] = "\"}}";
static const size_t kDataEndLength = sizeof kDataEnd - 1;
if (data.compare(data.length() - kDataEndLength,
kDataEndLength,
@@ -98,18 +99,6 @@ INSTANTIATE_TEST_CASE_P(
AllRegions, FakeDownloaderTest,
testing::ValuesIn(RegionDataConstants::GetRegionCodes()));
-// Verifies that the key "data" also contains valid data.
-TEST_F(FakeDownloaderTest, DownloadExistingData) {
- static const std::string kKey = "data";
- static const std::string kUrl =
- std::string(FakeDownloader::kFakeDataUrl) + kKey;
- downloader_.Download(kUrl, BuildCallback());
-
- EXPECT_TRUE(success_);
- EXPECT_EQ(kUrl, url_);
- EXPECT_TRUE(DataIsValid(data_, kKey));
-}
-
// Verifies that downloading a missing key will return "{}".
TEST_F(FakeDownloaderTest, DownloadMissingKeyReturnsEmptyDictionary) {
static const std::string kJunkUrl =

Powered by Google App Engine
This is Rietveld 408576698