| Differences between
and this patch
- a/Source/WebCore/ChangeLog +36 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-11-15  Scott Graham  <scottmg@chromium.org>
2
3
        IDL changes for gamepad support
4
        https://bugs.webkit.org/show_bug.cgi?id=71753
5
6
        IDL changes and associated plumbing to expose list of gamepad objects
7
        on navigator object (per current spec). Full patch is
8
        https://bugs.webkit.org/show_bug.cgi?id=69451. Only basic existence
9
        test until more plumbing in future patches.
10
 
11
        Reviewed by NOBODY (OOPS!).
12
13
        Test: gamepad/gamepad-api.html
14
15
        * WebCore.gypi:
16
        * page/Gamepad.cpp: Added.
17
        (WebCore::Gamepad::Gamepad):
18
        (WebCore::Gamepad::axes):
19
        (WebCore::Gamepad::buttons):
20
        (WebCore::Gamepad::~Gamepad):
21
        * page/Gamepad.h: Added.
22
        * page/Gamepad.idl: Added.
23
        * page/GamepadList.cpp: Added.
24
        (WebCore::GamepadList::~GamepadList):
25
        (WebCore::GamepadList::set):
26
        (WebCore::GamepadList::length):
27
        (WebCore::GamepadList::item):
28
        * page/GamepadList.h: Added.
29
        (WebCore::GamepadList::create):
30
        (WebCore::GamepadList::GamepadList):
31
        * page/GamepadList.idl: Added.
32
        * page/Navigator.cpp:
33
        (WebCore::Navigator::gamepads):
34
        * page/Navigator.h:
35
        * page/Navigator.idl:
36
1
2011-11-15  Nate Chapin  <japhet@chromium.org>
37
2011-11-15  Nate Chapin  <japhet@chromium.org>
2
38
3
        CachedResourceRequest is now the only SubresourceLoaderClient
39
        CachedResourceRequest is now the only SubresourceLoaderClient
- a/Source/WebCore/WebCore.gypi +6 lines
Lines 1398-1403 a/Source/WebCore/WebCore.gypi_sec1
1398
            'page/DOMSelection.idl',
1398
            'page/DOMSelection.idl',
1399
            'page/DOMWindow.idl',
1399
            'page/DOMWindow.idl',
1400
            'page/EventSource.idl',
1400
            'page/EventSource.idl',
1401
            'page/Gamepad.idl',
1402
            'page/GamepadList.idl',
1401
            'page/Geolocation.idl',
1403
            'page/Geolocation.idl',
1402
            'page/Geoposition.idl',
1404
            'page/Geoposition.idl',
1403
            'page/History.idl',
1405
            'page/History.idl',
Lines 2946-2951 a/Source/WebCore/WebCore.gypi_sec2
2946
            'page/FrameActionScheduler.h',
2948
            'page/FrameActionScheduler.h',
2947
            'page/FrameTree.cpp',
2949
            'page/FrameTree.cpp',
2948
            'page/FrameView.cpp',
2950
            'page/FrameView.cpp',
2951
            'page/Gamepad.cpp',
2952
            'page/Gamepad.h',
2953
            'page/GamepadList.cpp',
2954
            'page/GamepadList.h',
2949
            'page/Geolocation.cpp',
2955
            'page/Geolocation.cpp',
2950
            'page/GeolocationController.cpp',
2956
            'page/GeolocationController.cpp',
2951
            'page/GroupSettings.cpp',
2957
            'page/GroupSettings.cpp',
