Set a longer remote timeout on unit tests so they don't fail when they run on buildbit with high load.
This commit is contained in:
parent
9106abb1a0
commit
ed422c3743
@ -30,11 +30,13 @@
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
QSet<QString> SongLoader::sRawUriSchemes;
|
||||
const int SongLoader::kDefaultTimeout = 5000;
|
||||
|
||||
SongLoader::SongLoader(QObject *parent)
|
||||
: QObject(parent),
|
||||
timeout_timer_(new QTimer(this)),
|
||||
playlist_parser_(new PlaylistParser(this)),
|
||||
timeout_(kDefaultTimeout),
|
||||
state_(WaitingForType),
|
||||
success_(false),
|
||||
parser_(NULL)
|
||||
@ -55,7 +57,7 @@ SongLoader::~SongLoader() {
|
||||
}
|
||||
}
|
||||
|
||||
SongLoader::Result SongLoader::Load(const QUrl& url, int timeout_msec) {
|
||||
SongLoader::Result SongLoader::Load(const QUrl& url) {
|
||||
url_ = url;
|
||||
|
||||
if (url_.scheme() == "file") {
|
||||
@ -69,7 +71,7 @@ SongLoader::Result SongLoader::Load(const QUrl& url, int timeout_msec) {
|
||||
return Success;
|
||||
}
|
||||
|
||||
timeout_timer_->start(timeout_msec);
|
||||
timeout_timer_->start(timeout_);
|
||||
return LoadRemote();
|
||||
}
|
||||
|
||||
|
@ -40,10 +40,15 @@ public:
|
||||
WillLoadAsync,
|
||||
};
|
||||
|
||||
static const int kDefaultTimeout;
|
||||
|
||||
const QUrl& url() const { return url_; }
|
||||
const SongList& songs() const { return songs_; }
|
||||
|
||||
Result Load(const QUrl& url, int timeout_msec = 5000);
|
||||
int timeout() const { return timeout_; }
|
||||
void set_timeout(int msec) { timeout_ = msec; }
|
||||
|
||||
Result Load(const QUrl& url);
|
||||
|
||||
signals:
|
||||
void LoadFinished(bool success);
|
||||
@ -87,6 +92,7 @@ private:
|
||||
PlaylistParser* playlist_parser_;
|
||||
|
||||
// For async loads
|
||||
int timeout_;
|
||||
State state_;
|
||||
bool success_;
|
||||
boost::shared_ptr<GstElement> pipeline_;
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
protected:
|
||||
void SetUp() {
|
||||
loader_.reset(new SongLoader);
|
||||
loader_->set_timeout(20000);
|
||||
}
|
||||
|
||||
void LoadLocalDirectory(const QString& dir);
|
||||
|
Loading…
x
Reference in New Issue
Block a user