Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2017-08-21 16:53:04 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2017-09-13 16:25:28 +0300
commitfd45889908345f6692e82c2e07fe2e4e410cd612 (patch)
treea5686ca1b422ffbe0b2f5d45f5c5451eac818181 /storage
parenta8f973ba1bc413217a6a1b997eb8442a99883ef4 (diff)
Fixed unit tests after diffs integration
Diffstat (limited to 'storage')
-rw-r--r--storage/storage.cpp8
-rw-r--r--storage/storage.hpp2
-rw-r--r--storage/storage_integration_tests/download_calc_size_test.cpp2
-rw-r--r--storage/storage_integration_tests/storage_downloading_tests.cpp2
-rw-r--r--storage/storage_integration_tests/storage_group_download_tests.cpp2
-rw-r--r--storage/storage_integration_tests/storage_http_tests.cpp2
-rw-r--r--storage/storage_tests/storage_tests.cpp12
7 files changed, 17 insertions, 13 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp
index 01d7177127..63ab7786e2 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -229,7 +229,7 @@ void Storage::Clear()
SaveDownloadQueue();
}
-void Storage::RegisterAllLocalMaps()
+void Storage::RegisterAllLocalMaps(bool enableDiffs)
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());
@@ -276,7 +276,9 @@ void Storage::RegisterAllLocalMaps()
i = j;
}
- LoadDiffScheme();
+
+ if (enableDiffs)
+ LoadDiffScheme();
RestoreDownloadQueue();
}
@@ -893,6 +895,7 @@ void Storage::OnMapDownloadFinished(TCountryId const & countryId, bool success,
if (!success)
{
m_failedCountries.insert(countryId);
+ NotifyStatusChangedForHierarchy(countryId);
return;
}
@@ -902,6 +905,7 @@ void Storage::OnMapDownloadFinished(TCountryId const & countryId, bool success,
if (!isSuccess)
{
m_failedCountries.insert(countryId);
+ NotifyStatusChangedForHierarchy(countryId);
return;
}
diff --git a/storage/storage.hpp b/storage/storage.hpp
index 7be88e14f9..251fcc0700 100644
--- a/storage/storage.hpp
+++ b/storage/storage.hpp
@@ -480,7 +480,7 @@ public:
// of several versions of the same map keeps only the latest one, others
// are deleted from disk.
// *NOTE* storage will forget all already known local maps.
- void RegisterAllLocalMaps();
+ void RegisterAllLocalMaps(bool enableDiffs);
// Returns list of all local maps, including fake countries (World*.mwm).
void GetLocalMaps(vector<TLocalFilePtr> & maps) const;
diff --git a/storage/storage_integration_tests/download_calc_size_test.cpp b/storage/storage_integration_tests/download_calc_size_test.cpp
index 4e84386ca7..3b8619edd2 100644
--- a/storage/storage_integration_tests/download_calc_size_test.cpp
+++ b/storage/storage_integration_tests/download_calc_size_test.cpp
@@ -25,7 +25,7 @@ void InitStorage(Storage & storage, Storage::TUpdateCallback const & didDownload
};
storage.Init(didDownload, [](TCountryId const &, Storage::TLocalFilePtr const){return false;});
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
storage.Subscribe(changeCountryFunction, progress);
storage.SetDownloadingUrlsForTesting({kTestWebServer});
}
diff --git a/storage/storage_integration_tests/storage_downloading_tests.cpp b/storage/storage_integration_tests/storage_downloading_tests.cpp
index 1a05e05225..7809e933f2 100644
--- a/storage/storage_integration_tests/storage_downloading_tests.cpp
+++ b/storage/storage_integration_tests/storage_downloading_tests.cpp
@@ -45,7 +45,7 @@ void ChangeCountry(Storage & storage, TCountryId const & countryId)
void InitStorage(Storage & storage, Storage::TProgressFunction const & onProgressFn)
{
storage.Init(Update, [](TCountryId const &, storage::TLocalFilePtr const){return false;});
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
storage.Subscribe(bind(&ChangeCountry, ref(storage), _1), onProgressFn);
storage.SetDownloadingUrlsForTesting({kTestWebServer});
}
diff --git a/storage/storage_integration_tests/storage_group_download_tests.cpp b/storage/storage_integration_tests/storage_group_download_tests.cpp
index b7fc24aa65..d3ce0010d9 100644
--- a/storage/storage_integration_tests/storage_group_download_tests.cpp
+++ b/storage/storage_integration_tests/storage_group_download_tests.cpp
@@ -269,7 +269,7 @@ void TestDownloadDelete(bool downloadOneByOne, bool deleteOneByOne)
};
storage.Init(onUpdatedFn, [](TCountryId const &, storage::TLocalFilePtr const){return false;});
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
storage.SetDownloadingUrlsForTesting({kTestWebServer});
tests_support::ScopedDir cleanupVersionDir(version);
diff --git a/storage/storage_integration_tests/storage_http_tests.cpp b/storage/storage_integration_tests/storage_http_tests.cpp
index 6419113ff7..cc4b727320 100644
--- a/storage/storage_integration_tests/storage_http_tests.cpp
+++ b/storage/storage_integration_tests/storage_http_tests.cpp
@@ -71,7 +71,7 @@ void InitStorage(Storage & storage, Storage::TUpdateCallback const & didDownload
};
storage.Init(didDownload, [](TCountryId const &, TLocalFilePtr const){return false;});
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
storage.Subscribe(changeCountryFunction, progress);
storage.SetDownloadingUrlsForTesting({kTestWebServer});
}
diff --git a/storage/storage_tests/storage_tests.cpp b/storage/storage_tests/storage_tests.cpp
index 316ee1a904..bb0502ef21 100644
--- a/storage/storage_tests/storage_tests.cpp
+++ b/storage/storage_tests/storage_tests.cpp
@@ -519,7 +519,7 @@ void InitStorage(Storage & storage, TaskRunner & runner,
{
storage.Clear();
storage.Init(update, [](TCountryId const &, TLocalFilePtr const){return false;});
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
storage.SetDownloaderForTesting(make_unique<FakeMapFilesDownloader>(runner));
}
@@ -632,7 +632,7 @@ UNIT_TEST(StorageTest_DeleteTwoVersionsOfTheSameCountry)
: version::FOR_TESTING_TWO_COMPONENT_MWM2;
storage.Init(&OnCountryDownloaded, [](TCountryId const &, TLocalFilePtr const){return false;});
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
TCountryId const countryId = storage.FindCountryIdByFile("Azerbaijan");
TEST(IsCountryIdValid(countryId), ());
@@ -644,14 +644,14 @@ UNIT_TEST(StorageTest_DeleteTwoVersionsOfTheSameCountry)
TEST_EQUAL(Status::ENotDownloaded, storage.CountryStatusEx(countryId), ());
TLocalFilePtr localFileV1 = CreateDummyMapFile(countryFile, v1, 1024 /* size */);
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
latestLocalFile = storage.GetLatestLocalFile(countryId);
TEST(latestLocalFile.get(), ("Created map file wasn't found by storage."));
TEST_EQUAL(latestLocalFile->GetVersion(), localFileV1->GetVersion(), ());
TEST_EQUAL(Status::EOnDiskOutOfDate, storage.CountryStatusEx(countryId), ());
TLocalFilePtr localFileV2 = CreateDummyMapFile(countryFile, v2, 2048 /* size */);
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
latestLocalFile = storage.GetLatestLocalFile(countryId);
TEST(latestLocalFile.get(), ("Created map file wasn't found by storage."));
TEST_EQUAL(latestLocalFile->GetVersion(), localFileV2->GetVersion(), ());
@@ -989,7 +989,7 @@ UNIT_TEST(StorageTest_ObsoleteMapsRemoval)
TEST(map1.Exists(), ());
TEST(map2.Exists(), ());
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
TEST(!map1.Exists(), ());
map1.Reset();
@@ -1402,7 +1402,7 @@ UNIT_TEST(StorageTest_GetUpdateInfoSingleMwm)
}
Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
- storage.RegisterAllLocalMaps();
+ storage.RegisterAllLocalMaps(false /* enableDiffs */);
country1.SyncWithDisk();
country2.SyncWithDisk();