.: Support for Battery Status API.

https://bugs.webkit.org/show_bug.cgi?id=62698

Enable BATTERY_STATUS for WebKit-Efl.
http://www.w3.org/TR/battery-status/

Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
Reviewed by Adam Barth.

* Source/cmake/OptionsEfl.cmake:
* Source/cmakeconfig.h.cmake:

Source/WebCore: Support for Battery Status API
https://bugs.webkit.org/show_bug.cgi?id=62698

Battery Status API is implemented under the Navigator class.
Battery Status API has four types of events, and all events are operated based on a callback mechanism.
 : onchargingchange, onchargingtimechange, ondischargingtimechange, onlevelchange.
The battery status can be accessed using BatteryManager(navigator.webkitBattery), and battery status is controlled by BatteryController which manages instances of BatteryManager.
When battery status event is raised, BatteryController calls all registered BatteryManager's event dispatcher.
http://www.w3.org/TR/battery-status/

Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
Reviewed by Adam Barth.

Tests: batterystatus/add-listener-from-callback.html
       batterystatus/basic-all-types-of-events.html
       batterystatus/basic-operation.html
       batterystatus/event-after-navigation.html
       batterystatus/multiple-frames.html
       batterystatus/updates.html
       batterystatus/window-property.html

* CMakeLists.txt:
* Modules/battery/BatteryClient.h: Added.
(WebCore):
(BatteryClient):
(WebCore::BatteryClient::~BatteryClient):
* Modules/battery/BatteryController.cpp: Added.
(WebCore):
(WebCore::BatteryController::BatteryController):
(WebCore::BatteryController::~BatteryController):
(WebCore::BatteryController::create):
(WebCore::BatteryController::addListener):
(WebCore::BatteryController::removeListener):
(WebCore::BatteryController::didChangeBatteryStatus):
(WebCore::BatteryController::supplementName):
(WebCore::BatteryController::isActive):
(WebCore::provideBatteryTo):
* Modules/battery/BatteryController.h: Added.
(WebCore):
(BatteryController):
(WebCore::BatteryController::client):
(WebCore::BatteryController::from):
* Modules/battery/BatteryManager.cpp: Added.
(WebCore):
(WebCore::BatteryManager::create):
(WebCore::BatteryManager::~BatteryManager):
(WebCore::BatteryManager::BatteryManager):
(WebCore::BatteryManager::charging):
(WebCore::BatteryManager::chargingTime):
(WebCore::BatteryManager::dischargingTime):
(WebCore::BatteryManager::level):
(WebCore::BatteryManager::didChangeBatteryStatus):
(WebCore::BatteryManager::suspend):
(WebCore::BatteryManager::resume):
(WebCore::BatteryManager::stop):
* Modules/battery/BatteryManager.h: Added.
(WebCore):
(BatteryManager):
(WebCore::BatteryManager::interfaceName):
(WebCore::BatteryManager::scriptExecutionContext):
(WebCore::BatteryManager::batteryControllerDestroyed):
(WebCore::BatteryManager::canSuspend):
(WebCore::BatteryManager::eventTargetData):
(WebCore::BatteryManager::ensureEventTargetData):
(WebCore::BatteryManager::refEventTarget):
(WebCore::BatteryManager::derefEventTarget):
* Modules/battery/BatteryManager.idl: Added.
* Modules/battery/BatteryStatus.cpp: Added.
(WebCore):
(WebCore::BatteryStatus::create):
(WebCore::BatteryStatus::BatteryStatus):
* Modules/battery/BatteryStatus.h: Added.
(WebCore):
(BatteryStatus):
(WebCore::BatteryStatus::charging):
(WebCore::BatteryStatus::chargingTime):
(WebCore::BatteryStatus::dischargingTime):
(WebCore::BatteryStatus::level):
* Modules/battery/NavigatorBattery.cpp: Added.
(WebCore):
(WebCore::NavigatorBattery::NavigatorBattery):
(WebCore::NavigatorBattery::~NavigatorBattery):
(WebCore::NavigatorBattery::webkitBattery):
(WebCore::NavigatorBattery::from):
(WebCore::NavigatorBattery::batteryManager):
* Modules/battery/NavigatorBattery.h: Added.
(WebCore):
(NavigatorBattery):
* Modules/battery/NavigatorBattery.idl: Added.
* dom/EventNames.h:
(WebCore):
* dom/EventTargetFactory.in:
* testing/Internals.cpp:
(WebCore::Internals::setBatteryStatus):
(WebCore):
* testing/Internals.h:
(Internals):
* testing/Internals.idl:

