Prevents downloading MWM file if it is already downloaded and not out of date

This commit is contained in:
Sergey Yershov 2016-03-09 15:10:00 +03:00
parent 0c2cacdb20
commit f21b74ab9c
2 changed files with 21 additions and 0 deletions

View file

@ -1204,6 +1204,9 @@ void Storage::DownloadNode(TCountryId const & countryId)
if (!node)
return;
if (GetNodeStatus(*node).status == NodeStatus::OnDisk)
return;
auto downloadAction = [this](TCountryTreeNode const & descendantNode)
{
if (descendantNode.ChildrenCount() == 0)

View file

@ -55,6 +55,24 @@ void InitStorage(Storage & storage, Storage::TProgressFunction const & onProgres
} // namespace
UNIT_TEST(SmallMwms_ReDownloadExistedMWMIgnored_Test)
{
WritableDirChanger writableDirChanger(kMapTestDir);
Storage storage(COUNTRIES_FILE);
TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
InitStorage(storage, [](TCountryId const & countryId, TLocalAndRemoteSize const & mapSize){});
TEST(!storage.IsDownloadInProgress(), ());
storage.DownloadNode(kCountryId);
TEST(storage.IsDownloadInProgress(), ());
testing::RunEventLoop();
TEST(!storage.IsDownloadInProgress(), ());
storage.DownloadNode(kCountryId);
TEST(!storage.IsDownloadInProgress(), ());
}
UNIT_TEST(SmallMwms_InterruptDownloadResumeDownload_Test)
{
WritableDirChanger writableDirChanger(kMapTestDir);