Commit 37d8458e authored by Lutz Justen's avatar Lutz Justen Committed by Commit Bot

Fix flaky CrSettingsPeoplePageKerberosAccountsTest

RefreshAccountShowsToast was broken since waiting for the toast to open
was not implemented correctly. The test was waiting for a call to the
proxy's 'addAccount' method, but that doesn't trigger the toast.
Instead, the 'close' event on addDialog triggers it. 'addAccount' does
trigger 'close' somewhere down the pipe, but in a high load situation
the execution flow seems to get skewed so that the test is executed
before the 'close' event happens. This CL fixes this by waiting for the
'close' event instead.

BUG=chromium:1005995
TEST=testing/xvfb.py out/Release/browser_tests --gtest_filter=*Settings* --test-launcher-jobs=200
     succeeds multiple times (well, other tests fail, but the Kerberos
     one doesn't)

Change-Id: If543c2f00c0112811beb7f2d1a2c94dbd3d265a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815118
Commit-Queue: Lutz Justen <ljusten@chromium.org>
Auto-Submit: Lutz Justen <ljusten@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698879}
parent c1c9f965
......@@ -147,6 +147,17 @@ cr.define('settings_people_page_kerberos_accounts', function() {
.click();
}
// Can be used to wait for event |eventName| on |element|, e.g.
// await onEvent(addDialog, 'close');
function onEvent(element, eventName) {
return new Promise(function(resolve) {
element.addEventListener(eventName, function callback() {
element.removeEventListener(eventName, callback);
resolve();
});
});
}
test('AccountListIsPopulatedAtStartup', async () => {
await browserProxy.whenCalled('getAccounts');
Polymer.dom.flush();
......@@ -260,7 +271,7 @@ cr.define('settings_people_page_kerberos_accounts', function() {
addDialog.$$('.action-button').click();
Polymer.dom.flush();
await browserProxy.whenCalled('addAccount');
await onEvent(addDialog, 'close');
await test_util.flushTasks();
Polymer.dom.flush();
assertTrue(toast.open);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment