summaryrefslogtreecommitdiffstats
path: root/Tools/QtTestBrowser
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /Tools/QtTestBrowser
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Tools/QtTestBrowser')
-rw-r--r--Tools/QtTestBrowser/QtTestBrowser.pro2
-rw-r--r--Tools/QtTestBrowser/launcherwindow.cpp82
-rw-r--r--Tools/QtTestBrowser/launcherwindow.h16
-rw-r--r--Tools/QtTestBrowser/locationedit.h2
-rw-r--r--Tools/QtTestBrowser/main.cpp10
-rw-r--r--Tools/QtTestBrowser/mainwindow.cpp8
-rw-r--r--Tools/QtTestBrowser/mainwindow.h3
7 files changed, 116 insertions, 7 deletions
diff --git a/Tools/QtTestBrowser/QtTestBrowser.pro b/Tools/QtTestBrowser/QtTestBrowser.pro
index 62d2c02..6c8cdf4 100644
--- a/Tools/QtTestBrowser/QtTestBrowser.pro
+++ b/Tools/QtTestBrowser/QtTestBrowser.pro
@@ -25,7 +25,7 @@ HEADERS += \
CONFIG += uitools
isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../..
-include(../../WebKit.pri)
+include(../../Source/WebKit.pri)
DESTDIR = $$OUTPUT_DIR/bin
!CONFIG(standalone_package): CONFIG -= app_bundle
diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp
index 067b146..bd332fc 100644
--- a/Tools/QtTestBrowser/launcherwindow.cpp
+++ b/Tools/QtTestBrowser/launcherwindow.cpp
@@ -96,6 +96,7 @@ void LauncherWindow::initializeView()
{
delete m_view;
+ m_inputUrl = addressUrl();
QUrl url = page()->mainFrame()->url();
setPage(new WebPage(this));
page()->setQnamThreaded(m_windowOptions.useThreadedQnam);
@@ -142,6 +143,10 @@ void LauncherWindow::initializeView()
if (url.isValid())
page()->mainFrame()->load(url);
+ else {
+ setAddressUrl(m_inputUrl);
+ m_inputUrl = QString();
+ }
}
void LauncherWindow::applyPrefs()
@@ -259,6 +264,24 @@ void LauncherWindow::createChrome()
toolsMenu->addSeparator();
+ QAction* toggleLocalStorage = toolsMenu->addAction("Enable Local Storage", this, SLOT(toggleLocalStorage(bool)));
+ toggleLocalStorage->setCheckable(true);
+ toggleLocalStorage->setChecked(m_windowOptions.useLocalStorage);
+
+ QAction* toggleOfflineStorageDatabase = toolsMenu->addAction("Enable Offline Storage Database", this, SLOT(toggleOfflineStorageDatabase(bool)));
+ toggleOfflineStorageDatabase->setCheckable(true);
+ toggleOfflineStorageDatabase->setChecked(m_windowOptions.useOfflineStorageDatabase);
+
+ QAction* toggleOfflineWebApplicationCache = toolsMenu->addAction("Enable Offline Web Application Cache", this, SLOT(toggleOfflineWebApplicationCache(bool)));
+ toggleOfflineWebApplicationCache->setCheckable(true);
+ toggleOfflineWebApplicationCache->setChecked(m_windowOptions.useOfflineWebApplicationCache);
+
+ QAction* offlineStorageDefaultQuotaAction = toolsMenu->addAction("Set Offline Storage Default Quota Size", this, SLOT(setOfflineStorageDefaultQuota()));
+ offlineStorageDefaultQuotaAction->setCheckable(true);
+ offlineStorageDefaultQuotaAction->setChecked(m_windowOptions.offlineStorageDefaultQuotaSize);
+
+ toolsMenu->addSeparator();
+
QAction* userAgentAction = toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
userAgentAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_U));
@@ -367,6 +390,14 @@ void LauncherWindow::createChrome()
QMenu* settingsMenu = menuBar()->addMenu("&Settings");
+ QAction* toggleAutoLoadImages = settingsMenu->addAction("Disable Auto Load Images", this, SLOT(toggleAutoLoadImages(bool)));
+ toggleAutoLoadImages->setCheckable(true);
+ toggleAutoLoadImages->setChecked(false);
+
+ QAction* togglePlugins = settingsMenu->addAction("Disable Plugins", this, SLOT(togglePlugins(bool)));
+ togglePlugins->setCheckable(true);
+ togglePlugins->setChecked(false);
+
QAction* toggleInterruptingJavaScripteEnabled = settingsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool)));
toggleInterruptingJavaScripteEnabled->setCheckable(true);
toggleInterruptingJavaScripteEnabled->setChecked(false);
@@ -530,8 +561,13 @@ void LauncherWindow::loadStarted()
void LauncherWindow::loadFinished()
{
QUrl url = page()->mainFrame()->url();
- setAddressUrl(url.toString(QUrl::RemoveUserInfo));
addCompleterEntry(url);
+ if (m_inputUrl.isEmpty())
+ setAddressUrl(url.toString(QUrl::RemoveUserInfo));
+ else {
+ setAddressUrl(m_inputUrl);
+ m_inputUrl = QString();
+ }
}
void LauncherWindow::showLinkHover(const QString &link, const QString &toolTip)
@@ -770,6 +806,16 @@ void LauncherWindow::toggleJavascriptCanOpenWindows(bool enable)
page()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, enable);
}
+void LauncherWindow::toggleAutoLoadImages(bool enable)
+{
+ page()->settings()->setAttribute(QWebSettings::AutoLoadImages, !enable);
+}
+
+void LauncherWindow::togglePlugins(bool enable)
+{
+ page()->settings()->setAttribute(QWebSettings::PluginsEnabled, !enable);
+}
+
#if defined(QT_CONFIGURED_WITH_OPENGL)
void LauncherWindow::toggleQGLWidgetViewport(bool enable)
{
@@ -874,6 +920,40 @@ void LauncherWindow::updateFPS(int fps)
#endif
}
+void LauncherWindow::toggleLocalStorage(bool toggle)
+{
+ m_windowOptions.useLocalStorage = toggle;
+ page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, toggle);
+}
+
+void LauncherWindow::toggleOfflineStorageDatabase(bool toggle)
+{
+ m_windowOptions.useOfflineStorageDatabase = toggle;
+ page()->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, toggle);
+}
+
+void LauncherWindow::toggleOfflineWebApplicationCache(bool toggle)
+{
+ m_windowOptions.useOfflineWebApplicationCache = toggle;
+ page()->settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, toggle);
+}
+
+void LauncherWindow::setOfflineStorageDefaultQuota()
+{
+ // For command line execution, quota size is taken from command line.
+ if (m_windowOptions.offlineStorageDefaultQuotaSize)
+ page()->settings()->setOfflineStorageDefaultQuota(m_windowOptions.offlineStorageDefaultQuotaSize);
+ else {
+#ifndef QT_NO_INPUTDIALOG
+ bool ok;
+ // Maximum size is set to 25 * 1024 * 1024.
+ int quotaSize = QInputDialog::getInt(this, "Offline Storage Default Quota Size" , "Quota Size", 0, 0, 26214400, 1, &ok);
+ if (ok)
+ page()->settings()->setOfflineStorageDefaultQuota(quotaSize);
+#endif
+ }
+}
+
LauncherWindow* LauncherWindow::newWindow()
{
LauncherWindow* mw = new LauncherWindow(&m_windowOptions);
diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h
index 849b15d..e13858e 100644
--- a/Tools/QtTestBrowser/launcherwindow.h
+++ b/Tools/QtTestBrowser/launcherwindow.h
@@ -94,6 +94,10 @@ public:
, showFrameRate(false)
, resizesToContents(false)
, viewportUpdateMode(QGraphicsView::MinimalViewportUpdate)
+ , useLocalStorage(false)
+ , useOfflineStorageDatabase(false)
+ , useOfflineWebApplicationCache(false)
+ , offlineStorageDefaultQuotaSize(0)
#if defined(QT_CONFIGURED_WITH_OPENGL)
, useQGLWidgetViewport(false)
#endif
@@ -110,6 +114,10 @@ public:
bool showFrameRate;
bool resizesToContents;
QGraphicsView::ViewportUpdateMode viewportUpdateMode;
+ bool useLocalStorage;
+ bool useOfflineStorageDatabase;
+ bool useOfflineWebApplicationCache;
+ quint64 offlineStorageDefaultQuotaSize;
#if defined(QT_CONFIGURED_WITH_OPENGL)
bool useQGLWidgetViewport;
#endif
@@ -163,6 +171,12 @@ protected slots:
void toggleFrameFlattening(bool toggle);
void toggleInterruptingJavaScriptEnabled(bool enable);
void toggleJavascriptCanOpenWindows(bool enable);
+ void toggleAutoLoadImages(bool enable);
+ void togglePlugins(bool enable);
+ void toggleLocalStorage(bool toggle);
+ void toggleOfflineStorageDatabase(bool toggle);
+ void toggleOfflineWebApplicationCache(bool toggle);
+ void setOfflineStorageDefaultQuota();
#if defined(QT_CONFIGURED_WITH_OPENGL)
void toggleQGLWidgetViewport(bool enable);
@@ -206,6 +220,8 @@ private:
QPropertyAnimation* m_zoomAnimation;
QList<QTouchEvent::TouchPoint> m_touchPoints;
bool m_touchMocking;
+
+ QString m_inputUrl;
};
#endif
diff --git a/Tools/QtTestBrowser/locationedit.h b/Tools/QtTestBrowser/locationedit.h
index 752497e..962b422 100644
--- a/Tools/QtTestBrowser/locationedit.h
+++ b/Tools/QtTestBrowser/locationedit.h
@@ -28,6 +28,8 @@
#ifndef locationedit_h
#define locationedit_h
+#include <qconfig.h>
+
#ifndef QT_NO_INPUTDIALOG
#include <QtGui>
diff --git a/Tools/QtTestBrowser/main.cpp b/Tools/QtTestBrowser/main.cpp
index ec5f1d9..eecd9c3 100644
--- a/Tools/QtTestBrowser/main.cpp
+++ b/Tools/QtTestBrowser/main.cpp
@@ -164,18 +164,18 @@ void LauncherApplication::handleUserOptions()
}
if (args.contains("-local-storage-enabled"))
- QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
+ windowOptions.useLocalStorage = true;
if (args.contains("-offline-storage-database-enabled"))
- QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
+ windowOptions.useOfflineStorageDatabase = true;
if (args.contains("-offline-web-application-cache-enabled"))
- QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
+ windowOptions.useOfflineWebApplicationCache = true;
int setOfflineStorageDefaultQuotaIndex = args.indexOf("-set-offline-storage-default-quota");
if (setOfflineStorageDefaultQuotaIndex != -1) {
- int maxSize = takeOptionValue(&args, setOfflineStorageDefaultQuotaIndex).toInt();
- QWebSettings::globalSettings()->setOfflineStorageDefaultQuota(maxSize);
+ unsigned int maxSize = takeOptionValue(&args, setOfflineStorageDefaultQuotaIndex).toUInt();
+ windowOptions.offlineStorageDefaultQuotaSize = maxSize;
}
if (defaultForAnimations)
diff --git a/Tools/QtTestBrowser/mainwindow.cpp b/Tools/QtTestBrowser/mainwindow.cpp
index 9f4aec5..e2ea41d 100644
--- a/Tools/QtTestBrowser/mainwindow.cpp
+++ b/Tools/QtTestBrowser/mainwindow.cpp
@@ -171,6 +171,14 @@ void MainWindow::load(const QUrl& url)
page()->mainFrame()->load(url);
}
+QString MainWindow::addressUrl() const
+{
+#ifndef QT_NO_INPUTDIALOG
+ return urlEdit->text();
+#endif
+ return QString();
+}
+
void MainWindow::changeLocation()
{
#ifndef QT_NO_INPUTDIALOG
diff --git a/Tools/QtTestBrowser/mainwindow.h b/Tools/QtTestBrowser/mainwindow.h
index 3a39d57..08fa81e 100644
--- a/Tools/QtTestBrowser/mainwindow.h
+++ b/Tools/QtTestBrowser/mainwindow.h
@@ -59,6 +59,9 @@ protected slots:
void openLocation();
void changeLocation();
+protected:
+ QString addressUrl() const;
+
private:
void buildUI();