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

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

Issue 954943006: Ensure the destination url reported to ImportHistory is correctly encoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
index 3db007e6eed0b8abc48453bf068c0a5be599033b..653f536dbb3c6859bc8bc36e9cf917df09ee044f 100644
--- a/ui/file_manager/file_manager/common/js/test_importer_common.js
+++ b/ui/file_manager/file_manager/common/js/test_importer_common.js
@@ -8,9 +8,12 @@ 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.
+ * @return {!importer.TestLogger}
*/
importer.setupTestLogger = function() {
- importer.logger_ = new importer.TestLogger();
+ var logger = new importer.TestLogger();
+ importer.logger_ = logger;
+ return logger;
};
/**
@@ -24,18 +27,33 @@ importer.setupTestLogger = function() {
importer.TestLogger = function() {
/** @public {!TestCallRecorder} */
this.errorRecorder = new TestCallRecorder();
+
+ /** @type {boolean} Should we print stuff to console */
+ this.quiet_ = false;
+};
+
+/**
+ * Causes logger to stop printing anything to console.
+ * This can be useful when errors are expected in tests.
+ */
+importer.TestLogger.prototype.quiet = function() {
+ this.quiet_ = true;
};
/** @override */
importer.TestLogger.prototype.info = function(content) {
- console.log(content);
+ if (!this.quiet_) {
+ console.log(content);
+ }
};
/** @override */
importer.TestLogger.prototype.error = function(content) {
this.errorRecorder.callback(content);
- console.error(content);
- console.error(new Error('Error stack').stack);
+ if (!this.quiet_) {
+ console.error(content);
+ console.error(new Error('Error stack').stack);
+ }
};
/** @override */
@@ -43,6 +61,8 @@ importer.TestLogger.prototype.catcher = function(context) {
return function(error) {
this.error('Caught promise error. Context: ' + context +
' Error: ' + error.message);
- console.error(error.stack);
+ if (!this.quiet_) {
+ console.error(error.stack);
+ }
}.bind(this);
};

Powered by Google App Engine
This is Rietveld 408576698