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. 3, 2016, 1:44 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
« no previous file with comments | « test/stub-modules/common.js ('k') | test/stub-modules/prefs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/stub-modules/common.js ('k') | test/stub-modules/prefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld