Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

Issue 12320020: Merge 142755 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
===================================================================
--- Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp (revision 143514)
+++ Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp (working copy)
@@ -186,6 +186,7 @@
void renderOnRepaintRequestedShouldNotRecurse();
void loadSignalsOrder_data();
void loadSignalsOrder();
+ void openWindowDefaultSize();
#ifdef Q_OS_MAC
void macCopyUnicodeToClipboard();
@@ -410,10 +411,13 @@
QCOMPARE(page.lineNumbers.at(0), 1);
}
-class TestPage : public QWebPage
-{
+class TestPage : public QWebPage {
+ Q_OBJECT
public:
- TestPage(QObject* parent = 0) : QWebPage(parent) {}
+ TestPage(QObject* parent = 0) : QWebPage(parent)
+ {
+ connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
+ }
struct Navigation {
QPointer<QWebFrame> frame;
@@ -422,7 +426,8 @@
};
QList<Navigation> navigations;
- QList<QWebPage*> createdWindows;
+ QList<TestPage*> createdWindows;
+ QRect requestedGeometry;
virtual bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type) {
Navigation n;
@@ -434,10 +439,15 @@
}
virtual QWebPage* createWindow(WebWindowType) {
- QWebPage* page = new TestPage(this);
+ TestPage* page = new TestPage(this);
createdWindows.append(page);
return page;
}
+
+private Q_SLOTS:
+ void slotGeometryChangeRequested(const QRect& geom) {
+ requestedGeometry = geom;
+ }
};
void tst_QWebPage::popupFormSubmission()
@@ -3252,5 +3262,29 @@
QVERIFY(typingActionText != alignActionText);
}
+void tst_QWebPage::openWindowDefaultSize()
+{
+ TestPage page;
+ page.settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
+ // Open a default window.
+ page.mainFrame()->evaluateJavaScript("window.open()");
+ // Open a too small window.
+ page.mainFrame()->evaluateJavaScript("window.open('', '', 'width=10,height=10')");
+
+ QTest::qWait(500);
+ // The number of popups created should be two.
+ QVERIFY(page.createdWindows.size() == 2);
+
+ QRect requestedGeometry = page.createdWindows[0]->requestedGeometry;
+ // Check default size has been requested.
+ QVERIFY(requestedGeometry.width() == 0);
+ QVERIFY(requestedGeometry.height() == 0);
+
+ requestedGeometry = page.createdWindows[1]->requestedGeometry;
+ // Check minimum size has been requested.
+ QVERIFY(requestedGeometry.width() == 100);
+ QVERIFY(requestedGeometry.height() == 100);
+}
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"
« no previous file with comments | « Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698