Source/WebKit: Support for Battery Status API
https://bugs.webkit.org/show_bug.cgi?id=62698

Add include directory and file.
http://www.w3.org/TR/battery-status/

Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
Reviewed by Adam Barth.

* PlatformEfl.cmake:

Source/WebKit/efl: Support for Battery Status API
https://bugs.webkit.org/show_bug.cgi?id=62698

Add BatteryClientEfl class implementation for the layout tests now.
BatteryClientEfl class is not fully implemented in this patch.
(It will be completed by other patch as necessary in the Efl port.)
http://www.w3.org/TR/battery-status/

Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
Reviewed by Adam Barth.

* WebCoreSupport/BatteryClientEfl.cpp: Added.
(WebCore):
(WebCore::BatteryClientEfl::BatteryClientEfl):
(WebCore::BatteryClientEfl::setController):
(WebCore::BatteryClientEfl::startUpdating):
(WebCore::BatteryClientEfl::stopUpdating):
(WebCore::BatteryClientEfl::batteryControllerDestroyed):
(WebCore::BatteryClientEfl::setBatteryStatus):
* WebCoreSupport/BatteryClientEfl.h: Added.
(WebCore):
(BatteryClientEfl):
(WebCore::BatteryClientEfl::~BatteryClientEfl):
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(_ewk_view_priv_new):

Tools: Support for Battery Status API
https://bugs.webkit.org/show_bug.cgi?id=62698

Add include directory and file.
http://www.w3.org/TR/battery-status/

Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
Reviewed by Adam Barth.

* Scripts/build-webkit:

LayoutTests: Support for Battery Status API.
https://bugs.webkit.org/show_bug.cgi?id=62698

Add new test cases for Battery Status API.
http://www.w3.org/TR/battery-status/

Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
Reviewed by Adam Barth.

