Disable the pagecache/cache to get more stable loading results
[qtwebkit:performance.git] / tests / launcher / main.cpp
1 #include <QApplication>
2 #include <QWebPage>
3 #include <QWebView>
4
5 #include <QDebug>
6
7 class Monitor : public QObject {
8     Q_OBJECT
9 public:
10     Monitor(QWebView* view)
11         : m_view(view)
12     {
13         connect(view, SIGNAL(loadFinished(bool)), SLOT(loadFinished(bool)));
14     }
15
16 public Q_SLOTS:
17     void loadFinished(bool result) {
18         qWarning("Load finished with result: %d on '%s'", result, qPrintable(m_view->url().toString()));
19     }
20
21 private:
22     QWebView* m_view;
23 };
24
25
26 int main(int argc, char** argv)
27 {
28     QApplication app(argc, argv);
29
30     QWebSettings::globalSettings()->setMaximumPagesInCache(0);
31     QWebSettings::globalSettings()->setObjectCacheCapacities(0, 0, 0);
32     QWebView* view = new QWebView;
33     Monitor mon(view);
34
35     view->show();
36     view->showFullScreen();
37
38     if (app.arguments().size() >= 2)
39         view->load(QUrl(app.arguments().at(1)));
40     else
41         view->load(QUrl("http://doc.qtsoftware.com"));
42
43     return app.exec();
44 }
45
46 #include "main.moc"