Index: chrome/test/data/file_manager/unit_tests/test_util.js |
diff --git a/chrome/test/data/file_manager/unit_tests/test_util.js b/chrome/test/data/file_manager/unit_tests/test_util.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..001442ccdae9370b118903a755455ff810f5251e |
--- /dev/null |
+++ b/chrome/test/data/file_manager/unit_tests/test_util.js |
@@ -0,0 +1,19 @@ |
+// Copyright 2014 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)} calllback Callback function. True is passed if the |
+ * test failed. |
+ */ |
+function reportPromise(promise, callback) { |
+ promise.then(function() { |
+ callback(/* error */ false); |
+ }, function(error) { |
+ console.error(error.stack || error); |
+ callback(/* error */ true); |
+ }); |
+} |