Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1400)

Unified Diff: third_party/WebKit/LayoutTests/ambient-light/multiple-event-listeners.html

Issue 2845763002: Remove DeviceLightEvent implementation (Closed)
Patch Set: same as previous patch Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/ambient-light/multiple-event-listeners.html
diff --git a/third_party/WebKit/LayoutTests/ambient-light/multiple-event-listeners.html b/third_party/WebKit/LayoutTests/ambient-light/multiple-event-listeners.html
deleted file mode 100644
index 71c24aee677da22cdf49c3628a826543ec56fbda..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/ambient-light/multiple-event-listeners.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<script src="../resources/js-test.js"></script>
-<script>
-
-description('Tests using multiple event handlers for the Device Light API.');
-
-var mockEvent;
-var expectedEvent;
-function setMockLight(value) {
-
- mockEvent = {value: value};
-
- if (window.testRunner)
- testRunner.setMockDeviceLight(mockEvent.value);
- else
- debug('This test can not be run without the TestRunner');
-}
-
-var deviceLightEvent;
-function checkLight(event) {
- deviceLightEvent = event;
- shouldBe('deviceLightEvent.value', 'expectedEvent.value');
-}
-
-var firstListenerCount = 0;
-function firstListener(event) {
- checkLight(event);
- firstListenerCount++;
- proceedIfNecessary();
-}
-
-var secondListenerCount = 0;
-function secondListener(event) {
- checkLight(event);
- secondListenerCount++;
- proceedIfNecessary();
-}
-
-function proceedIfNecessary() {
- if (firstListenerCount == 1 && secondListenerCount == 1) {
- setMockLight(20);
- // Note: this should not stop Device Light updates,
- // because there is still one listener active.
- window.removeEventListener('devicelight', secondListener);
- initThirdListener();
- }
-}
-
-var childFrame;
-function initThirdListener() {
- childFrame = document.createElement('iframe');
- document.body.appendChild(childFrame);
- childFrame.contentWindow.addEventListener('devicelight', thirdListener);
-}
-
-function thirdListener(event) {
- // Expect the cached event because Device Light was already active
- // when third listener was added.
- checkLight(event);
- window.removeEventListener('devicelight', firstListener);
- childFrame.contentWindow.removeEventListener('devicelight', thirdListener);
- initFourthListener();
-}
-
-function initFourthListener() {
- expectedEvent = mockEvent;
- window.addEventListener('devicelight', fourthListener);
-}
-
-function fourthListener(event) {
- checkLight(event);
- finishJSTest();
-}
-
-setMockLight(10);
-expectedEvent = mockEvent;
-window.addEventListener('devicelight', firstListener);
-window.addEventListener('devicelight', secondListener);
-
-window.jsTestIsAsync = true;
-
-</script>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698