diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2014-12-22 17:15:49 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2015-03-06 21:38:27 +0000 |
commit | 42c39d0545ee98feccf6d8059aee082c47a8e730 (patch) | |
tree | 450b742d81007c3a8b783fb2316ed4eb64bb42d1 /src/core | |
parent | b802ad902e4ebe7633b2d8df08b1a0d50fcc2dc8 (diff) |
Add testsupport QML API and error page signals
The testsupport API is used for test those features that are not
planned to be accessible via the public API. For example,
signals of the chromium's error page should not be visible for the
develepor but it is important to test whether the error page is loaded
properly.
Change-Id: Ie5b3265a207d05649cabd624a001a6ffe2e45971
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/web_contents_adapter_client.h | 4 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 2efacb460..d67accec2 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -152,10 +152,10 @@ public: virtual void selectionChanged() = 0; virtual QRectF viewportRect() const = 0; virtual qreal dpiScale() const = 0; - virtual void loadStarted(const QUrl &provisionalUrl) = 0; + virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) = 0; virtual void loadCommitted() = 0; virtual void loadVisuallyCommitted() = 0; - virtual void loadFinished(bool success, const QUrl &url, int errorCode = 0, const QString &errorDescription = QString()) = 0; + virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) = 0; virtual void focusContainer() = 0; virtual void unhandledKeyEvent(QKeyEvent *event) = 0; virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry) = 0; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index dd56bf2af..f69b68af5 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -144,6 +144,11 @@ void WebContentsDelegateQt::DidStartProvisionalLoadForFrame(content::RenderFrame { if (is_error_page) { m_loadingErrorFrameList.append(render_frame_host->GetRoutingID()); + + // Trigger LoadStarted signal for main frame's error page only. + if (!render_frame_host->GetParent()) + m_viewClient->loadStarted(toQt(validated_url), true); + return; } @@ -173,7 +178,7 @@ void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_h if (m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID()) || render_frame_host->GetParent()) return; - m_viewClient->loadFinished(false, toQt(validated_url), error_code, toQt(error_description)); + m_viewClient->loadFinished(false /* success */ , toQt(validated_url), false /* isErrorPage */, error_code, toQt(error_description)); m_viewClient->loadProgressChanged(0); } @@ -182,6 +187,11 @@ void WebContentsDelegateQt::DidFinishLoad(content::RenderFrameHost* render_frame if (m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID())) { Q_ASSERT(validated_url.is_valid() && validated_url.spec() == content::kUnreachableWebDataURL); m_viewClient->iconChanged(QUrl()); + + // Trigger LoadFinished signal for main frame's error page only. + if (!render_frame_host->GetParent()) + m_viewClient->loadFinished(true /* success */, toQt(validated_url), true /* isErrorPage */); + return; } |