Bug 1382388 - add test for manual abort. r=MattN

MozReview-Commit-ID: Lu7VWVg3qN8

--HG--
extra : rebase_source : 5c03b0c25a0648f6a4a498b0ac94dcfb2d4b6750
This commit is contained in:
Jonathan Guillotte-Blouin 2017-07-31 17:36:02 -07:00
Родитель cec11e294b
Коммит 16aa04e2a4
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -29,3 +29,25 @@ add_task(async function test_show_abort_dialog() {
ok(win.closed, "dialog should be closed");
});
});
add_task(async function test_show_manualAbort_dialog() {
await BrowserTestUtils.withNewTab({
gBrowser,
url: BLANK_PAGE_URL,
}, async browser => {
// start by creating a PaymentRequest, and show it
await ContentTask.spawn(browser, {methodData, details}, ContentTasks.createAndShowRequest);
// get a reference to the UI dialog and the requestId
let win = await getDialogWindow();
let requestId = paymentUISrv.requestIdForWindow(win);
ok(requestId, "requestId should be defined");
ok(!win.closed, "dialog should not be closed");
// abort the payment request manually
let frameLoader = win.document.getElementById("paymentRequestFrame").frameLoader;
await ContentTask.spawn(frameLoader, null, ContentTasks.manuallyClickCancel);
ok(win.closed, "dialog should be closed");
});
});

Просмотреть файл

@ -34,6 +34,10 @@ let ContentTasks = {
content.rq = rq; // assign it so we can retrieve it later
rq.show();
},
manuallyClickCancel: async () => {
content.document.getElementById("cancel").click();
},
};