-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from w3c/master
Catch up to W3C master
- Loading branch information
Showing
83 changed files
with
5,575 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Battery Test: iframe has a different Navigator object</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
iframe { | ||
display: none; | ||
} | ||
</style> | ||
<div id="log"></div> | ||
<iframe id="blank" src="about:blank"></iframe> | ||
<iframe id="frame" src="support-iframe-initial.html"></iframe> | ||
<script> | ||
promise_test(function(t) { | ||
var iframe = document.querySelector('#blank'); | ||
var originalPromise = navigator.getBattery(); | ||
|
||
return originalPromise.then(function(originalManager) { | ||
var promise = iframe.contentWindow.navigator.getBattery(); | ||
|
||
assert_true(originalManager instanceof BatteryManager); | ||
assert_not_equals(iframe.contentWindow.navigator, | ||
navigator, | ||
'navigator objects shall be different'); | ||
assert_not_equals(promise, | ||
originalPromise, | ||
'battery promises in different navigators shall be different'); | ||
assert_equals(iframe.contentWindow.navigator.getBattery(), | ||
promise, | ||
'battery promises in same navigator shall be same'); | ||
|
||
return promise; | ||
}).then(function(manager) { | ||
assert_equals(manager.__proto__, | ||
iframe.contentWindow.BatteryManager.prototype); | ||
assert_true(manager instanceof iframe.contentWindow.BatteryManager); | ||
}); | ||
|
||
}, 'iframe has a different Navigator object thus getting another battery promise'); | ||
|
||
async_test(function (t) { | ||
var iframe = document.querySelector('#blank'); | ||
var originalNavigator = iframe.contentWindow.navigator; | ||
var originalPromise = iframe.contentWindow.navigator.getBattery(); | ||
|
||
iframe.onload = t.step_func(function() { | ||
assert_equals(iframe.contentWindow.navigator, | ||
originalNavigator, | ||
'navigator objects shall be same'); | ||
assert_equals(iframe.contentWindow.navigator.getBattery(), | ||
originalPromise, | ||
'battery status promises shall be same'); | ||
t.done(); | ||
}); | ||
|
||
iframe.src = 'support-iframe.html'; | ||
}, 'setting src of an iframe with initial about:blank makes same Navigator object and battery promise'); | ||
|
||
async_test(function (t) { | ||
window.onmessage = t.step_func(function(e) { | ||
var iframe = document.querySelector('#frame'); | ||
var originalNavigator = iframe.contentWindow.navigator; | ||
var originalPromise = iframe.contentWindow.navigator.getBattery(); | ||
|
||
assert_equals(e.data, 'loaded'); | ||
|
||
iframe.onload = t.step_func(function() { | ||
assert_not_equals(iframe.contentWindow.navigator, | ||
originalNavigator, | ||
'navigator objects shall be changed'); | ||
assert_not_equals(iframe.contentWindow.navigator.getBattery(), | ||
originalPromise, | ||
'battery status promises shall be different'); | ||
t.done(); | ||
}); | ||
|
||
iframe.src = 'support-iframe.html'; | ||
}); | ||
}, 'setting src of an iframe with initial frame makes its Navigator object vary thus getting another battery promise'); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Battery Test: window.open() makes a different Navigator object</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
#note { | ||
background-color: #fef1b5; | ||
border: solid 1px #cdab2d; | ||
padding: 5px; | ||
margin: 15px; | ||
display: block; | ||
} | ||
</style> | ||
<div id="note"> | ||
Allow pop-up windows before running the tests. | ||
</div> | ||
<div id="log"></div> | ||
<script> | ||
async_test(function (t) { | ||
var win = window.open('support-window-open.html'); | ||
window.onmessage = t.step_func(function(e) { | ||
assert_array_equals(e.data, [false, false, true]); | ||
win.close(); | ||
t.done(); | ||
}); | ||
}, 'window.open() makes a different Navigator object thus getting another battery promise'); | ||
</script> |
Oops, something went wrong.