- a/Source/WebCore/page/Gamepad.cpp +55 lines
Line 0 a/Source/WebCore/page/Gamepad.cpp_sec1
1
// Copyright (C) 2011, Google Inc. All rights reserved.
2
//
3
// Redistribution and use in source and binary forms, with or without
4
// modification, are permitted provided that the following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright
7
//    notice, this list of conditions and the following disclaimer.
8
// 2. Redistributions in binary form must reproduce the above copyright
9
//    notice, this list of conditions and the following disclaimer in the
10
//    documentation and/or other materials provided with the distribution.
11
//
12
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
// ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
16
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
22
// DAMAGE.
23
24
#include "config.h"
25
#include "Gamepad.h"
26
27
#if ENABLE(GAMEPAD)
28
29
#include <wtf/text/WTFString.h>
30
31
namespace WebCore {
32
33
Gamepad::Gamepad()
34
{
35
}
36
37
void Gamepad::axes(unsigned count, float* data)
38
{
39
    m_axes.resize(count);
40
    std::copy(data, data + count, m_axes.begin());
41
}
42
43
void Gamepad::buttons(unsigned count, float* data)
44
{
45
    m_buttons.resize(count);
46
    std::copy(data, data + count, m_buttons.begin());
47
}
48
49
Gamepad::~Gamepad()
50
{
51
}
52
53
} // namespace WebCore
54
55
#endif // ENABLE(GAMEPAD)
- a/Source/WebCore/page/Gamepad.h +69 lines
Line 0 a/Source/WebCore/page/Gamepad.h_sec1
1
// Copyright (C) 2011, Google Inc. All rights reserved.
2
//
3
// Redistribution and use in source and binary forms, with or without
4
// modification, are permitted provided that the following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright
7
//    notice, this list of conditions and the following disclaimer.
8
// 2. Redistributions in binary form must reproduce the above copyright
9
//    notice, this list of conditions and the following disclaimer in the
10
//    documentation and/or other materials provided with the distribution.
11
//
12
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
// ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
16
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
22
// DAMAGE.
23
24
#ifndef Gamepad_h
25
#define Gamepad_h
26
27
#include <wtf/RefCounted.h>
28
#include <wtf/Vector.h>
29
#include <wtf/text/WTFString.h>
30
31
namespace WebCore {
32
33
class Gamepad: public RefCounted<Gamepad> {
34
public:
35
    static PassRefPtr<Gamepad> create()
36
    {
37
        return adoptRef(new Gamepad);
38
    }
39
    ~Gamepad();
40
41
    typedef Vector<float> FloatVector;
42
43
    const String& id() const { return m_id; }
44
    void id(const String& id) { m_id = id; }
45
46
    unsigned index() const { return m_index; }
47
    void index(unsigned val) { m_index = val; }
48
49
    unsigned long long timestamp() const { return m_timestamp; }
50
    void timestamp(unsigned long long val) { m_timestamp = val; }
51
52
    const FloatVector& axes() const { return m_axes; }
53
    void axes(unsigned count, float* data);
54
55
    const FloatVector& buttons() const { return m_buttons; }
56
    void buttons(unsigned count, float* data);
57
58
private:
59
    Gamepad();
60
    String m_id;
61
    unsigned m_index;
62
    unsigned long long m_timestamp;
63
    FloatVector m_axes;
64
    FloatVector m_buttons;
65
};
66
67
} // namespace WebCore
68
69
#endif // Gamepad_h
- a/Source/WebCore/page/Gamepad.idl +36 lines
Line 0 a/Source/WebCore/page/Gamepad.idl_sec1
1
// Copyright (C) 2011, Google Inc. All rights reserved.
2
//
3
// Redistribution and use in source and binary forms, with or without
4
// modification, are permitted provided that the following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright
7
//    notice, this list of conditions and the following disclaimer.
8
// 2. Redistributions in binary form must reproduce the above copyright
9
//    notice, this list of conditions and the following disclaimer in the
10
//    documentation and/or other materials provided with the distribution.
11
//
12
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
// ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
16
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
22
// DAMAGE.
23
24
module dom {
25
26
    interface [
27
        Conditional=GAMEPAD
28
    ] Gamepad {
29
        readonly attribute DOMString id;
30
        readonly attribute unsigned long index;
31
        readonly attribute unsigned long long timestamp;
32
        readonly attribute float[] axes;
33
        readonly attribute float[] buttons;
34
    };
35
36
}
- a/Source/WebCore/page/GamepadList.cpp +56 lines
Line 0 a/Source/WebCore/page/GamepadList.cpp_sec1
1
// Copyright (C) 2011, Google Inc. All rights reserved.
2
//
3
// Redistribution and use in source and binary forms, with or without
4
// modification, are permitted provided that the following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright
7
//    notice, this list of conditions and the following disclaimer.
8
// 2. Redistributions in binary form must reproduce the above copyright
9
//    notice, this list of conditions and the following disclaimer in the
10
//    documentation and/or other materials provided with the distribution.
11
//
12
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
// ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
16
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
22
// DAMAGE.
23
24
#include "config.h"
25
#include "GamepadList.h"
26
27
#include "Gamepad.h"
28
29
#if ENABLE(GAMEPAD)
30
31
namespace WebCore {
32
33
GamepadList::~GamepadList()
34
{
35
}
36
37
void GamepadList::set(unsigned index, PassRefPtr<Gamepad> gamepad)
38
{
39
    if (index >= kMaximumGamepads)
40
        return;
41
    m_items[index] = gamepad;
42
}
43
44
unsigned GamepadList::length() const
45
{
46
    return kMaximumGamepads;
47
}
48
49
Gamepad* GamepadList::item(unsigned index)
50
{
51
    return index < length() ? m_items[index].get() : 0;
52
}
53
54
} // namespace WebCore
55
56
#endif // ENABLE(GAMEPAD)
- a/Source/WebCore/page/GamepadList.h +53 lines
Line 0 a/Source/WebCore/page/GamepadList.h_sec1
1
// Copyright (C) 2011, Google Inc. All rights reserved.
2
//
3
// Redistribution and use in source and binary forms, with or without
4
// modification, are permitted provided that the following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright
7
//    notice, this list of conditions and the following disclaimer.
8
// 2. Redistributions in binary form must reproduce the above copyright
9
//    notice, this list of conditions and the following disclaimer in the
10
//    documentation and/or other materials provided with the distribution.
11
//
12
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
// ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
16
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
22
// DAMAGE.
23
24
#ifndef GamepadList_h
25
#define GamepadList_h
26
27
#include "Gamepad.h"
28
#include <wtf/PassRefPtr.h>
29
#include <wtf/RefCounted.h>
30
#include <wtf/Vector.h>
31
32
namespace WebCore {
33
34
typedef Vector<RefPtr<Gamepad> > GamepadVector;
35
36
class GamepadList : public RefCounted<GamepadList> {
37
public:
38
    static PassRefPtr<GamepadList> create() { return adoptRef(new GamepadList); }
39
    ~GamepadList();
40
41
    void set(unsigned index, PassRefPtr<Gamepad>);
42
    Gamepad* item(unsigned index);
43
    unsigned length() const;
44
45
private:
46
    enum { kMaximumGamepads = 4 };
47
    GamepadList() { }
48
    RefPtr<Gamepad> m_items[kMaximumGamepads];
49
};
50
51
} // namespace WebCore
52
53
#endif // GamepadList_h
- a/Source/WebCore/page/GamepadList.idl +34 lines
Line 0 a/Source/WebCore/page/GamepadList.idl_sec1
1
// Copyright (C) 2011, Google Inc. All rights reserved.
2
//
3
// Redistribution and use in source and binary forms, with or without
4
// modification, are permitted provided that the following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright
7
//    notice, this list of conditions and the following disclaimer.
8
// 2. Redistributions in binary form must reproduce the above copyright
9
//    notice, this list of conditions and the following disclaimer in the
10
//    documentation and/or other materials provided with the distribution.
11
//
12
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
// ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
16
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
22
// DAMAGE.
23
24
module dom {
25
26
    interface [
27
        Conditional=GAMEPAD,
28
        HasIndexGetter
29
    ] GamepadList {
30
        readonly attribute unsigned long length;
31
        Gamepad item(in [Optional=CallWithDefaultValue] unsigned long index);
32
    };
33
34
}
- a/Source/WebCore/page/Navigator.cpp +9 lines
Lines 32-37 a/Source/WebCore/page/Navigator.cpp_sec1
32
#include "Frame.h"
32
#include "Frame.h"
33
#include "FrameLoader.h"
33
#include "FrameLoader.h"
34
#include "FrameLoaderClient.h"
34
#include "FrameLoaderClient.h"
35
#include "GamepadList.h"
35
#include "Geolocation.h"
36
#include "Geolocation.h"
36
#include "MouseLockable.h"
37
#include "MouseLockable.h"
37
#include "KURL.h"
38
#include "KURL.h"
Lines 289-292 void Navigator::webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUs a/Source/WebCore/page/Navigator.cpp_sec2
289
}
290
}
290
#endif
291
#endif
291
292
293
#if ENABLE(GAMEPAD)
294
GamepadList* Navigator::gamepads()
295
{
296
    // Stubbed until platform/ changes landed.
297
    return 0;
298
}
299
#endif
300
292
} // namespace WebCore
301
} // namespace WebCore
- a/Source/WebCore/page/Navigator.h +5 lines
Lines 31-36 namespace WebCore { a/Source/WebCore/page/Navigator.h_sec1
31
class DOMMimeTypeArray;
31
class DOMMimeTypeArray;
32
class DOMPluginArray;
32
class DOMPluginArray;
33
class Frame;
33
class Frame;
34
class GamepadList;
34
class Geolocation;
35
class Geolocation;
35
class MouseLockable;
36
class MouseLockable;
36
class NavigatorUserMediaErrorCallback;
37
class NavigatorUserMediaErrorCallback;
Lines 74-79 public: a/Source/WebCore/page/Navigator.h_sec2
74
    virtual void webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&);