* batterystatus/add-listener-from-callback-expected.txt: Added.
* batterystatus/add-listener-from-callback.html: Added.
* batterystatus/basic-all-types-of-events-expected.txt: Added.
* batterystatus/basic-all-types-of-events.html: Added.
* batterystatus/basic-operation-expected.txt: Added.
* batterystatus/basic-operation.html: Added.
* batterystatus/event-after-navigation-expected.txt: Added.
* batterystatus/event-after-navigation.html: Added.
* batterystatus/multiple-frames-expected.txt: Added.
* batterystatus/multiple-frames.html: Added.
* batterystatus/resources/event-after-navigation-new.html: Added.
* batterystatus/script-tests/add-listener-from-callback.js: Added.
(checkBatteryStatus):
(firstListener):
(secondListener):
(maybeFinishTest):
* batterystatus/script-tests/basic-all-types-of-events.js: Added.
(checkBatteryStatus):
(battery):
* batterystatus/script-tests/basic-operation.js: Added.
* batterystatus/script-tests/event-after-navigation.js: Added.
* batterystatus/script-tests/multiple-frames.js: Added.
(checkBatteryStatus):
(checkChildBatteryStatus):
(mainFrameListener):
(childFrameListener):
(maybeFinishTest):
* batterystatus/script-tests/updates.js: Added.
(checkBatteryStatus):
(setBatteryStatus):
(firstListener):
(updateListener):
* batterystatus/script-tests/window-property.js: Added.
(hasOnBatteryProperty):
* batterystatus/updates-expected.txt: Added.
* batterystatus/updates.html: Added.
* batterystatus/window-property-expected.txt: Added.
* batterystatus/window-property.html: Added.
* platform/chromium/test_expectations.txt:
* platform/gtk/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
* platform/wincairo/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@110991 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 44e3c6be
2012-03-16 Kihong Kwon <kihong.kwon@samsung.com>
Support for Battery Status API.
https://bugs.webkit.org/show_bug.cgi?id=62698
Enable BATTERY_STATUS for WebKit-Efl.
http://www.w3.org/TR/battery-status/
Reviewed by Adam Barth.
* Source/cmake/OptionsEfl.cmake:
* Source/cmakeconfig.h.cmake:
2012-03-15 Patrick Gansterer <paroga@webkit.org>
[EFL] Make zlib a general build requirement
......
2012-03-16 Kihong Kwon <kihong.kwon@samsung.com>
Support for Battery Status API.
https://bugs.webkit.org/show_bug.cgi?id=62698
Add new test cases for Battery Status API.
http://www.w3.org/TR/battery-status/
Reviewed by Adam Barth.
* batterystatus/add-listener-from-callback-expected.txt: Added.
* batterystatus/add-listener-from-callback.html: Added.
* batterystatus/basic-all-types-of-events-expected.txt: Added.
* batterystatus/basic-all-types-of-events.html: Added.
* batterystatus/basic-operation-expected.txt: Added.
* batterystatus/basic-operation.html: Added.
* batterystatus/event-after-navigation-expected.txt: Added.
* batterystatus/event-after-navigation.html: Added.
* batterystatus/multiple-frames-expected.txt: Added.
* batterystatus/multiple-frames.html: Added.
* batterystatus/resources/event-after-navigation-new.html: Added.
* batterystatus/script-tests/add-listener-from-callback.js: Added.
(checkBatteryStatus):
(firstListener):
(secondListener):
(maybeFinishTest):
* batterystatus/script-tests/basic-all-types-of-events.js: Added.
(checkBatteryStatus):
(battery):
* batterystatus/script-tests/basic-operation.js: Added.
* batterystatus/script-tests/event-after-navigation.js: Added.
* batterystatus/script-tests/multiple-frames.js: Added.
(checkBatteryStatus):
(checkChildBatteryStatus):
(mainFrameListener):
(childFrameListener):
(maybeFinishTest):
* batterystatus/script-tests/updates.js: Added.
(checkBatteryStatus):
(setBatteryStatus):
(firstListener):
(updateListener):
* batterystatus/script-tests/window-property.js: Added.
(hasOnBatteryProperty):
* batterystatus/updates-expected.txt: Added.
* batterystatus/updates.html: Added.
* batterystatus/window-property-expected.txt: Added.
* batterystatus/window-property.html: Added.
* platform/chromium/test_expectations.txt:
* platform/gtk/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
* platform/wincairo/Skipped:
2012-03-16 Hajime Morrita <morrita@chromium.org>
Unreviewed gardening, marking a failing test.
Tests that adding a new event listener from a callback works as expected.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/add-listener-from-callback.js"></script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Tests the basic operation of all BatteryStatus events.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
chargingchange event is raised
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
chargingtimechange event is raised
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
dischargingtimechange event is raised
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
levelchange event is raised
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/basic-all-types-of-events.js"></script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Tests the basic operation of BatteryStatus.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/basic-operation.js"></script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Tests for a crash where an event is fired after the page has been navigated away when the original page is in the page cache.
SUCCESS
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/event-after-navigation.js"></script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Tests using BatteryStatus from multiple frames.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/multiple-frames.js"></script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
<html>
<head>
</head>
<body>
Tests for a crash where an event is fired after the page has been navigated
away when the original page is in the page cache.<br><br>
SUCCESS
<script>
internals.setBatteryStatus(document, 'chargingchange', true, 3000, Number.POSITIVE_INFINITY, 0.5);
layoutTestController.notifyDone();
</script>
</body>
</html>
\ No newline at end of file
description('Tests that adding a new event listener from a callback works as expected.');
var charging = false;
var chargingTime = Number.POSITIVE_INFINITY;
var dischargingTime = 6000;
var level = 0.7;
var battery = navigator.webkitBattery;
function checkBatteryStatus() {
shouldBe('battery.charging', 'charging');
shouldBe('battery.chargingTime', 'chargingTime');
shouldBe('battery.dischargingTime', 'dischargingTime');
shouldBe('battery.level', 'level');
}
var firstListenerEvents = 0;
function firstListener() {
checkBatteryStatus();
if (++firstListenerEvents == 1) {
battery.addEventListener('chargingchange', secondListener);
internals.setBatteryStatus(document, 'chargingchange', charging, chargingTime, dischargingTime, level);
}
else if (firstListenerEvents > 2)
testFailed('Too many events for first listener.');
maybeFinishTest();
}
var secondListenerEvents = 0;
function secondListener() {
checkBatteryStatus();
if (++secondListenerEvents > 1)
testFailed('Too many events for second listener.');
maybeFinishTest();
}
function maybeFinishTest() {
if (firstListenerEvents == 2 && secondListenerEvents == 1)
finishJSTest();
}
battery.addEventListener('chargingchange', firstListener);
internals.setBatteryStatus(document, 'chargingchange', charging, chargingTime, dischargingTime, level);
window.jsTestIsAsync = true;
description('Tests the basic operation of all BatteryStatus events.');
var charging = false;
var chargingTime = Number.POSITIVE_INFINITY;
var dischargingTime = 6000;
var level = 0.7;
var battery = navigator.webkitBattery;
function checkBatteryStatus() {
shouldBe('battery.charging', 'charging');
shouldBe('battery.chargingTime', 'chargingTime');
shouldBe('battery.dischargingTime', 'dischargingTime');
shouldBe('battery.level', 'level');
}
battery.addEventListener('chargingchange', function() {
debug('chargingchange event is raised');
checkBatteryStatus();
});
battery.addEventListener('chargingtimechange', function() {
debug('chargingtimechange event is raised');
checkBatteryStatus();
});
battery.addEventListener('dischargingtimechange', function() {
debug('dischargingtimechange event is raised');
checkBatteryStatus();
});
battery.addEventListener('levelchange', function() {
debug('levelchange event is raised');
checkBatteryStatus();
finishJSTest();
});
internals.setBatteryStatus(document, 'chargingchange', charging, chargingTime, dischargingTime, level);
internals.setBatteryStatus(document, 'chargingtimechange', charging, chargingTime, dischargingTime, level);
internals.setBatteryStatus(document, 'dischargingtimechange', charging, chargingTime, dischargingTime, level);
internals.setBatteryStatus(document, 'levelchange', charging, chargingTime, dischargingTime, level);
window.jsTestIsAsync = true;
description('Tests the basic operation of BatteryStatus.');
var charging = false;
var chargingTime = Number.POSITIVE_INFINITY;
var dischargingTime = 6000;
var level = 0.7;
var battery = navigator.webkitBattery;
battery.addEventListener('chargingchange', function() {
shouldBe('battery.charging', 'charging');
shouldBe('battery.chargingTime', 'chargingTime');
shouldBe('battery.dischargingTime', 'dischargingTime');
shouldBe('battery.level', 'level');
finishJSTest();
});
internals.setBatteryStatus(document, 'chargingchange', charging, chargingTime, dischargingTime, level);
window.jsTestIsAsync = true;
description('Tests for a crash where an event is fired after the page has been navigated away when the original page is in the page cache.');
if (window.layoutTestController)
layoutTestController.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
else
debug('This test can not be run without the LayoutTestController');
document.body.onload = function() {
navigator.webkitBattery.addEventListener('chargingchange', function() { } );
window.location = "resources/event-after-navigation-new.html";
}
window.jsTestIsAsync = true;
description('Tests using BatteryStatus from multiple frames.');
var charging = false;
var chargingTime = Number.POSITIVE_INFINITY;
var dischargingTime = 6000;
var level = 0.7;
var battery = navigator.webkitBattery;
function checkBatteryStatus() {
shouldBe('battery.charging', 'charging');
shouldBe('battery.chargingTime', 'chargingTime');
shouldBe('battery.dischargingTime', 'dischargingTime');
shouldBe('battery.level', 'level');
}
function checkChildBatteryStatus() {
shouldBe('battery.charging', 'charging');
shouldBe('battery.chargingTime', 'chargingTime');
shouldBe('battery.dischargingTime', 'dischargingTime');
shouldBe('battery.level', 'level');
}
var hasMainFrameEventFired = false;
function mainFrameListener() {
hasMainFrameEventFired = true;
maybeFinishTest();
}
var hasChildFrameEventFired = false;
function childFrameListener() {
hasChildFrameEventFired = true;
maybeFinishTest();
}
function maybeFinishTest() {
if (hasMainFrameEventFired && hasChildFrameEventFired) {
checkBatteryStatus();
checkChildBatteryStatus();
finishJSTest();
}
}
var childFrame = document.createElement('iframe');
document.body.appendChild(childFrame);
var childBattery = childFrame.contentWindow.navigator.webkitBattery
childBattery.addEventListener('chargingchange', childFrameListener);
battery.addEventListener('chargingchange', mainFrameListener);
internals.setBatteryStatus(document, 'chargingchange', charging, chargingTime, dischargingTime, level);
window.jsTestIsAsync = true;
description('Tests that updates to the battery event causes new events to fire.');
var charging = false;
var chargingTime = Number.POSITIVE_INFINITY;
var dischargingTime = 6000;
var level = 0.7;
var battery = navigator.webkitBattery;
function checkBatteryStatus() {
shouldBe('battery.charging', 'charging');
shouldBe('battery.chargingTime', 'chargingTime');
shouldBe('battery.dischargingTime', 'dischargingTime');
shouldBe('battery.level', 'level');
}
function setBatteryStatus() {
internals.setBatteryStatus(document, 'chargingchange', charging, chargingTime, dischargingTime, level);
}
function firstListener() {
checkBatteryStatus();
battery.removeEventListener('chargingchange', firstListener);
battery.addEventListener('chargingchange', updateListener);
charging = true;
chargingTime = 7000;
dischargingTime = Number.POSITIVE_INFINITY;
level = 0.3;
setBatteryStatus();
}
function updateListener(event) {
checkBatteryStatus(event);
finishJSTest();
}
battery.addEventListener('chargingchange', firstListener);
setBatteryStatus();
window.jsTestIsAsync = true;
description('Tests that the window.navigator.battery properties are present.');
function hasOnBatteryProperty()
{
var result = 0;
for (var property in navigator.webkitBattery) {
if (property == 'onchargingchange' ||
property == 'onchargingtimechange' ||
property == 'ondischargingtimechange' ||
property == 'onlevelchange')
result += 1;
}
if (result == 4)
return true;
return false;
}
shouldBeTrue("typeof navigator.webkitBattery == 'object'");
shouldBeTrue("hasOnBatteryProperty()");
shouldBeTrue("navigator.webkitBattery.hasOwnProperty('onchargingchange')");
shouldBeTrue("navigator.webkitBattery.hasOwnProperty('onchargingtimechange')");
shouldBeTrue("navigator.webkitBattery.hasOwnProperty('ondischargingtimechange')");
shouldBeTrue("navigator.webkitBattery.hasOwnProperty('onlevelchange')");
Tests that updates to the battery event causes new events to fire.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS battery.charging is charging
PASS battery.chargingTime is chargingTime
PASS battery.dischargingTime is dischargingTime
PASS battery.level is level
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/updates.js"></script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Tests that the window.navigator.battery properties are present.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS typeof navigator.webkitBattery == 'object' is true
PASS hasOnBatteryProperty() is true
PASS navigator.webkitBattery.hasOwnProperty('onchargingchange') is true
PASS navigator.webkitBattery.hasOwnProperty('onchargingtimechange') is true
PASS navigator.webkitBattery.hasOwnProperty('ondischargingtimechange') is true
PASS navigator.webkitBattery.hasOwnProperty('onlevelchange') is true
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/window-property.js"></script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
......@@ -113,6 +113,9 @@ BUGCR103939 SKIP : http/tests/appcache/wrong-content-type.html = TEXT
// Vibration API is not supported yet in the chromium port.
BUGWK72010 SKIP : fast/dom/navigator-vibration.html = FAIL
// Battery Status API is not supported yet in the chromium port.
BUGWK62698 SKIP : batterystatus = PASS FAIL
// -----------------------------------------------------------------
// WONTFIX TESTS
// -----------------------------------------------------------------
......
......@@ -402,6 +402,9 @@ webintents/
# Pointer Lock is not implemented.
pointer-lock/
#Battery Status API support not yet. http://webkit.org/b/62698
batterystatus
###############################################################################
# TESTS FAILING
###############################################################################
......
......@@ -583,3 +583,7 @@ svg/custom/delete-text-crash.html
canvas/philip/tests/2d.line.cap.round.html
canvas/philip/tests/2d.shadow.canvas.transparent.2.html
canvas/philip/tests/2d.shadow.image.transparent.2.html
# https://bugs.webkit.org/show_bug.cgi?id=62698
# Needs BatteryClient implementation.
batterystatus/
......@@ -362,6 +362,9 @@ fast/dom/Window/window-postmessage-arrays.html
#Vibration API is not implemented.
fast/dom/navigator-vibration.html
#Battery Status API is not implemented.
batterystatus
# =========================================================================== #
# Drag and Drop Support in DRT. #
# =========================================================================== #
......
......@@ -1661,6 +1661,9 @@ fast/repaint/transform-absolute-in-positioned-container.html
#Vibration API is not implemented.
fast/dom/navigator-vibration.html
#Battery Status API is not implemented.
batterystatus
# Those tests need a text baseline after lazily allocating layers.
# The change should only be layer removal.
animations/combo-transform-translate+scale.html
......
......@@ -2058,3 +2058,6 @@ fast/mutation/end-of-task-delivery.html
#Vibration API is not implemented.
fast/dom/navigator-vibration.html
#Battery Status API is not implemented.
batterystatus
......@@ -2334,6 +2334,22 @@ SET(WebCoreTestSupport_SOURCES
testing/InternalSettings.cpp
)
IF (ENABLE_BATTERY_STATUS)
LIST(APPEND WebCore_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/Modules/battery"
)
LIST(APPEND WebCore_IDL_FILES
Modules/battery/NavigatorBattery.idl
Modules/battery/BatteryManager.idl
)
LIST(APPEND WebCore_SOURCES
Modules/battery/NavigatorBattery.cpp
Modules/battery/BatteryController.cpp
Modules/battery/BatteryManager.cpp
Modules/battery/BatteryStatus.cpp
)
ENDIF ()
# Modules that the bindings generator scripts may use
SET(SCRIPTS_RESOLVE_SUPPLEMENTAL
${WEBCORE_DIR}/bindings/scripts/IDLParser.pm
......
2012-03-16 Kihong Kwon <kihong.kwon@samsung.com>
Support for Battery Status API
https://bugs.webkit.org/show_bug.cgi?id=62698
Battery Status API is implemented under the Navigator class.
Battery Status API has four types of events, and all events are operated based on a callback mechanism.
: onchargingchange, onchargingtimechange, ondischargingtimechange, onlevelchange.
The battery status can be accessed using BatteryManager(navigator.webkitBattery), and battery status is controlled by BatteryController which manages instances of BatteryManager.
When battery status event is raised, BatteryController calls all registered BatteryManager's event dispatcher.
http://www.w3.org/TR/battery-status/
Reviewed by Adam Barth.
Tests: batterystatus/add-listener-from-callback.html
batterystatus/basic-all-types-of-events.html
batterystatus/basic-operation.html
batterystatus/event-after-navigation.html
batterystatus/multiple-frames.html
batterystatus/updates.html
batterystatus/window-property.html
* CMakeLists.txt:
* Modules/battery/BatteryClient.h: Added.
(WebCore):
(BatteryClient):
(WebCore::BatteryClient::~BatteryClient):
* Modules/battery/BatteryController.cpp: Added.
(WebCore):
(WebCore::BatteryController::BatteryController):
(WebCore::BatteryController::~BatteryController):
(WebCore::BatteryController::create):
(WebCore::BatteryController::addListener):
(WebCore::BatteryController::removeListener):
(WebCore::BatteryController::didChangeBatteryStatus):
(WebCore::BatteryController::supplementName):