Add an unittest for background/volume_manager.js
[chromium-blink-merge.git] / chrome / test / data / file_manager / unit_tests / test_util.js
blob001442ccdae9370b118903a755455ff810f5251e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 /**
6  * Invokes a callback function depending on the result of promise.
7  *
8  * @param {Promise} promise Promise.
9  * @param {function(boolean)} calllback Callback function. True is passed if the
10  *     test failed.
11  */
12 function reportPromise(promise, callback) {
13   promise.then(function() {
14     callback(/* error */ false);
15   }, function(error) {
16     console.error(error.stack || error);
17     callback(/* error */ true);
18   });