75
    virtual void webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&);
75
#endif
76
#endif
76
77
78
#if ENABLE(GAMEPAD)
79
    GamepadList* gamepads();
80
#endif
81
77
private:
82
private:
78
    Navigator(Frame*);
83
    Navigator(Frame*);
79
    Frame* m_frame;
84
    Frame* m_frame;
- a/Source/WebCore/page/Navigator.idl +4 lines
Lines 61-66 module window { a/Source/WebCore/page/Navigator.idl_sec1
61
                                                           in [Callback=FunctionOnly, Optional] NavigatorUserMediaErrorCallback errorCallback)
61
                                                           in [Callback=FunctionOnly, Optional] NavigatorUserMediaErrorCallback errorCallback)
62
            raises(DOMException);
62
            raises(DOMException);
63
#endif
63
#endif
64
65
#if defined(ENABLE_GAMEPAD) && ENABLE_GAMEPAD
66
        readonly attribute [EnabledAtRuntime] GamepadList gamepads;
67
#endif
64
    };
68
    };
65
69
66
}
70
}
- a/Tools/ChangeLog +12 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2011-11-15  Scott Graham  <scottmg@google.com>
2
3
        IDL changes for gamepad support
4
        https://bugs.webkit.org/show_bug.cgi?id=71753
5
6
        Runtime enable gamepads in Chromium.
