From 6b6eb9126e4ba66621cdb3c26c0c025a1f2154dc Mon Sep 17 00:00:00 2001
From: Szabolcs David <davidsz@inf.u-szeged.hu>
Date: Tue, 9 Sep 2014 06:23:02 -0700
Subject: [PATCH] Fix tst_QWebEngineFrame::progressSignal API test case

This test fails, because we get two loadProgress signals with
the 100 value if the page load is successful.

Change-Id: Idbd68c28ba81f8ff0a5b1d98aece82e7a940f1b9
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
---
 examples/webenginewidgets/browser/webview.cpp | 6 +++---
 examples/webenginewidgets/browser/webview.h   | 2 +-
 src/core/web_contents_delegate_qt.cpp         | 1 -
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/examples/webenginewidgets/browser/webview.cpp b/examples/webenginewidgets/browser/webview.cpp
index ce0f7c418..7ede97b69 100644
--- a/examples/webenginewidgets/browser/webview.cpp
+++ b/examples/webenginewidgets/browser/webview.cpp
@@ -334,7 +334,7 @@ WebView::WebView(QWidget* parent)
     connect(this, SIGNAL(loadProgress(int)),
             this, SLOT(setProgress(int)));
     connect(this, SIGNAL(loadFinished(bool)),
-            this, SLOT(loadFinished()));
+            this, SLOT(loadFinished(bool)));
     connect(page(), SIGNAL(loadingUrl(QUrl)),
             this, SIGNAL(urlChanged(QUrl)));
     connect(page(), SIGNAL(iconUrlChanged(QUrl)),
@@ -410,9 +410,9 @@ void WebView::setProgress(int progress)
     m_progress = progress;
 }
 
-void WebView::loadFinished()
+void WebView::loadFinished(bool success)
 {
-    if (100 != m_progress) {
+    if (success && 100 != m_progress) {
         qWarning() << "Received finished signal while progress is still:" << progress()
                    << "Url:" << url();
     }
diff --git a/examples/webenginewidgets/browser/webview.h b/examples/webenginewidgets/browser/webview.h
index 2238abbd5..2cedeb79b 100644
--- a/examples/webenginewidgets/browser/webview.h
+++ b/examples/webenginewidgets/browser/webview.h
@@ -116,7 +116,7 @@ signals:
 
 private slots:
     void setProgress(int progress);
-    void loadFinished();
+    void loadFinished(bool success);
     void setStatusBarText(const QString &string);
     void downloadRequested(const QNetworkRequest &request);
     void openLinkInNewTab();
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index b30fcb1e3..c78305876 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -170,7 +170,6 @@ void WebContentsDelegateQt::DidFinishLoad(int64, const GURL &url, bool is_main_f
     }
 
     if (is_main_frame) {
-        m_viewClient->loadProgressChanged(100);
         m_viewClient->loadFinished(true, toQt(url));
 
         content::NavigationEntry *entry = web_contents()->GetController().GetActiveEntry();
-- 
GitLab