[WK2] TestRunner does not support overridePreference with value "0"
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 00:05:03 +0000 (00:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 00:05:03 +0000 (00:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97457

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-09-24
Reviewed by Alexey Proskuryakov.

Tools:

testRunner.overridePreference() was marked as taking a boolean
in argument in testRunner.idl even though the test cases are
passing strings to it. The current code works if the test
case wants to enable a setting and therefore passes "1" string.
However, if the test wants to disable a setting and passes "0"
string, the current code also evaluates this to true causing
certain test cases to fail.

The argument to testRunner.overridePreference() is now of string
type and a function has been added to convert the string passed
by the test to a boolean value.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::toBool):
(WTR):
(WTR::TestRunner::overridePreference):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(TestRunner):

LayoutTests:

Unskip fast/regions/css-regions-disabled.html test case for
WebKit2 now that WebKitTestRunner actually supports overriding
a boolean preference with "0" value (to disable it).

* platform/efl-wk2/TestExpectations:
* platform/gtk-wk2/TestExpectations:
* platform/mac-wk2/Skipped:
* platform/qt-5.0-wk2/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129430 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/efl-wk2/TestExpectations
LayoutTests/platform/gtk-wk2/TestExpectations
LayoutTests/platform/mac-wk2/Skipped
LayoutTests/platform/qt-5.0-wk2/Skipped
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

index 31160e4..bc0cab9 100644 (file)
@@ -1,3 +1,19 @@
+2012-09-24  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [WK2] TestRunner does not support overridePreference with value "0"
+        https://bugs.webkit.org/show_bug.cgi?id=97457
+
+        Reviewed by Alexey Proskuryakov.
+
+        Unskip fast/regions/css-regions-disabled.html test case for
+        WebKit2 now that WebKitTestRunner actually supports overriding
+        a boolean preference with "0" value (to disable it).
+
+        * platform/efl-wk2/TestExpectations:
+        * platform/gtk-wk2/TestExpectations:
+        * platform/mac-wk2/Skipped:
+        * platform/qt-5.0-wk2/Skipped:
+
 2012-09-24  Roger Fong  <roger_fong@apple.com>
 
         Unreviewed. Mark http/tests/security/inactive-document-with-empty-security-origin.html while Geoff Garen
index 39d8cc0..dc9d826 100644 (file)
@@ -203,5 +203,3 @@ Bug(EFL) http/tests/inspector/network/network-sidebar-width.html [ Failure ]
 # Fails after r128056.
 webkit.org/b/96794 inspector/console/alert-toString-exception.html [ Failure ]
 
-# CSS Regions Preference override fails.
-webkit.org/b/97457 fast/regions/css-regions-disabled.html [ Failure ]
index a3a57df..6c0e6ef 100644 (file)
@@ -476,8 +476,6 @@ Bug(GTK) fast/forms/select-type-ahead-non-latin.html [ Failure ]
 Bug(GTK) fast/loader/submit-form-while-parsing-2.html [ Failure ]
 Bug(GTK) fast/media/mq-transform-02.html [ Failure ]
 Bug(GTK) fast/media/mq-transform-03.html [ Failure ]
-Bug(GTK) fast/regions/css-regions-disabled.html [ Failure ]
-Bug(GTK) fast/regions/css-regions-disabled.html [ Failure ]
 Bug(GTK) fast/repaint/fixed-move-after-keyboard-scroll.html [ Failure ]
 Bug(GTK) fast/ruby/nested-ruby.html [ Failure ]
 Bug(GTK) fast/ruby/ruby-beforeafter.html [ Failure ]
index 2ff0033..2c4677f 100644 (file)
@@ -318,7 +318,6 @@ fast/frames/flattening/frameset-flattening-advanced.html
 fast/history/form-submit-in-frame-via-onclick.html
 fast/history/form-submit-in-frame.html
 fast/history/saves-state-after-frame-nav.html
-fast/regions/css-regions-disabled.html
 http/tests/inspector/extensions-ignore-cache.html
 http/tests/security/credentials-in-referer.html
 http/tests/workers/terminate-during-sync-operation.html
index 5fa8daf..61a9c17 100644 (file)
@@ -507,10 +507,6 @@ http/tests/security/storage-blocking-loosened-private-browsing-plugin.html
 http/tests/security/storage-blocking-strengthened-plugin.html
 http/tests/security/storage-blocking-strengthened-private-browsing-plugin.html
 
-# [Qt][WK2] fast/regions/css-regions-disabled.html fails
-# https://bugs.webkit.org/show_bug.cgi?id=97197
-fast/regions/css-regions-disabled.html
-
 # Unskipped by r129252 (wk2/Skipped list), but still fail on Qt WK2
 fast/dom/Geolocation/callback-exception.html
 fast/dom/Geolocation/callback-to-deleted-context.html
index 732868e..c75c979 100644 (file)
@@ -1,3 +1,30 @@
+2012-09-24  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [WK2] TestRunner does not support overridePreference with value "0"
+        https://bugs.webkit.org/show_bug.cgi?id=97457
+
+        Reviewed by Alexey Proskuryakov.
+
+        testRunner.overridePreference() was marked as taking a boolean
+        in argument in testRunner.idl even though the test cases are
+        passing strings to it. The current code works if the test
+        case wants to enable a setting and therefore passes "1" string.
+        However, if the test wants to disable a setting and passes "0"
+        string, the current code also evaluates this to true causing
+        certain test cases to fail.
+
+        The argument to testRunner.overridePreference() is now of string
+        type and a function has been added to convert the string passed
+        by the test to a boolean value.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::toBool):
+        (WTR):
+        (WTR::TestRunner::overridePreference):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (TestRunner):
+
 2012-09-24  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r129343.
index 5b177d5..35af514 100644 (file)
@@ -160,8 +160,7 @@ module WTR {
         // Cookies testing
         void setAlwaysAcceptCookies(in boolean accept);
 
-        // FIXME: handle non-boolean preferences.
-        void overridePreference(in DOMString preference, in boolean value);
+        void overridePreference(in DOMString preference, in DOMString value);
 
         // Page Visibility API
         void setPageVisibility(in DOMString state);
index 13c1838..e2ef155 100644 (file)
@@ -649,9 +649,15 @@ void TestRunner::callSetBackingScaleFactorCallback()
     callTestRunnerCallback(SetBackingScaleFactorCallbackID);
 }
 
-void TestRunner::overridePreference(JSStringRef preference, bool value)
+static inline bool toBool(JSStringRef value)
 {
-    WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), value);
+    return JSStringIsEqualToUTF8CString(value, "true") || JSStringIsEqualToUTF8CString(value, "1");
+}
+
+void TestRunner::overridePreference(JSStringRef preference, JSStringRef value)
+{
+    // FIXME: handle non-boolean preferences.
+    WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), toBool(value));
 }
 
 void TestRunner::sendWebIntentResponse(JSStringRef reply)
index 6300431..a441299 100644 (file)
@@ -228,7 +228,7 @@ public:
     void callFocusWebViewCallback();
     void callSetBackingScaleFactorCallback();
 
-    void overridePreference(JSStringRef preference, bool value);
+    void overridePreference(JSStringRef preference, JSStringRef value);
 
     // Web intents testing.
     void sendWebIntentResponse(JSStringRef reply);