7
8
        Reviewed by NOBODY (OOPS!).
9
10
        * DumpRenderTree/chromium/TestShell.cpp:
11
        (TestShell::TestShell):
12
1
2011-11-15  David Kilzer  <ddkilzer@apple.com>
13
2011-11-15  David Kilzer  <ddkilzer@apple.com>
2
14
3
        Don't use File::Slurp for run-leaks unit tests
15
        Don't use File::Slurp for run-leaks unit tests
- a/Tools/DumpRenderTree/chromium/TestShell.cpp +1 lines
Lines 122-127 TestShell::TestShell(bool testShellMode) a/Tools/DumpRenderTree/chromium/TestShell.cpp_sec1
122
    WebRuntimeFeatures::enableMediaStream(true);
122
    WebRuntimeFeatures::enableMediaStream(true);
123
    WebRuntimeFeatures::enableWebAudio(true); 
123
    WebRuntimeFeatures::enableWebAudio(true); 
124
    WebRuntimeFeatures::enableVideoTrack(true);
124
    WebRuntimeFeatures::enableVideoTrack(true);
125
    WebRuntimeFeatures::enableGamepad(true);
125
126
126
    m_webPermissions = adoptPtr(new WebPermissions(this));
127
    m_webPermissions = adoptPtr(new WebPermissions(this));
