Chromium Code Reviews| Index: chrome/test/data/webui/test_util.js |
| diff --git a/chrome/test/data/webui/test_util.js b/chrome/test/data/webui/test_util.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4457182733e145ef51a60f0fa3574053ad2e1921 |
| --- /dev/null |
| +++ b/chrome/test/data/webui/test_util.js |
| @@ -0,0 +1,16 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/* |
| + * Waits for queued up tasks to finish before proceeding. Inspired by: |
| + * https://github.com/Polymer/web-component-tester/blob/master/browser/environment/helpers.js#L97 |
| + */ |
| +function flush() { |
|
michaelpg
2016/10/04 05:40:49
please don't call this "flush" -- the more recogni
alito
2016/10/04 21:22:59
I renamed this to flushTasks() which sound quite e
michaelpg
2016/10/04 22:12:15
great, thanks!
|
| + Polymer.dom.flush(); |
|
michaelpg
2016/10/04 05:40:49
Use a more specific filename, or maybe just add to
alito
2016/10/04 21:22:59
Moved the function to polymer_browser_test_base.js
|
| + // Promises have microtask timing, so we use setTimeout to explicity force a |
| + // new task. |
| + return new Promise(function(resolve, reject) { |
| + window.setTimeout(resolve, 0); |
| + }); |
| +} |