OSDN Git Service

Merge WebKit at r73109: Initial merge by git.
[android-x86/external-webkit.git] / WebKit / qt / tests / qwebframe / tst_qwebframe.cpp
index ec8a39e..eb3ae0a 100644 (file)
@@ -602,8 +602,8 @@ private slots:
     void setHtmlWithJSAlert();
     void ipv6HostEncoding();
     void metaData();
-#if !defined(Q_WS_MAEMO_5)
-    // as maemo 5 does not use QComboBoxes to implement the popups
+#if !defined(Q_WS_MAEMO_5) && !defined(Q_OS_SYMBIAN)
+    // as maemo 5 && symbian do not use QComboBoxes to implement the popups
     // this test does not make sense for it.
     void popupFocus();
 #endif
@@ -1566,26 +1566,26 @@ void tst_QWebFrame::connectAndDisconnect()
         QString type;
         QString ret = evalJS("(function() { }).connect()", type);
         QCOMPARE(type, sError);
-        QCOMPARE(ret, QLatin1String("TypeError: Result of expression '(function() { }).connect' [undefined] is not a function."));
+        QCOMPARE(ret, QLatin1String("TypeError: 'undefined' is not a function"));
     }
     {
         QString type;
         QString ret = evalJS("var o = { }; o.connect = Function.prototype.connect;  o.connect()", type);
         QCOMPARE(type, sError);
-        QCOMPARE(ret, QLatin1String("TypeError: Result of expression 'o.connect' [undefined] is not a function."));
+        QCOMPARE(ret, QLatin1String("TypeError: 'undefined' is not a function"));
     }
 
     {
         QString type;
         QString ret = evalJS("(function() { }).connect(123)", type);
         QCOMPARE(type, sError);
-        QCOMPARE(ret, QLatin1String("TypeError: Result of expression '(function() { }).connect' [undefined] is not a function."));
+        QCOMPARE(ret, QLatin1String("TypeError: 'undefined' is not a function"));
     }
     {
         QString type;
         QString ret = evalJS("var o = { }; o.connect = Function.prototype.connect;  o.connect(123)", type);
         QCOMPARE(type, sError);
-        QCOMPARE(ret, QLatin1String("TypeError: Result of expression 'o.connect' [undefined] is not a function."));
+        QCOMPARE(ret, QLatin1String("TypeError: 'undefined' is not a function"));
     }
 
     {
@@ -2389,7 +2389,9 @@ void tst_QWebFrame::javaScriptWindowObjectCleared_data()
 {
     QTest::addColumn<QString>("html");
     QTest::addColumn<int>("signalCount");
-    QTest::newRow("with <script>") << "<html><body><script></script><p>hello world</p></body></html>" << 1;
+    QTest::newRow("with <script>") << "<html><body><script>i=0</script><p>hello world</p></body></html>" << 1;
+    // NOTE: Empty scripts no longer cause this signal to be emitted.
+    QTest::newRow("with empty <script>") << "<html><body><script></script><p>hello world</p></body></html>" << 0;
     QTest::newRow("without <script>") << "<html><body><p>hello world</p></body></html>" << 0;
 }
 
@@ -2585,7 +2587,7 @@ void tst_QWebFrame::metaData()
     QCOMPARE(metaData.value("nonexistant"), QString());
 }
 
-#if !defined(Q_WS_MAEMO_5)
+#if !defined(Q_WS_MAEMO_5) && !defined(Q_OS_SYMBIAN)
 void tst_QWebFrame::popupFocus()
 {
     QWebView view;
@@ -2603,9 +2605,11 @@ void tst_QWebFrame::popupFocus()
                  "    </body>"
                  "</html>");
     view.resize(400, 100);
+    // Call setFocus before show to work around http://bugreports.qt.nokia.com/browse/QTBUG-14762
+    view.setFocus();
     view.show();
     QTest::qWaitForWindowShown(&view);
-    view.setFocus();
+    view.activateWindow();
     QTRY_VERIFY(view.hasFocus());
 
     // open the popup by clicking. check if focus is on the popup
@@ -2618,7 +2622,7 @@ void tst_QWebFrame::popupFocus()
 
     // hide the popup and check if focus is on the page
     combo->hidePopup();
-    QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView
+    QTRY_VERIFY(view.hasFocus()); // Focus should be back on the WebView
 }
 #endif
 
@@ -2629,6 +2633,7 @@ void tst_QWebFrame::inputFieldFocus()
     view.resize(400, 100);
     view.show();
     QTest::qWaitForWindowShown(&view);
+    view.activateWindow();
     view.setFocus();
     QTRY_VERIFY(view.hasFocus());