127
    m_accessibilityController = adoptPtr(new AccessibilityController(this));
128
    m_accessibilityController = adoptPtr(new AccessibilityController(this));
- a/LayoutTests/ChangeLog +24 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-11-15  Scott Graham  <scottmg@chromium.org>
2
3
        IDL changes for gamepad support
4
        https://bugs.webkit.org/show_bug.cgi?id=71753
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * gamepad/gamepad-api-expected.txt: Added.
9
        * gamepad/gamepad-api.html: Added.
10
        * gamepad/gamepad-test.js: Added.
11
        (logConsole):
12
        (testExpected):
13
        (reportExpected):
14
        (waitForEventAndEnd):
15
        (waitForEvent._eventCallback):
16
        (waitForEvent):
17
        (waitForEventAndTest._eventCallback):
18
        (waitForEventAndTest):
19
        (waitForEventTestAndEnd):
20
        (endTest):
21
        (logResult):
22
        (consoleWrite):
23
        * platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt:
24
1
2011-11-15  Sheriff Bot  <webkit.review.bot@gmail.com>
25
2011-11-15  Sheriff Bot  <webkit.review.bot@gmail.com>
2
26
3
        Unreviewed, rolling out r100291.
27
        Unreviewed, rolling out r100291.
- a/LayoutTests/gamepad/gamepad-api-expected.txt +3 lines
Line 0 a/LayoutTests/gamepad/gamepad-api-expected.txt_sec1
1
EXPECTED (navigator.gamepads !== 'undefined') OK
2
END OF TEST
3
Make sure the main polling access point exists on navigator.
- a/LayoutTests/gamepad/gamepad-api.html +9 lines
Line 0 a/LayoutTests/gamepad/gamepad-api.html_sec1
1
<!DOCTYPE html>
2
<body>
3
<script src="gamepad-test.js"></script>
4
<script>
5
    testExpected("navigator.gamepads", undefined, "!==");
6
    endTest();
