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

Unified Diff: third_party/WebKit/LayoutTests/battery-status/detached-no-crash.html

Issue 2880763002: [Battery] Allow usage from SecureContext or top-level browsing context only. (Closed)
Patch Set: Fix expected Created 3 years, 7 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/battery-status/detached-no-crash.html
diff --git a/third_party/WebKit/LayoutTests/battery-status/detached-no-crash.html b/third_party/WebKit/LayoutTests/battery-status/detached-no-crash.html
index 3caf6e0543c46182c722c6e673fdf3b1c34aa7ae..286b56892ea7f4f2d6114caca92cdd419c126c39 100644
--- a/third_party/WebKit/LayoutTests/battery-status/detached-no-crash.html
+++ b/third_party/WebKit/LayoutTests/battery-status/detached-no-crash.html
@@ -10,6 +10,7 @@ window.jsTestIsAsync = true;
var w;
var nav;
+var promise;
function processMessage(event) {
if (event.data == "opened") {
@@ -18,8 +19,14 @@ function processMessage(event) {
w.close();
w = null;
} else if (event.data == "closed") {
- shouldBeUndefined("nav.getBattery()");
- finishJSTest();
+ promise = nav.getBattery();
timvolodine 2017/05/25 16:01:13 nit: you can probably get rid of var promise and d
riju_ 2017/05/30 06:36:00 Done.
+ promise.then(battery => {
+ assert_unreachable('getBattery should reject on a closed window');
+ })
+ .catch(error => {
+ assert_equals(error.code, DOMException.SECURITY_ERR);
timvolodine 2017/05/25 16:01:14 nit: maybe add a shouldBeTrue / shouldBeEqualToNum
riju_ 2017/05/30 06:36:00 Done.
+ });
+ finishJSTest();
}
}

Powered by Google App Engine
This is Rietveld 408576698