From 3e8bcc1cf6f3400fff9aa361ddc109bafe16d646 Mon Sep 17 00:00:00 2001 From: Jan Dalheimer Date: Sun, 15 Dec 2013 12:18:42 +0100 Subject: Unit tests for the DownloadUpdateTask class --- logic/updater/DownloadUpdateTask.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'logic/updater/DownloadUpdateTask.h') diff --git a/logic/updater/DownloadUpdateTask.h b/logic/updater/DownloadUpdateTask.h index f5b23d12..1d1fc7bf 100644 --- a/logic/updater/DownloadUpdateTask.h +++ b/logic/updater/DownloadUpdateTask.h @@ -34,7 +34,8 @@ public: */ QString updateFilesDir(); -protected: +public: + // TODO: We should probably put these data structures into a separate header... /*! @@ -59,6 +60,7 @@ protected: /*! * Structure that describes an entry in a GoUpdate version's `Files` list. */ + struct VersionFileEntry { QString path; @@ -69,6 +71,8 @@ protected: typedef QList VersionFileList; +protected: + friend class DownloadUpdateTaskTest; /*! * Structure that describes an operation to perform when installing updates. @@ -119,6 +123,13 @@ protected: */ virtual void findCurrentVersionInfo(); + /*! + * This runs after we've tried loading the channel list. + * If the channel list doesn't need to be loaded, this will be called immediately. + * If the channel list does need to be loaded, this will be called when it's done. + */ + void processChannels(); + /*! * Downloads the version info files from the repository. * The files for both the current build, and the build that we're updating to need to be downloaded. @@ -142,7 +153,7 @@ protected: /*! * Loads the file list from the given version info JSON object into the given list. */ - virtual void parseVersionInfo(VersionInfoFileEnum vfile, VersionFileList* list); + virtual bool parseVersionInfo(const QByteArray &data, VersionFileList* list, QString *error); /*! * Takes a list of file entries for the current version's files and the new version's files @@ -153,7 +164,7 @@ protected: /*! * Takes the operations list and writes an install script for the updater to the update files directory. */ - virtual void writeInstallScript(UpdateOperationList& opsList, QString scriptFile); + virtual bool writeInstallScript(UpdateOperationList& opsList, QString scriptFile); VersionFileList m_downloadList; UpdateOperationList m_operationList; @@ -181,6 +192,11 @@ protected: */ QTemporaryDir m_updateFilesDir; + /*! + * Substitutes $PWD for the application directory + */ + static QString preparePath(const QString &path); + protected slots: void vinfoDownloadFinished(); void vinfoDownloadFailed(); -- cgit v1.2.3