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>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
QSet<QString> SongLoader::sRawUriSchemes;
|
QSet<QString> SongLoader::sRawUriSchemes;
|
||||||
|
const int SongLoader::kDefaultTimeout = 5000;
|
||||||
|
|
||||||
SongLoader::SongLoader(QObject *parent)
|
SongLoader::SongLoader(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
timeout_timer_(new QTimer(this)),
|
timeout_timer_(new QTimer(this)),
|
||||||
playlist_parser_(new PlaylistParser(this)),
|
playlist_parser_(new PlaylistParser(this)),
|
||||||
|
timeout_(kDefaultTimeout),
|
||||||
state_(WaitingForType),
|
state_(WaitingForType),
|
||||||
success_(false),
|
success_(false),
|
||||||
parser_(NULL)
|
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;
|
url_ = url;
|
||||||
|
|
||||||
if (url_.scheme() == "file") {
|
if (url_.scheme() == "file") {
|
||||||
@ -69,7 +71,7 @@ SongLoader::Result SongLoader::Load(const QUrl& url, int timeout_msec) {
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout_timer_->start(timeout_msec);
|
timeout_timer_->start(timeout_);
|
||||||
return LoadRemote();
|
return LoadRemote();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +40,15 @@ public:
|
|||||||
WillLoadAsync,
|
WillLoadAsync,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const int kDefaultTimeout;
|
||||||
|
|
||||||
const QUrl& url() const { return url_; }
|
const QUrl& url() const { return url_; }
|
||||||
const SongList& songs() const { return songs_; }
|
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:
|
signals:
|
||||||
void LoadFinished(bool success);
|
void LoadFinished(bool success);
|
||||||
@ -87,6 +92,7 @@ private:
|
|||||||
PlaylistParser* playlist_parser_;
|
PlaylistParser* playlist_parser_;
|
||||||
|
|
||||||
// For async loads
|
// For async loads
|
||||||
|
int timeout_;
|
||||||
State state_;
|
State state_;
|
||||||
bool success_;
|
bool success_;
|
||||||
boost::shared_ptr<GstElement> pipeline_;
|
boost::shared_ptr<GstElement> pipeline_;
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
loader_.reset(new SongLoader);
|
loader_.reset(new SongLoader);
|
||||||
|
loader_->set_timeout(20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadLocalDirectory(const QString& dir);
|
void LoadLocalDirectory(const QString& dir);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user