Process all pending events before checking if page is loading
JavaScipt actions and other asynchronous events which cause a WebPage load may not be processed by the time we receive an incoming command. Ensure that these events get processed before checking if the page is loading by calling QApplication::processEvents(). Fixes spurious failures throughout the test suite.
This commit is contained in:
parent
b829103bbd
commit
56fcecdd16
|
@ -3,6 +3,7 @@
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
TimeoutCommand::TimeoutCommand(Command *command, WebPageManager *manager, QObject *parent) : Command(parent) {
|
TimeoutCommand::TimeoutCommand(Command *command, WebPageManager *manager, QObject *parent) : Command(parent) {
|
||||||
m_command = command;
|
m_command = command;
|
||||||
|
@ -14,6 +15,7 @@ TimeoutCommand::TimeoutCommand(Command *command, WebPageManager *manager, QObjec
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeoutCommand::start() {
|
void TimeoutCommand::start() {
|
||||||
|
QApplication::processEvents();
|
||||||
if (m_manager->isLoading()) {
|
if (m_manager->isLoading()) {
|
||||||
m_manager->logger() << this->toString() << "waiting for load to finish";
|
m_manager->logger() << this->toString() << "waiting for load to finish";
|
||||||
connect(m_manager, SIGNAL(pageFinished(bool)), this, SLOT(pendingLoadFinished(bool)));
|
connect(m_manager, SIGNAL(pageFinished(bool)), this, SLOT(pendingLoadFinished(bool)));
|
||||||
|
|
Loading…
Reference in New Issue