7
</script>
8
<p>Make sure the main polling access point exists on navigator.</p>
9
</body>
- a/LayoutTests/gamepad/gamepad-test.js +126 lines
Line 0 a/LayoutTests/gamepad/gamepad-test.js_sec1
1
var console = null;
2
var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting())
3
4
logConsole();
5
6
if (window.layoutTestController) {
7
    layoutTestController.dumpAsText();
8
    layoutTestController.waitUntilDone();
9
}
10
11
function logConsole()
12
{
13
    if (!console && document.body) {
14
        console = document.createElement('div');
15
        document.body.appendChild(console);
16
    }
17
    return console;
18
}
19
20
function testExpected(testFuncString, expected, comparison)
21
{
22
    try {
23
        var observed = eval(testFuncString);
24
    } catch (ex) {
25
        consoleWrite(ex);
26
        return;
27
    }
28
    
29
    if (comparison === undefined)
30
        comparison = '==';
31
32
    var success = false;
33
    switch (comparison)
34
    {
35
        case '<':  success = observed <  expected; break;
36
        case '<=': success = observed <= expected; break;
37
        case '>':  success = observed >  expected; break;
38
        case '>=': success = observed >= expected; break;
39
        case '!=': success = observed != expected; break;
40
        case '!==': success = observed !== expected; break;
41
        case '==': success = observed == expected; break;
42
        case '===': success = observed === expected; break;
43
    }
44
    
45
    reportExpected(success, testFuncString, comparison, expected, observed)
46
}
47
48
var testNumber = 0;
49
50
function reportExpected(success, testFuncString, comparison, expected, observed)
51
{
52
    testNumber++;
53
54
    var msg = "Test " + testNumber;
55
56
    if (printFullTestDetails || !success)
57
        msg = "EXPECTED (<em>" + testFuncString + " </em>" + comparison + " '<em>" + expected + "</em>')";
58
59
    if (!success)
60
        msg +=  ", OBSERVED '<em>" + observed + "</em>'";
61
62
    logResult(success, msg);
63
}
64
65
function waitForEventAndEnd(element, eventName, funcString)
66
{
67
    waitForEvent(element, eventName, funcString, true)
68
}
69
70
function waitForEvent(element, eventName, func, endit)
71
{
72
    function _eventCallback(event)
73
    {
74
        consoleWrite("EVENT(" + eventName + ")");
75
76
        if (func)
77
            func(event);
78
        
79
        if (endit)
80
            endTest();    
81
    }
82
83
    element.addEventListener(eventName, _eventCallback);
84
}
85
86
function waitForEventAndTest(element, eventName, testFuncString, endit)
87
{
88
    function _eventCallback(event)
89
    {
90
        logResult(eval(testFuncString), "EVENT(" + eventName + ") TEST(" + testFuncString + ")");
91
        if (endit)
92
            endTest();    
93
    }
94
95
    element.addEventListener(eventName, _eventCallback);
96
}
97
98
function waitForEventTestAndEnd(element, eventName, testFuncString)
99
{
100
    waitForEventAndTest(element, eventName, testFuncString, true);
101
}
102
  
103
var testEnded = false;
104
105
function endTest()
106
{
107
    consoleWrite("END OF TEST");
108
    testEnded = true;
109
    if (window.layoutTestController)
110
        layoutTestController.notifyDone();     
111
}
112
113
function logResult(success, text)
114
{
115
    if (success)
116
        consoleWrite(text + " <span style='color:green'>OK</span>");
117
    else
118
        consoleWrite(text + " <span style='color:red'>FAIL</span>");
119
}
120
121
function consoleWrite(text)
122
{
123
    if (testEnded)
124
        return;
125
    logConsole().innerHTML += text + "<br>";
126
}
- a/LayoutTests/platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt +2 lines
Lines 4-9 navigator.appCodeName is OK a/LayoutTests/platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt_sec1
4
navigator.appName is OK
4
navigator.appName is OK
5
navigator.appVersion is OK
5
navigator.appVersion is OK
6
navigator.cookieEnabled is OK
6
navigator.cookieEnabled is OK
7
navigator.gamepads is OK
7
navigator.getStorageUpdates() is OK
8
navigator.getStorageUpdates() is OK
8
navigator.javaEnabled() is OK
9
navigator.javaEnabled() is OK
9
navigator.language is OK
10
navigator.language is OK
Lines 21-26 navigator.appCodeName is OK a/LayoutTests/platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt_sec2
21
navigator.appName is OK
22
navigator.appName is OK
22
navigator.appVersion is OK
23
navigator.appVersion is OK
23
navigator.cookieEnabled is OK
24
navigator.cookieEnabled is OK
25
navigator.gamepads is OK
24
navigator.getStorageUpdates() is OK
26
navigator.getStorageUpdates() is OK
25
navigator.javaEnabled() is OK
27
navigator.javaEnabled() is OK
26
navigator.language is OK
28
navigator.language is OK

Return to Bug 71753