forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files App: Move reportPromise,waitUntil to //ui/file_manager/base/js/…
…test_error_reporting.js These functions are currently in file_manager/file_manager/common/js/unittest_util.js which has a lot of files-app specific stuff that media apps shouldn't depend on. - Move MockAPIEvent to the only unittest (in gallery) that uses it. - Delete the redundant copy of waitUntil in list_thumbnail_loader_unittest.js - Updates the remaining handcrafted foo_unittest.html files in the files app * combination sed-script and manual edit. Bug: 879035 Cq-Include-Trybots: luci.chromium.try:closure_compilation Change-Id: I7d54cec253384b46d1cdb7c51f8ff0eb9596ebf1 Reviewed-on: https://chromium-review.googlesource.com/c/1275545 Commit-Queue: Trent Apted <[email protected]> Reviewed-by: Luciano Pacheco <[email protected]> Cr-Commit-Position: refs/heads/master@{#599115}
- Loading branch information
Showing
38 changed files
with
171 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2018 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. | ||
|
||
/** | ||
* Invokes a callback function depending on the result of promise. | ||
* | ||
* @param {Promise} promise Promise. | ||
* @param {function(boolean)} callback Callback function. True is passed if the | ||
* test failed. | ||
*/ | ||
function reportPromise(promise, callback) { | ||
promise.then( | ||
() => { | ||
callback(/* error */ false); | ||
}, | ||
(/** Error */ error) => { | ||
console.error(error.stack || error); | ||
callback(/* error */ true); | ||
}); | ||
} | ||
|
||
/** | ||
* Waits until testFunction becomes true. | ||
* @param {function(): boolean} testFunction A function which is tested. | ||
* @return {!Promise} A promise which is fulfilled when the testFunction | ||
* becomes true. | ||
*/ | ||
function waitUntil(testFunction) { | ||
const INTERVAL_FOR_WAIT_UNTIL = 100; // ms | ||
|
||
return new Promise((resolve) => { | ||
let tryTestFunction = () => { | ||
if (testFunction()) | ||
resolve(); | ||
else | ||
setTimeout(tryTestFunction, INTERVAL_FOR_WAIT_UNTIL); | ||
}; | ||
|
||
tryTestFunction(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.