Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Unified Diff: ui/file_manager/file_manager/common/js/test_importer_common.js

Issue 881463003: Files.app: Add a deduplication step to avoid importing duplicate media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to master; fix Banners test. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/file_manager/common/js/test_importer_common.js
diff --git a/ui/file_manager/file_manager/common/js/test_importer_common.js b/ui/file_manager/file_manager/common/js/test_importer_common.js
new file mode 100644
index 0000000000000000000000000000000000000000..a4618672ef389e6f4813569a3b3e011caff5a979
--- /dev/null
+++ b/ui/file_manager/file_manager/common/js/test_importer_common.js
@@ -0,0 +1,44 @@
+// Copyright 2015 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.
+
+// Shared cloud importer namespace
+var importer = importer || {};
+
+/**
+ * Sets up a logger for use in unit tests. The test logger doesn't attempt to
+ * access chrome's sync file system. Call this during setUp.
+ */
+importer.setupTestLogger = function() {
+ importer.logger_ = new importer.TestLogger();
+};
+
+/**
+ * A {@code importer.Logger} for testing. Just sends output to the console.
+ *
+ * @constructor
+ * @implements {importer.Logger}
+ * @struct
+ * @final
+ */
+importer.TestLogger = function() {};
+
+/** @override */
+importer.TestLogger.prototype.info = function(content) {
+ console.log(content);
+};
+
+/** @override */
+importer.TestLogger.prototype.error = function(content) {
+ console.error(content);
+ console.error(new Error('Error stack').stack);
+};
+
+/** @override */
+importer.TestLogger.prototype.catcher = function(context) {
+ return function(error) {
+ this.error('Caught promise error. Context: ' + context +
+ ' Error: ' + error.message);
+ console.error(error.stack);
+ }.bind(this);
+};

Powered by Google App Engine
This is Rietveld 408576698