Move gamepad to Modules/ (+ some cleanup)
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Nov 2011 20:51:42 +0000 (20:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Nov 2011 20:51:42 +0000 (20:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72785

Patch by Scott Graham <scottmg@chromium.org> on 2011-11-19
Reviewed by Adam Barth.

Source/WebCore:

Move main files from page/ to Modules/gamepad/. #include guard the
gamepad header inclusions in Navigator.cpp to avoid including for
ports that do not enable GAMEPAD.

* Modules/gamepad/Gamepad.cpp: Renamed from Source/WebCore/page/Gamepad.cpp.
(WebCore::Gamepad::Gamepad):
(WebCore::Gamepad::axes):
(WebCore::Gamepad::buttons):
(WebCore::Gamepad::~Gamepad):
* Modules/gamepad/Gamepad.h: Renamed from Source/WebCore/page/Gamepad.h.
* Modules/gamepad/Gamepad.idl: Renamed from Source/WebCore/page/Gamepad.idl.
* Modules/gamepad/GamepadList.cpp: Renamed from Source/WebCore/page/GamepadList.cpp.
(WebCore::GamepadList::~GamepadList):
(WebCore::GamepadList::set):
(WebCore::GamepadList::length):
(WebCore::GamepadList::item):
* Modules/gamepad/GamepadList.h: Renamed from Source/WebCore/page/GamepadList.h.
(WebCore::GamepadList::create):
(WebCore::GamepadList::GamepadList):
* Modules/gamepad/GamepadList.idl: Renamed from Source/WebCore/page/GamepadList.idl.
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* page/Navigator.cpp:

LayoutTests:

Use standard pre/post js test harness rather than custom one.

* gamepad/gamepad-api-expected.txt:
* gamepad/gamepad-api.html:
* gamepad/gamepad-test.js: Removed.

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/gamepad/gamepad-api-expected.txt
LayoutTests/gamepad/gamepad-api.html
LayoutTests/gamepad/gamepad-test.js [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/Modules/gamepad/Gamepad.cpp [moved from Source/WebCore/page/Gamepad.cpp with 100% similarity]
Source/WebCore/Modules/gamepad/Gamepad.h [moved from Source/WebCore/page/Gamepad.h with 100% similarity]
Source/WebCore/Modules/gamepad/Gamepad.idl [moved from Source/WebCore/page/Gamepad.idl with 100% similarity]
Source/WebCore/Modules/gamepad/GamepadList.cpp [moved from Source/WebCore/page/GamepadList.cpp with 100% similarity]
Source/WebCore/Modules/gamepad/GamepadList.h [moved from Source/WebCore/page/GamepadList.h with 100% similarity]
Source/WebCore/Modules/gamepad/GamepadList.idl [moved from Source/WebCore/page/GamepadList.idl with 100% similarity]
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/WebCore.gypi
Source/WebCore/page/Navigator.cpp

index 6a4bc70cd71f95d0d4c64b064494c04c4682c1d2..14a0db502a72b5521f4f9426db817b0989259e58 100644 (file)
@@ -1,3 +1,16 @@
+2011-11-19  Scott Graham  <scottmg@chromium.org>
+
+        Move gamepad to Modules/ (+ some cleanup)
+        https://bugs.webkit.org/show_bug.cgi?id=72785
+
+        Reviewed by Adam Barth.
+
+        Use standard pre/post js test harness rather than custom one.
+
+        * gamepad/gamepad-api-expected.txt:
+        * gamepad/gamepad-api.html:
+        * gamepad/gamepad-test.js: Removed.
+
 2011-11-19  David Barr  <davidbarr@chromium.org>
 
         REGRESSION(r98542): Chromium: CSS text is rendered on page
index d900ebf3aed7d050bed832eafcc04f0a54d05c4f..6194a2baad1772c90d1cf8d025534432b6ef6cab 100644 (file)
@@ -1,3 +1,5 @@
-EXPECTED (navigator.webkitGamepads !== 'undefined') OK
-END OF TEST
+PASS navigator.webkitGamepads is defined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
 Make sure the main polling access point exists on navigator.
index b5f0e34644b6c1cded69902d05d37f3c507a9fae..eab5d209cf0ed62842d1338c59ae46b264940bdd 100644 (file)
@@ -1,9 +1,9 @@
 <!DOCTYPE html>
 <body>
-<script src="gamepad-test.js"></script>
+<script src="../fast/js/resources/js-test-pre.js"></script>
 <script>
-    testExpected("navigator.webkitGamepads", undefined, "!==");
-    endTest();
+    shouldBeDefined("navigator.webkitGamepads");
 </script>
+<script src="../fast/js/resources/js-test-post.js"></script>
 <p>Make sure the main polling access point exists on navigator.</p>
 </body>
diff --git a/LayoutTests/gamepad/gamepad-test.js b/LayoutTests/gamepad/gamepad-test.js
deleted file mode 100644 (file)
index 261b4f3..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-var console = null;
-var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting())
-
-logConsole();
-
-if (window.layoutTestController) {
-    layoutTestController.dumpAsText();
-    layoutTestController.waitUntilDone();
-}
-
-function logConsole()
-{
-    if (!console && document.body) {
-        console = document.createElement('div');
-        document.body.appendChild(console);
-    }
-    return console;
-}
-
-function testExpected(testFuncString, expected, comparison)
-{
-    try {
-        var observed = eval(testFuncString);
-    } catch (ex) {
-        consoleWrite(ex);
-        return;
-    }
-
-    if (comparison === undefined)
-        comparison = '==';
-
-    var success = false;
-    switch (comparison)
-    {
-        case '<':  success = observed <  expected; break;
-        case '<=': success = observed <= expected; break;
-        case '>':  success = observed >  expected; break;
-        case '>=': success = observed >= expected; break;
-        case '!=': success = observed != expected; break;
-        case '!==': success = observed !== expected; break;
-        case '==': success = observed == expected; break;
-        case '===': success = observed === expected; break;
-    }
-
-    reportExpected(success, testFuncString, comparison, expected, observed)
-}
-
-var testNumber = 0;
-
-function reportExpected(success, testFuncString, comparison, expected, observed)
-{
-    testNumber++;
-
-    var msg = "Test " + testNumber;
-
-    if (printFullTestDetails || !success)
-        msg = "EXPECTED (<em>" + testFuncString + " </em>" + comparison + " '<em>" + expected + "</em>')";
-
-    if (!success)
-        msg +=  ", OBSERVED '<em>" + observed + "</em>'";
-
-    logResult(success, msg);
-}
-
-function waitForEventAndEnd(element, eventName, funcString)
-{
-    waitForEvent(element, eventName, funcString, true)
-}
-
-function waitForEvent(element, eventName, func, endit)
-{
-    function _eventCallback(event)
-    {
-        consoleWrite("EVENT(" + eventName + ")");
-
-        if (func)
-            func(event);
-
-        if (endit)
-            endTest();
-    }
-
-    element.addEventListener(eventName, _eventCallback);
-}
-
-function waitForEventAndTest(element, eventName, testFuncString, endit)
-{
-    function _eventCallback(event)
-    {
-        logResult(eval(testFuncString), "EVENT(" + eventName + ") TEST(" + testFuncString + ")");
-        if (endit)
-            endTest();
-    }
-
-    element.addEventListener(eventName, _eventCallback);
-}
-
-function waitForEventTestAndEnd(element, eventName, testFuncString)
-{
-    waitForEventAndTest(element, eventName, testFuncString, true);
-}
-
-var testEnded = false;
-
-function endTest()
-{
-    consoleWrite("END OF TEST");
-    testEnded = true;
-    if (window.layoutTestController)
-        layoutTestController.notifyDone();
-}
-
-function logResult(success, text)
-{
-    if (success)
-        consoleWrite(text + " <span style='color:green'>OK</span>");
-    else
-        consoleWrite(text + " <span style='color:red'>FAIL</span>");
-}
-
-function consoleWrite(text)
-{
-    if (testEnded)
-        return;
-    logConsole().innerHTML += text + "<br>";
-}
index c3f81c02d1a015fda03b80894c31bcfbc8605478..21bec231e1cfd9cd9055bf434f0e6f4d9bc4fc77 100644 (file)
@@ -1,3 +1,34 @@
+2011-11-19  Scott Graham  <scottmg@chromium.org>
+
+        Move gamepad to Modules/ (+ some cleanup)
+        https://bugs.webkit.org/show_bug.cgi?id=72785
+
+        Reviewed by Adam Barth.
+
+        Move main files from page/ to Modules/gamepad/. #include guard the
+        gamepad header inclusions in Navigator.cpp to avoid including for
+        ports that do not enable GAMEPAD.
+
+        * Modules/gamepad/Gamepad.cpp: Renamed from Source/WebCore/page/Gamepad.cpp.
+        (WebCore::Gamepad::Gamepad):
+        (WebCore::Gamepad::axes):
+        (WebCore::Gamepad::buttons):
+        (WebCore::Gamepad::~Gamepad):
+        * Modules/gamepad/Gamepad.h: Renamed from Source/WebCore/page/Gamepad.h.
+        * Modules/gamepad/Gamepad.idl: Renamed from Source/WebCore/page/Gamepad.idl.
+        * Modules/gamepad/GamepadList.cpp: Renamed from Source/WebCore/page/GamepadList.cpp.
+        (WebCore::GamepadList::~GamepadList):
+        (WebCore::GamepadList::set):
+        (WebCore::GamepadList::length):
+        (WebCore::GamepadList::item):
+        * Modules/gamepad/GamepadList.h: Renamed from Source/WebCore/page/GamepadList.h.
+        (WebCore::GamepadList::create):
+        (WebCore::GamepadList::GamepadList):
+        * Modules/gamepad/GamepadList.idl: Renamed from Source/WebCore/page/GamepadList.idl.
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gypi:
+        * page/Navigator.cpp:
+
 2011-11-19  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r100834.
index 26a98d0a852f37de058e45d8b8e689ab5f1b1f23..b4deb2f7c71583b293d730c016c7df2d23da53d6 100644 (file)
@@ -48,6 +48,7 @@
     'webcore_include_dirs': [
       '../',
       '../..',
+      '../Modules/gamepad',
       '../accessibility',
       '../accessibility/chromium',
       '../bindings',
index 1f5268e284c68ffec7c92230368e6c43419614c4..cd5f25651537ea83d1fc30659c885f071c8791c8 100644 (file)
             'svg/properties/SVGTransformListPropertyTearOff.h',
         ],
         'webcore_bindings_idl_files': [
+            'Modules/gamepad/Gamepad.idl',
+            'Modules/gamepad/GamepadList.idl',
             'css/CSSCharsetRule.idl',
             'css/CSSFontFaceRule.idl',
             'css/CSSImportRule.idl',
             'page/DOMSelection.idl',
             'page/DOMWindow.idl',
             'page/EventSource.idl',
-            'page/Gamepad.idl',
-            'page/GamepadList.idl',
             'page/Geolocation.idl',
             'page/Geoposition.idl',
             'page/History.idl',
             'svg/SVGZoomEvent.idl',
         ],
         'webcore_files': [
+            'Modules/gamepad/Gamepad.cpp',
+            'Modules/gamepad/Gamepad.h',
+            'Modules/gamepad/GamepadList.cpp',
+            'Modules/gamepad/GamepadList.h',
             'accessibility/AXObjectCache.cpp',
             'accessibility/AccessibilityARIAGrid.cpp',
             'accessibility/AccessibilityARIAGrid.h',
             'page/FrameActionScheduler.h',
             'page/FrameTree.cpp',
             'page/FrameView.cpp',
-            'page/Gamepad.cpp',
-            'page/Gamepad.h',
-            'page/GamepadList.cpp',
-            'page/GamepadList.h',
             'page/Geolocation.cpp',
             'page/GeolocationController.cpp',
             'page/GroupSettings.cpp',
index f3be0cc48fa4867412367e74dd75173b7a8f8ac5..de54dc51e1ebd16163f3f3c694ef5cb57e690a7b 100644 (file)
@@ -32,7 +32,6 @@
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
-#include "GamepadList.h"
 #include "Geolocation.h"
 #include "PointerLock.h"
 #include "KURL.h"
 #include <wtf/HashSet.h>
 #include <wtf/StdLibExtras.h>
 
+#if ENABLE(GAMEPAD)
+#include "GamepadList.h"
+#endif
+
 #if ENABLE(MEDIA_STREAM)
 #include "NavigatorUserMediaErrorCallback.h"
 #include "NavigatorUserMediaSuccessCallback.h"