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

Unified Diff: LayoutTests/webmidi/permission.html

Issue 1309873002: Refactor webmidi tests to get rid of flakiness (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@permissions-fix
Patch Set: Fix indentation Created 5 years, 4 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/webmidi/permission-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/webmidi/permission.html
diff --git a/LayoutTests/webmidi/permission.html b/LayoutTests/webmidi/permission.html
index 32946146a919b2663a4ef80921d509b66e81d345..5dc18b1e41c0eef6d701283be643980ce04227d2 100644
--- a/LayoutTests/webmidi/permission.html
+++ b/LayoutTests/webmidi/permission.html
@@ -2,6 +2,7 @@
<html>
<head>
<script src="../resources/js-test.js"></script>
+<script src="../resources/permissions-helper.js"></script>
</head>
<body>
<script>
@@ -10,6 +11,7 @@ description("Test if sysex permission request is handled.");
shouldBeDefined("testRunner.setPermission");
shouldBeDefined("navigator.requestMIDIAccess");
+shouldBeDefined("PermissionsHelper.setPermission");
window.jsTestIsAsync = true;
@@ -19,40 +21,42 @@ var finishSuccessfully = function () {
}
var rejectSysex = function (next) {
- testRunner.setPermission('midi-sysex', 'denied', location.origin, location.origin);
- promise = navigator.requestMIDIAccess({sysex: true});
- shouldBeDefined("promise");
- shouldBeDefined("promise.then");
- promise.then(function(access) {
- testFailed("sysex permission request should be rejected.");
- finishJSTest();
- }, function (error) {
- testPassed("sysex permission request is successfully rejected.");
- if (next)
- next();
- else
- finishSuccessfully();
+ PermissionsHelper.setPermission('midi-sysex', 'denied').then(function() {
+ promise = navigator.requestMIDIAccess({sysex: true});
+ shouldBeDefined("promise");
+ shouldBeDefined("promise.then");
+ promise.then(function(access) {
+ testFailed("sysex permission request should be rejected.");
+ finishJSTest();
+ }, function (error) {
+ testPassed("sysex permission request is successfully rejected.");
+ if (next)
+ next();
+ else
+ finishSuccessfully();
+ });
});
}
var acceptSysex = function (next) {
- testRunner.setPermission('midi-sysex', 'granted', location.origin, location.origin);
- promise = navigator.requestMIDIAccess({sysex: true});
- shouldBeDefined("promise");
- shouldBeDefined("promise.then");
- promise.then(function(obtainedAccess) {
- testPassed("sysex permission request is successfully accepted.");
- access = obtainedAccess;
- shouldBeDefined("access");
- shouldBeDefined("access.sysexEnabled");
- shouldBeTrue("access.sysexEnabled");
- if (next)
- next();
- else
- finishSuccessfully();
- }, function (error) {
- testFailed("sysex permission request should be accepted.");
- finishJSTest();
+ PermissionsHelper.setPermission('midi-sysex', 'granted').then(function() {
+ promise = navigator.requestMIDIAccess({sysex: true});
+ shouldBeDefined("promise");
+ shouldBeDefined("promise.then");
+ promise.then(function(obtainedAccess) {
+ testPassed("sysex permission request is successfully accepted.");
+ access = obtainedAccess;
+ shouldBeDefined("access");
+ shouldBeDefined("access.sysexEnabled");
+ shouldBeTrue("access.sysexEnabled");
+ if (next)
+ next();
+ else
+ finishSuccessfully();
+ }, function (error) {
+ testFailed("sysex permission request should be accepted.");
+ finishJSTest();
+ });
});
}
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/webmidi/permission-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698