Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / file_manager / unit_tests / test_util.js
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.
4
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   });
19 }