Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/stub-modules/io.js

Issue 29354864: Issue 4223 - Migrate some more of adblockplustests (Closed)
Patch Set: Addressed feedback Created Oct. 4, 2016, 12:04 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/stub-modules/io.js
diff --git a/test/stub-modules/io.js b/test/stub-modules/io.js
index f9b0c2a1ae977a697181595df380ee2a62bfb691..1fd917dedf90b352c95f8f2119ae6777fb1242cd 100644
--- a/test/stub-modules/io.js
+++ b/test/stub-modules/io.js
@@ -1 +1,43 @@
-exports.IO = {};
+//
+// Fake nsIFile implementation for our I/O
+//
+function FakeFile(path)
+{
+ this.path = path;
+}
+FakeFile.prototype =
+{
+ get leafName()
+ {
+ return this.path;
+ },
+ set leafName(value)
+ {
+ this.path = value;
+ },
+ append: function(path)
+ {
+ this.path += path;
+ },
+ clone: function()
+ {
+ return new FakeFile(this.path);
+ },
+ get parent()
+ {
+ return {create: function() {}};
+ },
+ normalize: function() {}
+};
+
+
+exports.IO = {
+ resolveFilePath: function(path)
+ {
+ return new FakeFile(path);
+ },
+ statFile: function(path)
+ {
+ return true;
+ }
+};
« no previous file with comments | « test/signatures.js ('k') | test/stub-modules/prefs.js » ('j') | test_runner.js » ('J')

Powered by Google App Engine
This is Rietveld