Add an ASSERT to didChangeDeviceProximity

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

Reviewed by Hajime Morrita.

Source/WebCore:

Add An ASSERT to didChangeDeviceProximity function to check range of value.

Change exist test cases.

* Modules/proximity/DeviceProximityController.cpp:
(WebCore::DeviceProximityController::didChangeDeviceProximity):

LayoutTests:

Fix wrong test cases which are found by ASSERT insertion.

* proximity/basic-operation-expected.txt:
* proximity/basic-operation.html:
* proximity/resources/event-after-navigation-new.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5ca5d104
2013-02-24 Kihong Kwon <kihong.kwon@samsung.com>
Add an ASSERT to didChangeDeviceProximity
https://bugs.webkit.org/show_bug.cgi?id=110317
Reviewed by Hajime Morrita.
Fix wrong test cases which are found by ASSERT insertion.
* proximity/basic-operation-expected.txt:
* proximity/basic-operation.html:
* proximity/resources/event-after-navigation-new.html:
2013-02-24 Mike West <mkwst@chromium.org> 2013-02-24 Mike West <mkwst@chromium.org>
CSP 1.1: Experiment with 'reflected-xss' directive. CSP 1.1: Experiment with 'reflected-xss' directive.
...@@ -4,8 +4,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -4,8 +4,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS deviceProximityEvent.value is firedEvent.value PASS deviceProximityEvent.value is firedEvent.value
PASS deviceProximityEvent.min is firedEvent.max PASS deviceProximityEvent.min is firedEvent.min
PASS deviceProximityEvent.max is firedEvent.min PASS deviceProximityEvent.max is firedEvent.max
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -12,12 +12,12 @@ var deviceProximityEvent; ...@@ -12,12 +12,12 @@ var deviceProximityEvent;
window.addEventListener('webkitdeviceproximity', function(e) { window.addEventListener('webkitdeviceproximity', function(e) {
deviceProximityEvent = e; deviceProximityEvent = e;
shouldBe('deviceProximityEvent.value', 'firedEvent.value'); shouldBe('deviceProximityEvent.value', 'firedEvent.value');
shouldBe('deviceProximityEvent.min', 'firedEvent.max'); shouldBe('deviceProximityEvent.min', 'firedEvent.min');
shouldBe('deviceProximityEvent.max', 'firedEvent.min'); shouldBe('deviceProximityEvent.max', 'firedEvent.max');
finishJSTest(); finishJSTest();
}); });
internals.setDeviceProximity(document, 'webkitdeviceproximity', firedEvent.value, firedEvent.max, firedEvent.min); internals.setDeviceProximity(document, 'webkitdeviceproximity', firedEvent.value, firedEvent.min, firedEvent.max);
window.jsTestIsAsync = true; window.jsTestIsAsync = true;
</script> </script>
<script src="../fast/js/resources/js-test-post.js"></script> <script src="../fast/js/resources/js-test-post.js"></script>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
SUCCESS SUCCESS
<script> <script>
if (window.testRunner) { if (window.testRunner) {
internals.setDeviceProximity(document, 'webkitdeviceproximity', 1.1, 2.2, 3.3); internals.setDeviceProximity(document, 'webkitdeviceproximity', 2.2, 1.1, 3.3);
testRunner.notifyDone(); testRunner.notifyDone();
} }
</script> </script>
......
2013-02-24 Kihong Kwon <kihong.kwon@samsung.com>
Add an ASSERT to didChangeDeviceProximity
https://bugs.webkit.org/show_bug.cgi?id=110317
Reviewed by Hajime Morrita.
Add An ASSERT to didChangeDeviceProximity function to check range of value.
Change exist test cases.
* Modules/proximity/DeviceProximityController.cpp:
(WebCore::DeviceProximityController::didChangeDeviceProximity):
2013-02-24 Alexey Proskuryakov <ap@apple.com> 2013-02-24 Alexey Proskuryakov <ap@apple.com>
Clarify meaning of default default encoding localizable string Clarify meaning of default default encoding localizable string
...@@ -47,6 +47,8 @@ PassOwnPtr<DeviceProximityController> DeviceProximityController::create(DevicePr ...@@ -47,6 +47,8 @@ PassOwnPtr<DeviceProximityController> DeviceProximityController::create(DevicePr
void DeviceProximityController::didChangeDeviceProximity(const double value, const double min, const double max) void DeviceProximityController::didChangeDeviceProximity(const double value, const double min, const double max)
{ {
ASSERT(value >= min && value <= max);
dispatchDeviceEvent(DeviceProximityEvent::create(eventNames().webkitdeviceproximityEvent, value, min, max)); dispatchDeviceEvent(DeviceProximityEvent::create(eventNames().webkitdeviceproximityEvent, value, min, max));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment