diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2013-12-15 12:18:42 +0100 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2013-12-15 12:18:42 +0100 |
commit | 3e8bcc1cf6f3400fff9aa361ddc109bafe16d646 (patch) | |
tree | afe65f236ffada97947daf0993002cbb3dc46950 /logic/updater/DownloadUpdateTask.h | |
parent | f273334212274b1f1c7da376ef186314de8c4428 (diff) | |
download | MultiMC-3e8bcc1cf6f3400fff9aa361ddc109bafe16d646.tar MultiMC-3e8bcc1cf6f3400fff9aa361ddc109bafe16d646.tar.gz MultiMC-3e8bcc1cf6f3400fff9aa361ddc109bafe16d646.tar.lz MultiMC-3e8bcc1cf6f3400fff9aa361ddc109bafe16d646.tar.xz MultiMC-3e8bcc1cf6f3400fff9aa361ddc109bafe16d646.zip |
Unit tests for the DownloadUpdateTask class
Diffstat (limited to 'logic/updater/DownloadUpdateTask.h')
-rw-r--r-- | logic/updater/DownloadUpdateTask.h | 22 |
1 files changed, 19 insertions, 3 deletions
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<VersionFileEntry> VersionFileList; +protected: + friend class DownloadUpdateTaskTest; /*! * Structure that describes an operation to perform when installing updates. @@ -120,6 +124,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. * If the current version's info file can't be found, MultiMC will not delete files that @@ -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(); |