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:
-rw-r--r--omim.pro4
-rw-r--r--platform/platform_tests_support/write_dir_changer.cpp2
-rw-r--r--platform/platform_tests_support/write_dir_changer.hpp2
-rw-r--r--storage/storage_integration_tests/migrate_tests.cpp15
-rw-r--r--storage/storage_integration_tests/storage_downloading_tests.cpp104
-rw-r--r--storage/storage_integration_tests/storage_group_download_tests.cpp41
-rw-r--r--storage/storage_integration_tests/storage_http_tests.cpp21
-rw-r--r--storage/storage_integration_tests/storage_integration_tests.pro7
-rw-r--r--storage/storage_integration_tests/storage_update_tests.cpp190
-rw-r--r--testing/testing.hpp6
-rw-r--r--testing/testingmain.cpp27
11 files changed, 381 insertions, 38 deletions
diff --git a/omim.pro b/omim.pro
index 7702e60ee0..473fb909ef 100644
--- a/omim.pro
+++ b/omim.pro
@@ -120,6 +120,10 @@ SUBDIRS = 3party base coding geometry editor indexer routing search
storage_tests.depends = $$MapDepLibs
SUBDIRS *= storage_tests
+ storage_integration_tests.subdir = storage/storage_integration_tests
+ storage_integration_tests.depends = $$MapDepLibs
+ SUBDIRS *= storage_integration_tests
+
map_tests.subdir = map/map_tests
map_tests.depends = $$MapDepLibs
SUBDIRS *= map_tests
diff --git a/platform/platform_tests_support/write_dir_changer.cpp b/platform/platform_tests_support/write_dir_changer.cpp
index b56a02c26d..5d192a295d 100644
--- a/platform/platform_tests_support/write_dir_changer.cpp
+++ b/platform/platform_tests_support/write_dir_changer.cpp
@@ -8,7 +8,7 @@
#include "coding/file_name_utils.hpp"
#include "coding/internal/file_data.hpp"
-WritableDirChanger::WritableDirChanger(string testDir)
+WritableDirChanger::WritableDirChanger(string const & testDir)
: m_writableDirBeforeTest(GetPlatform().WritableDir())
, m_testDirFullPath(m_writableDirBeforeTest + testDir)
{
diff --git a/platform/platform_tests_support/write_dir_changer.hpp b/platform/platform_tests_support/write_dir_changer.hpp
index 78595d45f2..e0e17ddc03 100644
--- a/platform/platform_tests_support/write_dir_changer.hpp
+++ b/platform/platform_tests_support/write_dir_changer.hpp
@@ -3,7 +3,7 @@
class WritableDirChanger
{
public:
- WritableDirChanger(string testDir);
+ WritableDirChanger(string const & testDir);
~WritableDirChanger();
private:
diff --git a/storage/storage_integration_tests/migrate_tests.cpp b/storage/storage_integration_tests/migrate_tests.cpp
index 06bf23bd5f..9fbe0df877 100644
--- a/storage/storage_integration_tests/migrate_tests.cpp
+++ b/storage/storage_integration_tests/migrate_tests.cpp
@@ -5,9 +5,9 @@
#include "platform/local_country_file_utils.hpp"
#include "platform/platform.hpp"
#include "platform/platform_tests_support/scoped_dir.hpp"
+#include "platform/platform_tests_support/write_dir_changer.hpp"
#include "coding/file_name_utils.hpp"
-#include "coding/internal/file_data.hpp"
#include "base/scope_guard.hpp"
#include "base/string_utils.hpp"
@@ -15,8 +15,6 @@
#include "std/string.hpp"
-#include "write_dir_changer.hpp"
-
using namespace platform;
using namespace storage;
@@ -36,7 +34,6 @@ UNIT_TEST(StorageFastMigrationTests)
Settings::Get("LastMigration", version);
TEST_GREATER_OR_EQUAL(s.GetCurrentDataVersion(), version, ());
- Settings::Clear();
}
UNIT_TEST(StorageMigrationTests)
@@ -46,7 +43,7 @@ UNIT_TEST(StorageMigrationTests)
TCountriesVec const kPrefetchCountries = {"Russia_Moscow"};
WritableDirChanger writableDirChanger(kMapTestDir);
- Settings::Clear();
+
Settings::Set("DisableFastMigrate", true);
Framework f;
@@ -86,15 +83,15 @@ UNIT_TEST(StorageMigrationTests)
s.DownloadNode(countryId);
// Wait for downloading complete.
- testing::EventLoop();
+ testing::RunEventLoop();
TEST_EQUAL(s.GetDownloadedFilesCount(), kOldCountries.size(), ());
for (auto const & countryId : kOldCountries)
TEST(s.IsNodeDownloaded(countryId), (countryId));
- f.PreMigrate(curPos, statePrefetchChanged, progressChanged);
+ // f.PreMigrate(curPos, statePrefetchChanged, progressChanged);
// Wait for downloading complete.
- testing::EventLoop();
+ testing::RunEventLoop();
TEST_EQUAL(s.GetDownloadedFilesCount(), kPrefetchCountries.size(), ());
for (auto const & countryId : kPrefetchCountries)
@@ -102,7 +99,7 @@ UNIT_TEST(StorageMigrationTests)
f.Migrate();
// Wait for downloading complete.
- testing::EventLoop();
+ testing::RunEventLoop();
TEST_EQUAL(s.GetDownloadedFilesCount(), kPrefetchCountries.size() + kNewCountries.size(), ());
for (auto const & countryId : kNewCountries)
diff --git a/storage/storage_integration_tests/storage_downloading_tests.cpp b/storage/storage_integration_tests/storage_downloading_tests.cpp
new file mode 100644
index 0000000000..f9ec57f381
--- /dev/null
+++ b/storage/storage_integration_tests/storage_downloading_tests.cpp
@@ -0,0 +1,104 @@
+#include "testing/testing.hpp"
+
+#include "storage/storage.hpp"
+
+#include "platform/local_country_file_utils.hpp"
+#include "platform/mwm_version.hpp"
+#include "platform/platform.hpp"
+#include "platform/platform_tests_support/scoped_dir.hpp"
+#include "platform/platform_tests_support/write_dir_changer.hpp"
+
+#include "coding/file_name_utils.hpp"
+
+#include "base/scope_guard.hpp"
+#include "base/string_utils.hpp"
+#include "base/thread.hpp"
+
+#include "std/exception.hpp"
+#include "std/string.hpp"
+
+using namespace platform;
+using namespace storage;
+
+namespace
+{
+
+string const kCountryId = "Angola";
+
+string const kTestWebServer = "http://new-search.mapswithme.com/";
+
+string const kMapTestDir = "map-tests";
+
+void Update(LocalCountryFile const & localCountryFile)
+{
+ TEST_EQUAL(localCountryFile.GetCountryName(), kCountryId, ());
+}
+
+class InterruptException : public exception {};
+
+} // namespace
+
+UNIT_TEST(SmallMwms_InterruptDownloadResumeDownload_Test)
+{
+ WritableDirChanger writableDirChanger(kMapTestDir);
+
+ // Start download but interrupt it
+ try
+ {
+ Storage storage(COUNTRIES_MIGRATE_FILE);
+ TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
+
+ auto onProgressFn = [](TCountryId const & countryId, LocalAndRemoteSizeT const & mapSize)
+ {
+ // Interrupt download
+ throw InterruptException();
+ };
+
+ auto onChangeCountryFn = [&](TCountryId const & countryId)
+ {
+ if (!storage.IsDownloadInProgress())
+ testing::StopEventLoop();
+ };
+
+ storage.Init(Update);
+ storage.RegisterAllLocalMaps();
+ storage.Subscribe(onChangeCountryFn, onProgressFn);
+ storage.SetDownloadingUrlsForTesting({kTestWebServer});
+
+ storage.DownloadNode(kCountryId);
+ testing::RunEventLoop();
+
+ TEST(false, ()); // If code reaches this point, test fails
+ }
+ catch (InterruptException const &)
+ {}
+
+ // Continue download
+
+ Storage storage(COUNTRIES_MIGRATE_FILE);
+
+ auto onProgressFn = [](TCountryId const & countryId, LocalAndRemoteSizeT const & mapSize) {};
+ auto onChangeCountryFn = [&](TCountryId const & countryId)
+ {
+ if (!storage.IsDownloadInProgress())
+ testing::StopEventLoop();
+ };
+
+ storage.Init(Update);
+ storage.RegisterAllLocalMaps();
+ storage.RestoreDownloadQueue();
+ storage.Subscribe(onChangeCountryFn, onProgressFn);
+ storage.SetDownloadingUrlsForTesting({kTestWebServer});
+
+ TEST(storage.IsDownloadInProgress(), ());
+
+ NodeAttrs attrs;
+ storage.GetNodeAttrs(kCountryId, attrs);
+ TEST_EQUAL(TStatus::EDownloading, attrs.m_status, ());
+
+ storage.DownloadNode(kCountryId);
+ testing::RunEventLoop();
+
+ storage.GetNodeAttrs(kCountryId, attrs);
+ TEST_EQUAL(TStatus::EOnDisk, attrs.m_status, ());
+}
diff --git a/storage/storage_integration_tests/storage_group_download_tests.cpp b/storage/storage_integration_tests/storage_group_download_tests.cpp
index 534c0c657d..ad6f1e781c 100644
--- a/storage/storage_integration_tests/storage_group_download_tests.cpp
+++ b/storage/storage_integration_tests/storage_group_download_tests.cpp
@@ -6,13 +6,12 @@
#include "platform/local_country_file_utils.hpp"
#include "platform/platform.hpp"
#include "platform/platform_tests_support/scoped_dir.hpp"
+#include "platform/platform_tests_support/write_dir_changer.hpp"
#include "coding/file_name_utils.hpp"
#include "storage/storage.hpp"
-#include "storage/storage_integration_tests/write_dir_changer.hpp"
-
#include "base/assert.hpp"
#include "std/condition_variable.hpp"
@@ -20,8 +19,6 @@
#include "std/set.hpp"
#include "std/unique_ptr.hpp"
-#include <QtCore/QCoreApplication>
-
using namespace platform;
using namespace storage;
@@ -77,7 +74,7 @@ void DownloadGroup(Storage & storage, bool oneByOne)
if (!storage.IsDownloadInProgress())
{
// end waiting when all chilren will be downloaded
- QCoreApplication::exit();
+ testing::StopEventLoop();
}
};
@@ -102,6 +99,25 @@ void DownloadGroup(Storage & storage, bool oneByOne)
storage.GetDownloadedChildren(kGroupCountryId, v);
TEST(v.empty(), ());
+ // Check status for the all children nodes is set to ENotDownloaded
+ size_t totalGroupSize = 0;
+ for (auto const & countryId : children)
+ {
+ TEST_EQUAL(TStatus::ENotDownloaded, storage.CountryStatusEx(countryId), ());
+ NodeAttrs attrs;
+ storage.GetNodeAttrs(countryId, attrs);
+ TEST_EQUAL(TStatus::ENotDownloaded, attrs.m_status, ());
+ TEST_GREATER(attrs.m_mwmSize, 0, ());
+ totalGroupSize += attrs.m_mwmSize;
+ }
+
+ // Check status for the group node is set to ENotDownloaded
+ NodeAttrs attrs;
+ storage.GetNodeAttrs(kGroupCountryId, attrs);
+ TEST_EQUAL(TStatus::ENotDownloaded, attrs.m_status, ());
+ TEST_EQUAL(attrs.m_mwmSize, totalGroupSize, ());
+ attrs = NodeAttrs();
+
// Check there is no mwm or any other files for the children nodes
for (auto const & countryId : children)
{
@@ -124,24 +140,23 @@ void DownloadGroup(Storage & storage, bool oneByOne)
storage.DownloadNode(kGroupCountryId);
}
// wait for downloading of all children
- QCoreApplication::exec();
+ testing::RunEventLoop();
// Check all children nodes have been downloaded and changed.
TEST_EQUAL(changed, children, ());
TEST_EQUAL(downloaded, children, ());
- // Check state for the group node is set to UpToDate and NoError
- NodeAttrs attrs;
+ // Check status for the group node is set to EOnDisk
storage.GetNodeAttrs(kGroupCountryId, attrs);
- // TEST_EQUAL(NodeStatus::UpToDate, attrs.m_status, ()); // DOES NOT WORK
+ TEST_EQUAL(TStatus::EOnDisk, attrs.m_status, ());
- // Check state for the all children nodes is set to UpToDate and NoError
+ // Check status for the all children nodes is set to EOnDisk
for (auto const & countryId : children)
{
TEST_EQUAL(TStatus::EOnDisk, storage.CountryStatusEx(countryId), ());
NodeAttrs attrs;
storage.GetNodeAttrs(countryId, attrs);
- // TEST_EQUAL(NodeStatus::UpToDate, attrs.m_status, ()); // DOES NOT WORK
+ TEST_EQUAL(TStatus::EOnDisk, attrs.m_status, ());
}
// Check there is only mwm files are present and no any other for the children nodes
@@ -211,7 +226,7 @@ void DeleteGroup(Storage & storage, bool oneByOne)
// Check state for the group node is set to UpToDate and NoError
NodeAttrs attrs;
storage.GetNodeAttrs(kGroupCountryId, attrs);
- // TEST_EQUAL(NodeStatus::NotDownloaded, attrs.m_status, ()); // DOES NOT WORK
+ TEST_EQUAL(TStatus::ENotDownloaded, attrs.m_status, ());
// Check state for the all children nodes is set to UpToDate and NoError
for (auto const & countryId : children)
@@ -219,7 +234,7 @@ void DeleteGroup(Storage & storage, bool oneByOne)
TEST_EQUAL(TStatus::ENotDownloaded, storage.CountryStatusEx(countryId), ());
NodeAttrs attrs;
storage.GetNodeAttrs(countryId, attrs);
- // TEST_EQUAL(NodeStatus::NotDownloaded, attrs.m_status, ()); // DOES NOT WORK
+ TEST_EQUAL(TStatus::ENotDownloaded, attrs.m_status, ());
}
// Check there are no mwm files for the children nodes
diff --git a/storage/storage_integration_tests/storage_http_tests.cpp b/storage/storage_integration_tests/storage_http_tests.cpp
index a3e460d10c..3f18f10cef 100644
--- a/storage/storage_integration_tests/storage_http_tests.cpp
+++ b/storage/storage_integration_tests/storage_http_tests.cpp
@@ -3,8 +3,10 @@
#include "storage/storage.hpp"
#include "platform/local_country_file_utils.hpp"
+#include "platform/mwm_version.hpp"
#include "platform/platform.hpp"
#include "platform/platform_tests_support/scoped_dir.hpp"
+#include "platform/platform_tests_support/write_dir_changer.hpp"
#include "coding/file_name_utils.hpp"
@@ -14,25 +16,23 @@
#include "std/string.hpp"
-#include "write_dir_changer.hpp"
+#include <QtCore/QCoreApplication>
using namespace platform;
using namespace storage;
namespace
{
+
string const kCountryId = "Angola";
+
string const kMapTestDir = "map-tests";
-void ChangeCountryFunction(TCountryId const & countryId) {}
+string const kTestWebServer = "http://new-search.mapswithme.com/";
void ProgressFunction(TCountryId const & countryId, LocalAndRemoteSizeT const & mapSize)
{
TEST_EQUAL(countryId, kCountryId, ());
- if (mapSize.first != mapSize.second)
- return;
-
- testing::StopEventLoop();
}
void Update(LocalCountryFile const & localCountryFile)
@@ -61,7 +61,7 @@ UNIT_TEST(StorageDownloadNodeAndDeleteNodeTests)
storage.Init(Update);
storage.RegisterAllLocalMaps();
storage.Subscribe(ChangeCountryFunction, ProgressFunction);
- storage.SetDownloadingUrlsForTesting({"http://new-search.mapswithme.com/"});
+ storage.SetDownloadingUrlsForTesting({kTestWebServer});
string const version = strings::to_string(storage.GetCurrentDataVersion());
tests_support::ScopedDir cleanupVersionDir(version);
MY_SCOPE_GUARD(cleanup,
@@ -81,9 +81,8 @@ UNIT_TEST(StorageDownloadNodeAndDeleteNodeTests)
// Downloading to an empty directory.
storage.DownloadNode(kCountryId);
-
// Wait for downloading complete.
- testing::EventLoop();
+ testing::RunEventLoop();
TEST(platform.IsFileExistsByFullPath(mwmFullPath), ());
TEST(!platform.IsFileExistsByFullPath(downloadingFullPath), ());
@@ -91,9 +90,7 @@ UNIT_TEST(StorageDownloadNodeAndDeleteNodeTests)
// Downloading to directory with Angola.mwm.
storage.DownloadNode(kCountryId);
-
- // Wait for downloading complete.
- testing::EventLoop();
+ testing::RunEventLoop();
TEST(platform.IsFileExistsByFullPath(mwmFullPath), ());
TEST(!platform.IsFileExistsByFullPath(downloadingFullPath), ());
diff --git a/storage/storage_integration_tests/storage_integration_tests.pro b/storage/storage_integration_tests/storage_integration_tests.pro
index a72f8ec610..e59f71a2ac 100644
--- a/storage/storage_integration_tests/storage_integration_tests.pro
+++ b/storage/storage_integration_tests/storage_integration_tests.pro
@@ -6,8 +6,9 @@ CONFIG -= app_bundle
TEMPLATE = app
ROOT_DIR = ../..
-DEPENDENCIES = map drape_frontend routing search storage indexer platform_tests_support drape platform geometry coding base \
- freetype expat fribidi tomcrypt jansson protobuf osrm stats_client minizip succinct
+DEPENDENCIES = map drape_frontend routing search storage indexer drape platform_tests_support platform editor opening_hours geometry \
+ coding base freetype expat fribidi tomcrypt jansson protobuf osrm stats_client \
+ minizip succinct pugixml oauthcpp
include($$ROOT_DIR/common.pri)
@@ -28,5 +29,7 @@ HEADERS += \
SOURCES += \
../../testing/testingmain.cpp \
migrate_tests.cpp \
+ storage_downloading_tests.cpp \
storage_group_download_tests.cpp \
storage_http_tests.cpp \
+ storage_update_tests.cpp \
diff --git a/storage/storage_integration_tests/storage_update_tests.cpp b/storage/storage_integration_tests/storage_update_tests.cpp
new file mode 100644
index 0000000000..b27b19c984
--- /dev/null
+++ b/storage/storage_integration_tests/storage_update_tests.cpp
@@ -0,0 +1,190 @@
+#include "testing/testing.hpp"
+
+#include "map/framework.hpp"
+
+#include "platform/http_request.hpp"
+#include "platform/local_country_file_utils.hpp"
+#include "platform/platform.hpp"
+#include "platform/platform_tests_support/write_dir_changer.hpp"
+
+#include "coding/file_name_utils.hpp"
+#include "coding/internal/file_data.hpp"
+
+#include "storage/storage.hpp"
+
+#include "std/unique_ptr.hpp"
+
+using namespace platform;
+using namespace storage;
+
+namespace
+{
+
+string const kTestWebServer = "http://new-search.mapswithme.com/";
+
+string const kMapTestDir = "map-tests";
+
+string const kMwmVersion1 = "160107";
+size_t const kCountriesTxtFileSize1 = 131488;
+
+string const kMwmVersion2 = "160118";
+size_t const kCountriesTxtFileSize2 = 131485;
+
+string const kGroupCountryId = "Belarus";
+
+bool DownloadFile(string const & url,
+ string const & filePath,
+ size_t fileSize)
+{
+ using namespace downloader;
+
+ HttpRequest::StatusT httpStatus;
+ bool finished = false;
+
+ unique_ptr<HttpRequest> request(HttpRequest::GetFile({url}, filePath, fileSize,
+ [&](HttpRequest & request)
+ {
+ HttpRequest::StatusT const s = request.Status();
+ if (s == HttpRequest::EFailed || s == HttpRequest::ECompleted)
+ {
+ httpStatus = s;
+ finished = true;
+ testing::StopEventLoop();
+ }
+ }));
+
+ testing::RunEventLoop();
+
+ return httpStatus == HttpRequest::ECompleted;
+}
+
+string GetCountriesTxtWebUrl(string const version)
+{
+ return kTestWebServer + "/direct/" + version + "/countries.txt";
+}
+
+string GetCountriesTxtFilePath()
+{
+ return GetPlatform().WritableDir() + "countries.txt";
+}
+
+string GetMwmFilePath(string const & version, TCountryId const & countryId)
+{
+ return my::JoinFoldersToPath({GetPlatform().WritableDir(), version},
+ countryId + DATA_FILE_EXTENSION);
+}
+
+} // namespace
+
+UNIT_TEST(SmallMwms_Update_Test)
+{
+ WritableDirChanger writableDirChanger(kMapTestDir);
+
+ Platform & platform = GetPlatform();
+
+ auto onProgressFn = [&](TCountryId const & countryId, LocalAndRemoteSizeT const & mapSize) {};
+
+ // Download countries.txt for version 1
+ TEST(DownloadFile(GetCountriesTxtWebUrl(kMwmVersion1), GetCountriesTxtFilePath(), kCountriesTxtFileSize1), ());
+
+ {
+ Framework f;
+ auto & storage = f.Storage();
+ string const version = strings::to_string(storage.GetCurrentDataVersion());
+ TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
+ TEST_EQUAL(version, kMwmVersion1, ());
+ auto onChangeCountryFn = [&](TCountryId const & countryId)
+ {
+ if (!storage.IsDownloadInProgress())
+ testing::StopEventLoop();
+ };
+ storage.Subscribe(onChangeCountryFn, onProgressFn);
+ storage.SetDownloadingUrlsForTesting({kTestWebServer});
+
+ TCountriesVec children;
+ storage.GetChildren(kGroupCountryId, children);
+
+ // Download group
+ TEST(storage.DownloadNode(kGroupCountryId), ());
+ testing::RunEventLoop();
+
+ // Check group node status is EOnDisk
+ NodeAttrs attrs;
+ storage.GetNodeAttrs(kGroupCountryId, attrs);
+ TEST_EQUAL(TStatus::EOnDisk, attrs.m_status, ());
+
+ // Check mwm files for version 1 are present
+ for (auto const & child : children)
+ {
+ string const mwmFullPathV1 = GetMwmFilePath(kMwmVersion1, child);
+ TEST(platform.IsFileExistsByFullPath(mwmFullPathV1), ());
+ }
+ }
+
+ // Replace countries.txt by version 2
+ TEST(my::DeleteFileX(GetCountriesTxtFilePath()), ());
+ TEST(DownloadFile(GetCountriesTxtWebUrl(kMwmVersion2), GetCountriesTxtFilePath(), kCountriesTxtFileSize2), ());
+
+ {
+ Framework f;
+ auto & storage = f.Storage();
+ string const version = strings::to_string(storage.GetCurrentDataVersion());
+ TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ());
+ TEST_EQUAL(version, kMwmVersion2, ());
+ auto onChangeCountryFn = [&](TCountryId const & countryId)
+ {
+ if (!storage.IsDownloadInProgress())
+ testing::StopEventLoop();
+ };
+ storage.Subscribe(onChangeCountryFn, onProgressFn);
+ storage.SetDownloadingUrlsForTesting({kTestWebServer});
+
+ TCountriesVec children;
+ storage.GetChildren(kGroupCountryId, children);
+
+ // Check group node status is EOnDiskOutOfDate
+ NodeAttrs attrs;
+ storage.GetNodeAttrs(kGroupCountryId, attrs);
+ TEST_EQUAL(TStatus::EOnDiskOutOfDate, attrs.m_status, ());
+
+ // Check children node status is EOnDiskOutOfDate
+ for (auto const & child : children)
+ {
+ NodeAttrs attrs;
+ storage.GetNodeAttrs(child, attrs);
+ TEST_EQUAL(TStatus::EOnDiskOutOfDate, attrs.m_status, ());
+ }
+
+ // Check mwm files for version 1 are present
+ for (auto const & child : children)
+ {
+ string const mwmFullPathV1 = GetMwmFilePath(kMwmVersion1, child);
+ TEST(platform.IsFileExistsByFullPath(mwmFullPathV1), ());
+ }
+
+ // Download group, new version
+ storage.DownloadNode(kGroupCountryId);
+ testing::StopEventLoop();
+
+ // Check group node status is EOnDisk
+ storage.GetNodeAttrs(kGroupCountryId, attrs);
+ TEST_EQUAL(TStatus::EOnDisk, attrs.m_status, ());
+
+ // Check children node status is EOnDisk
+ for (auto const & child : children)
+ {
+ NodeAttrs attrs;
+ storage.GetNodeAttrs(child, attrs);
+ TEST_EQUAL(TStatus::EOnDisk, attrs.m_status, ());
+ }
+
+ // Check mwm files for version 2 are present and not present for version 1
+ for (auto const & child : children)
+ {
+ string const mwmFullPathV1 = GetMwmFilePath(kMwmVersion1, child);
+ string const mwmFullPathV2 = GetMwmFilePath(kMwmVersion2, child);
+ TEST(platform.IsFileExistsByFullPath(mwmFullPathV2), ());
+ TEST(!platform.IsFileExistsByFullPath(mwmFullPathV1), ());
+ }
+ }
+}
diff --git a/testing/testing.hpp b/testing/testing.hpp
index 4c82ac6ffa..6bbfe3b0ef 100644
--- a/testing/testing.hpp
+++ b/testing/testing.hpp
@@ -40,6 +40,12 @@ namespace my
}
}
+namespace testing
+{
+ void RunEventLoop();
+ void StopEventLoop();
+} // namespace testing
+
// This struct contains parsed command line options. It may contain pointers to argc contents.
struct CommandLineOptions
{
diff --git a/testing/testingmain.cpp b/testing/testingmain.cpp
index 5c3dddf114..1d081b1b94 100644
--- a/testing/testingmain.cpp
+++ b/testing/testingmain.cpp
@@ -32,6 +32,33 @@
#endif
#endif
+namespace testing
+{
+
+void RunEventLoop()
+{
+#ifdef OMIM_OS_IPHONE_DEVICE
+ CFRunLoopRun();
+#else
+# ifdef QAPP
+ QAPP::exec();
+# endif
+#endif
+}
+
+void StopEventLoop()
+{
+#ifdef OMIM_OS_IPHONE_DEVICE
+ CFRunLoopStop(CFRunLoopGetMain());
+#else
+# ifdef QAPP
+ QAPP::exit();
+# endif
+#endif
+}
+
+} // namespace testing
+
namespace
{
bool g_bLastTestOK = true;