Add newlines between describe/it blocks
This commit is contained in:
		
					parent
					
						
							
								709661156a
							
						
					
				
			
			
				commit
				
					
						e63c3c727a
					
				
			
		
					 15 changed files with 455 additions and 295 deletions
				
			
		| 
						 | 
					@ -27,6 +27,7 @@ describe('app module', function() {
 | 
				
			||||||
      return assert.equal(app.getVersion(), '0.1.0');
 | 
					      return assert.equal(app.getVersion(), '0.1.0');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('app.setVersion(version)', function() {
 | 
					  describe('app.setVersion(version)', function() {
 | 
				
			||||||
    return it('overrides the version', function() {
 | 
					    return it('overrides the version', function() {
 | 
				
			||||||
      assert.equal(app.getVersion(), '0.1.0');
 | 
					      assert.equal(app.getVersion(), '0.1.0');
 | 
				
			||||||
| 
						 | 
					@ -35,11 +36,13 @@ describe('app module', function() {
 | 
				
			||||||
      return app.setVersion('0.1.0');
 | 
					      return app.setVersion('0.1.0');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('app.getName()', function() {
 | 
					  describe('app.getName()', function() {
 | 
				
			||||||
    return it('returns the name field of package.json', function() {
 | 
					    return it('returns the name field of package.json', function() {
 | 
				
			||||||
      return assert.equal(app.getName(), 'Electron Test');
 | 
					      return assert.equal(app.getName(), 'Electron Test');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('app.setName(name)', function() {
 | 
					  describe('app.setName(name)', function() {
 | 
				
			||||||
    return it('overrides the name', function() {
 | 
					    return it('overrides the name', function() {
 | 
				
			||||||
      assert.equal(app.getName(), 'Electron Test');
 | 
					      assert.equal(app.getName(), 'Electron Test');
 | 
				
			||||||
| 
						 | 
					@ -48,17 +51,20 @@ describe('app module', function() {
 | 
				
			||||||
      return app.setName('Electron Test');
 | 
					      return app.setName('Electron Test');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('app.getLocale()', function() {
 | 
					  describe('app.getLocale()', function() {
 | 
				
			||||||
    return it('should not be empty', function() {
 | 
					    return it('should not be empty', function() {
 | 
				
			||||||
      return assert.notEqual(app.getLocale(), '');
 | 
					      return assert.notEqual(app.getLocale(), '');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('app.exit(exitCode)', function() {
 | 
					  describe('app.exit(exitCode)', function() {
 | 
				
			||||||
    var appProcess;
 | 
					    var appProcess = null;
 | 
				
			||||||
    appProcess = null;
 | 
					
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return appProcess != null ? appProcess.kill() : void 0;
 | 
					      return appProcess != null ? appProcess.kill() : void 0;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('emits a process exit event with the code', function(done) {
 | 
					    return it('emits a process exit event with the code', function(done) {
 | 
				
			||||||
      var appPath, electronPath, output;
 | 
					      var appPath, electronPath, output;
 | 
				
			||||||
      appPath = path.join(__dirname, 'fixtures', 'api', 'quit-app');
 | 
					      appPath = path.join(__dirname, 'fixtures', 'api', 'quit-app');
 | 
				
			||||||
| 
						 | 
					@ -77,15 +83,17 @@ describe('app module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('BrowserWindow events', function() {
 | 
					  return describe('BrowserWindow events', function() {
 | 
				
			||||||
    var w;
 | 
					    var w = null;
 | 
				
			||||||
    w = null;
 | 
					
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      if (w != null) {
 | 
					      if (w != null) {
 | 
				
			||||||
        w.destroy();
 | 
					        w.destroy();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return w = null;
 | 
					      return w = null;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('should emit browser-window-focus event when window is focused', function(done) {
 | 
					    it('should emit browser-window-focus event when window is focused', function(done) {
 | 
				
			||||||
      app.once('browser-window-focus', function(e, window) {
 | 
					      app.once('browser-window-focus', function(e, window) {
 | 
				
			||||||
        assert.equal(w.id, window.id);
 | 
					        assert.equal(w.id, window.id);
 | 
				
			||||||
| 
						 | 
					@ -96,6 +104,7 @@ describe('app module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      return w.emit('focus');
 | 
					      return w.emit('focus');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('should emit browser-window-blur event when window is blured', function(done) {
 | 
					    it('should emit browser-window-blur event when window is blured', function(done) {
 | 
				
			||||||
      app.once('browser-window-blur', function(e, window) {
 | 
					      app.once('browser-window-blur', function(e, window) {
 | 
				
			||||||
        assert.equal(w.id, window.id);
 | 
					        assert.equal(w.id, window.id);
 | 
				
			||||||
| 
						 | 
					@ -106,6 +115,7 @@ describe('app module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      return w.emit('blur');
 | 
					      return w.emit('blur');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('should emit browser-window-created event when window is created', function(done) {
 | 
					    return it('should emit browser-window-created event when window is created', function(done) {
 | 
				
			||||||
      app.once('browser-window-created', function(e, window) {
 | 
					      app.once('browser-window-created', function(e, window) {
 | 
				
			||||||
        return setImmediate(function() {
 | 
					        return setImmediate(function() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,8 +5,8 @@ const clipboard = require('electron').clipboard;
 | 
				
			||||||
const nativeImage = require('electron').nativeImage;
 | 
					const nativeImage = require('electron').nativeImage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('clipboard module', function() {
 | 
					describe('clipboard module', function() {
 | 
				
			||||||
  var fixtures;
 | 
					  var fixtures = path.resolve(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.resolve(__dirname, 'fixtures');
 | 
					
 | 
				
			||||||
  describe('clipboard.readImage()', function() {
 | 
					  describe('clipboard.readImage()', function() {
 | 
				
			||||||
    return it('returns NativeImage intance', function() {
 | 
					    return it('returns NativeImage intance', function() {
 | 
				
			||||||
      var i, p;
 | 
					      var i, p;
 | 
				
			||||||
| 
						 | 
					@ -16,6 +16,7 @@ describe('clipboard module', function() {
 | 
				
			||||||
      return assert.equal(clipboard.readImage().toDataURL(), i.toDataURL());
 | 
					      return assert.equal(clipboard.readImage().toDataURL(), i.toDataURL());
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('clipboard.readText()', function() {
 | 
					  describe('clipboard.readText()', function() {
 | 
				
			||||||
    return it('returns unicode string correctly', function() {
 | 
					    return it('returns unicode string correctly', function() {
 | 
				
			||||||
      var text;
 | 
					      var text;
 | 
				
			||||||
| 
						 | 
					@ -24,6 +25,7 @@ describe('clipboard module', function() {
 | 
				
			||||||
      return assert.equal(clipboard.readText(), text);
 | 
					      return assert.equal(clipboard.readText(), text);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('clipboard.readHtml()', function() {
 | 
					  describe('clipboard.readHtml()', function() {
 | 
				
			||||||
    return it('returns markup correctly', function() {
 | 
					    return it('returns markup correctly', function() {
 | 
				
			||||||
      var markup, text;
 | 
					      var markup, text;
 | 
				
			||||||
| 
						 | 
					@ -33,6 +35,7 @@ describe('clipboard module', function() {
 | 
				
			||||||
      return assert.equal(clipboard.readHtml(), markup);
 | 
					      return assert.equal(clipboard.readHtml(), markup);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('clipboard.readRtf', function() {
 | 
					  describe('clipboard.readRtf', function() {
 | 
				
			||||||
    return it('returns rtf text correctly', function() {
 | 
					    return it('returns rtf text correctly', function() {
 | 
				
			||||||
      var rtf = "{\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\pard\nThis is some {\\b bold} text.\\par\n}";
 | 
					      var rtf = "{\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\pard\nThis is some {\\b bold} text.\\par\n}";
 | 
				
			||||||
| 
						 | 
					@ -40,6 +43,7 @@ describe('clipboard module', function() {
 | 
				
			||||||
      return assert.equal(clipboard.readRtf(), rtf);
 | 
					      return assert.equal(clipboard.readRtf(), rtf);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('clipboard.write()', function() {
 | 
					  return describe('clipboard.write()', function() {
 | 
				
			||||||
    return it('returns data correctly', function() {
 | 
					    return it('returns data correctly', function() {
 | 
				
			||||||
      var i, markup, p, text, rtf;
 | 
					      var i, markup, p, text, rtf;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,29 +10,33 @@ const crashReporter = remote.require('electron').crashReporter;
 | 
				
			||||||
const BrowserWindow = remote.require('electron').BrowserWindow;
 | 
					const BrowserWindow = remote.require('electron').BrowserWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('crash-reporter module', function() {
 | 
					describe('crash-reporter module', function() {
 | 
				
			||||||
  var fixtures, isCI, w;
 | 
					  var fixtures = path.resolve(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.resolve(__dirname, 'fixtures');
 | 
					  var w = null;
 | 
				
			||||||
  w = null;
 | 
					
 | 
				
			||||||
  beforeEach(function() {
 | 
					  beforeEach(function() {
 | 
				
			||||||
    return w = new BrowserWindow({
 | 
					    return w = new BrowserWindow({
 | 
				
			||||||
      show: false
 | 
					      show: false
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(function() {
 | 
					  afterEach(function() {
 | 
				
			||||||
    return w.destroy();
 | 
					    return w.destroy();
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (process.mas) {
 | 
					  if (process.mas) {
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  isCI = remote.getGlobal('isCi');
 | 
					
 | 
				
			||||||
 | 
					  var isCI = remote.getGlobal('isCi');
 | 
				
			||||||
  if (isCI) {
 | 
					  if (isCI) {
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('should send minidump when renderer crashes', function(done) {
 | 
					  it('should send minidump when renderer crashes', function(done) {
 | 
				
			||||||
    var called, port, server;
 | 
					 | 
				
			||||||
    this.timeout(120000);
 | 
					    this.timeout(120000);
 | 
				
			||||||
    called = false;
 | 
					
 | 
				
			||||||
    server = http.createServer(function(req, res) {
 | 
					    var called = false;
 | 
				
			||||||
 | 
					    var server = http.createServer(function(req, res) {
 | 
				
			||||||
      var form;
 | 
					      var form;
 | 
				
			||||||
      server.close();
 | 
					      server.close();
 | 
				
			||||||
      form = new multiparty.Form();
 | 
					      form = new multiparty.Form();
 | 
				
			||||||
| 
						 | 
					@ -54,7 +58,7 @@ describe('crash-reporter module', function() {
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    port = remote.process.port;
 | 
					    var port = remote.process.port;
 | 
				
			||||||
    return server.listen(port, '127.0.0.1', function() {
 | 
					    return server.listen(port, '127.0.0.1', function() {
 | 
				
			||||||
      port = server.address().port;
 | 
					      port = server.address().port;
 | 
				
			||||||
      remote.process.port = port;
 | 
					      remote.process.port = port;
 | 
				
			||||||
| 
						 | 
					@ -72,6 +76,7 @@ describe('crash-reporter module', function() {
 | 
				
			||||||
      return w.loadURL(crashUrl);
 | 
					      return w.loadURL(crashUrl);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe(".start(options)", function() {
 | 
					  return describe(".start(options)", function() {
 | 
				
			||||||
    return it('requires that the companyName and submitURL options be specified', function() {
 | 
					    return it('requires that the companyName and submitURL options be specified', function() {
 | 
				
			||||||
      assert.throws(function() {
 | 
					      assert.throws(function() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,9 +3,9 @@ const path = require('path');
 | 
				
			||||||
const BrowserWindow = require('electron').remote.BrowserWindow;
 | 
					const BrowserWindow = require('electron').remote.BrowserWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('debugger module', function() {
 | 
					describe('debugger module', function() {
 | 
				
			||||||
  var fixtures, w;
 | 
					  var fixtures = path.resolve(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.resolve(__dirname, 'fixtures');
 | 
					  var w = null;
 | 
				
			||||||
  w = null;
 | 
					
 | 
				
			||||||
  beforeEach(function() {
 | 
					  beforeEach(function() {
 | 
				
			||||||
    if (w != null) {
 | 
					    if (w != null) {
 | 
				
			||||||
      w.destroy();
 | 
					      w.destroy();
 | 
				
			||||||
| 
						 | 
					@ -16,6 +16,7 @@ describe('debugger module', function() {
 | 
				
			||||||
      height: 400
 | 
					      height: 400
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(function() {
 | 
					  afterEach(function() {
 | 
				
			||||||
    if (w != null) {
 | 
					    if (w != null) {
 | 
				
			||||||
      w.destroy();
 | 
					      w.destroy();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,8 +16,8 @@ const comparePaths = function(path1, path2) {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('ipc module', function() {
 | 
					describe('ipc module', function() {
 | 
				
			||||||
  var fixtures;
 | 
					  var fixtures = path.join(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.join(__dirname, 'fixtures');
 | 
					
 | 
				
			||||||
  describe('remote.require', function() {
 | 
					  describe('remote.require', function() {
 | 
				
			||||||
    it('should returns same object for the same module', function() {
 | 
					    it('should returns same object for the same module', function() {
 | 
				
			||||||
      var dialog1, dialog2;
 | 
					      var dialog1, dialog2;
 | 
				
			||||||
| 
						 | 
					@ -25,36 +25,39 @@ describe('ipc module', function() {
 | 
				
			||||||
      dialog2 = remote.require('electron');
 | 
					      dialog2 = remote.require('electron');
 | 
				
			||||||
      return assert.equal(dialog1, dialog2);
 | 
					      return assert.equal(dialog1, dialog2);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('should work when object contains id property', function() {
 | 
					    it('should work when object contains id property', function() {
 | 
				
			||||||
      var a;
 | 
					      var a;
 | 
				
			||||||
      a = remote.require(path.join(fixtures, 'module', 'id.js'));
 | 
					      a = remote.require(path.join(fixtures, 'module', 'id.js'));
 | 
				
			||||||
      return assert.equal(a.id, 1127);
 | 
					      return assert.equal(a.id, 1127);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('should search module from the user app', function() {
 | 
					    return it('should search module from the user app', function() {
 | 
				
			||||||
      comparePaths(path.normalize(remote.process.mainModule.filename), path.resolve(__dirname, 'static', 'main.js'));
 | 
					      comparePaths(path.normalize(remote.process.mainModule.filename), path.resolve(__dirname, 'static', 'main.js'));
 | 
				
			||||||
      return comparePaths(path.normalize(remote.process.mainModule.paths[0]), path.resolve(__dirname, 'static', 'node_modules'));
 | 
					      return comparePaths(path.normalize(remote.process.mainModule.paths[0]), path.resolve(__dirname, 'static', 'node_modules'));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('remote.createFunctionWithReturnValue', function() {
 | 
					  describe('remote.createFunctionWithReturnValue', function() {
 | 
				
			||||||
    return it('should be called in browser synchronously', function() {
 | 
					    return it('should be called in browser synchronously', function() {
 | 
				
			||||||
      var buf, call, result;
 | 
					      var buf = new Buffer('test');
 | 
				
			||||||
      buf = new Buffer('test');
 | 
					      var call = remote.require(path.join(fixtures, 'module', 'call.js'));
 | 
				
			||||||
      call = remote.require(path.join(fixtures, 'module', 'call.js'));
 | 
					      var result = call.call(remote.createFunctionWithReturnValue(buf));
 | 
				
			||||||
      result = call.call(remote.createFunctionWithReturnValue(buf));
 | 
					 | 
				
			||||||
      return assert.equal(result.constructor.name, 'Buffer');
 | 
					      return assert.equal(result.constructor.name, 'Buffer');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('remote object in renderer', function() {
 | 
					  describe('remote object in renderer', function() {
 | 
				
			||||||
    it('can change its properties', function() {
 | 
					    it('can change its properties', function() {
 | 
				
			||||||
      var property, property2;
 | 
					      var property = remote.require(path.join(fixtures, 'module', 'property.js'));
 | 
				
			||||||
      property = remote.require(path.join(fixtures, 'module', 'property.js'));
 | 
					 | 
				
			||||||
      assert.equal(property.property, 1127);
 | 
					      assert.equal(property.property, 1127);
 | 
				
			||||||
      property.property = 1007;
 | 
					      property.property = 1007;
 | 
				
			||||||
      assert.equal(property.property, 1007);
 | 
					      assert.equal(property.property, 1007);
 | 
				
			||||||
      property2 = remote.require(path.join(fixtures, 'module', 'property.js'));
 | 
					      var property2 = remote.require(path.join(fixtures, 'module', 'property.js'));
 | 
				
			||||||
      assert.equal(property2.property, 1007);
 | 
					      assert.equal(property2.property, 1007);
 | 
				
			||||||
      return property.property = 1127;
 | 
					      return property.property = 1127;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('can construct an object from its member', function() {
 | 
					    return it('can construct an object from its member', function() {
 | 
				
			||||||
      var call, obj;
 | 
					      var call, obj;
 | 
				
			||||||
      call = remote.require(path.join(fixtures, 'module', 'call.js'));
 | 
					      call = remote.require(path.join(fixtures, 'module', 'call.js'));
 | 
				
			||||||
| 
						 | 
					@ -62,37 +65,37 @@ describe('ipc module', function() {
 | 
				
			||||||
      return assert.equal(obj.test, 'test');
 | 
					      return assert.equal(obj.test, 'test');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('remote value in browser', function() {
 | 
					  describe('remote value in browser', function() {
 | 
				
			||||||
    var print;
 | 
					    var print = path.join(fixtures, 'module', 'print_name.js');
 | 
				
			||||||
    print = path.join(fixtures, 'module', 'print_name.js');
 | 
					
 | 
				
			||||||
    it('keeps its constructor name for objects', function() {
 | 
					    it('keeps its constructor name for objects', function() {
 | 
				
			||||||
      var buf, print_name;
 | 
					      var buf = new Buffer('test');
 | 
				
			||||||
      buf = new Buffer('test');
 | 
					      var print_name = remote.require(print);
 | 
				
			||||||
      print_name = remote.require(print);
 | 
					 | 
				
			||||||
      return assert.equal(print_name.print(buf), 'Buffer');
 | 
					      return assert.equal(print_name.print(buf), 'Buffer');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('supports instanceof Date', function() {
 | 
					    return it('supports instanceof Date', function() {
 | 
				
			||||||
      var now, print_name;
 | 
					      var now = new Date();
 | 
				
			||||||
      now = new Date();
 | 
					      var print_name = remote.require(print);
 | 
				
			||||||
      print_name = remote.require(print);
 | 
					 | 
				
			||||||
      assert.equal(print_name.print(now), 'Date');
 | 
					      assert.equal(print_name.print(now), 'Date');
 | 
				
			||||||
      return assert.deepEqual(print_name.echo(now), now);
 | 
					      return assert.deepEqual(print_name.echo(now), now);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('remote promise', function() {
 | 
					  describe('remote promise', function() {
 | 
				
			||||||
    return it('can be used as promise in each side', function(done) {
 | 
					    return it('can be used as promise in each side', function(done) {
 | 
				
			||||||
      var promise;
 | 
					      var promise = remote.require(path.join(fixtures, 'module', 'promise.js'));
 | 
				
			||||||
      promise = remote.require(path.join(fixtures, 'module', 'promise.js'));
 | 
					 | 
				
			||||||
      return promise.twicePromise(Promise.resolve(1234)).then(function(value) {
 | 
					      return promise.twicePromise(Promise.resolve(1234)).then(function(value) {
 | 
				
			||||||
        assert.equal(value, 2468);
 | 
					        assert.equal(value, 2468);
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('ipc.sender.send', function() {
 | 
					  describe('ipc.sender.send', function() {
 | 
				
			||||||
    return it('should work when sending an object containing id property', function(done) {
 | 
					    return it('should work when sending an object containing id property', function(done) {
 | 
				
			||||||
      var obj;
 | 
					      var obj = {
 | 
				
			||||||
      obj = {
 | 
					 | 
				
			||||||
        id: 1,
 | 
					        id: 1,
 | 
				
			||||||
        name: 'ly'
 | 
					        name: 'ly'
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
| 
						 | 
					@ -103,16 +106,17 @@ describe('ipc module', function() {
 | 
				
			||||||
      return ipcRenderer.send('message', obj);
 | 
					      return ipcRenderer.send('message', obj);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('ipc.sendSync', function() {
 | 
					  describe('ipc.sendSync', function() {
 | 
				
			||||||
    it('can be replied by setting event.returnValue', function() {
 | 
					    it('can be replied by setting event.returnValue', function() {
 | 
				
			||||||
      var msg;
 | 
					      var msg = ipcRenderer.sendSync('echo', 'test');
 | 
				
			||||||
      msg = ipcRenderer.sendSync('echo', 'test');
 | 
					 | 
				
			||||||
      return assert.equal(msg, 'test');
 | 
					      return assert.equal(msg, 'test');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('does not crash when reply is not sent and browser is destroyed', function(done) {
 | 
					    return it('does not crash when reply is not sent and browser is destroyed', function(done) {
 | 
				
			||||||
      var w;
 | 
					 | 
				
			||||||
      this.timeout(10000);
 | 
					      this.timeout(10000);
 | 
				
			||||||
      w = new BrowserWindow({
 | 
					
 | 
				
			||||||
 | 
					      var w = new BrowserWindow({
 | 
				
			||||||
        show: false
 | 
					        show: false
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      ipcMain.once('send-sync-message', function(event) {
 | 
					      ipcMain.once('send-sync-message', function(event) {
 | 
				
			||||||
| 
						 | 
					@ -123,18 +127,19 @@ describe('ipc module', function() {
 | 
				
			||||||
      return w.loadURL('file://' + path.join(fixtures, 'api', 'send-sync-message.html'));
 | 
					      return w.loadURL('file://' + path.join(fixtures, 'api', 'send-sync-message.html'));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('remote listeners', function() {
 | 
					  return describe('remote listeners', function() {
 | 
				
			||||||
    var w;
 | 
					    var w = null;
 | 
				
			||||||
    w = null;
 | 
					
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return w.destroy();
 | 
					      return w.destroy();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('can be added and removed correctly', function() {
 | 
					    return it('can be added and removed correctly', function() {
 | 
				
			||||||
      var listener;
 | 
					 | 
				
			||||||
      w = new BrowserWindow({
 | 
					      w = new BrowserWindow({
 | 
				
			||||||
        show: false
 | 
					        show: false
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      listener = function() {};
 | 
					      var listener = function() {};
 | 
				
			||||||
      w.on('test', listener);
 | 
					      w.on('test', listener);
 | 
				
			||||||
      assert.equal(w.listenerCount('test'), 1);
 | 
					      assert.equal(w.listenerCount('test'), 1);
 | 
				
			||||||
      w.removeListener('test', listener);
 | 
					      w.removeListener('test', listener);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,8 +9,7 @@ const MenuItem = remote.require('electron').MenuItem;
 | 
				
			||||||
describe('menu module', function() {
 | 
					describe('menu module', function() {
 | 
				
			||||||
  describe('Menu.buildFromTemplate', function() {
 | 
					  describe('Menu.buildFromTemplate', function() {
 | 
				
			||||||
    it('should be able to attach extra fields', function() {
 | 
					    it('should be able to attach extra fields', function() {
 | 
				
			||||||
      var menu;
 | 
					      var menu = Menu.buildFromTemplate([
 | 
				
			||||||
      menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          label: 'text',
 | 
					          label: 'text',
 | 
				
			||||||
          extra: 'field'
 | 
					          extra: 'field'
 | 
				
			||||||
| 
						 | 
					@ -18,9 +17,9 @@ describe('menu module', function() {
 | 
				
			||||||
      ]);
 | 
					      ]);
 | 
				
			||||||
      return assert.equal(menu.items[0].extra, 'field');
 | 
					      return assert.equal(menu.items[0].extra, 'field');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('does not modify the specified template', function() {
 | 
					    it('does not modify the specified template', function() {
 | 
				
			||||||
      var template;
 | 
					      var template = ipcRenderer.sendSync('eval', "var template = [{label: 'text', submenu: [{label: 'sub'}]}];\nrequire('electron').Menu.buildFromTemplate(template);\ntemplate;");
 | 
				
			||||||
      template = ipcRenderer.sendSync('eval', "var template = [{label: 'text', submenu: [{label: 'sub'}]}];\nrequire('electron').Menu.buildFromTemplate(template);\ntemplate;");
 | 
					 | 
				
			||||||
      return assert.deepStrictEqual(template, [
 | 
					      return assert.deepStrictEqual(template, [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          label: 'text',
 | 
					          label: 'text',
 | 
				
			||||||
| 
						 | 
					@ -32,10 +31,10 @@ describe('menu module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      ]);
 | 
					      ]);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return describe('Menu.buildFromTemplate should reorder based on item position specifiers', function() {
 | 
					    return describe('Menu.buildFromTemplate should reorder based on item position specifiers', function() {
 | 
				
			||||||
      it('should position before existing item', function() {
 | 
					      it('should position before existing item', function() {
 | 
				
			||||||
        var menu;
 | 
					        var menu = Menu.buildFromTemplate([
 | 
				
			||||||
        menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            label: '2',
 | 
					            label: '2',
 | 
				
			||||||
            id: '2'
 | 
					            id: '2'
 | 
				
			||||||
| 
						 | 
					@ -52,9 +51,9 @@ describe('menu module', function() {
 | 
				
			||||||
        assert.equal(menu.items[1].label, '2');
 | 
					        assert.equal(menu.items[1].label, '2');
 | 
				
			||||||
        return assert.equal(menu.items[2].label, '3');
 | 
					        return assert.equal(menu.items[2].label, '3');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('should position after existing item', function() {
 | 
					      it('should position after existing item', function() {
 | 
				
			||||||
        var menu;
 | 
					        var menu = Menu.buildFromTemplate([
 | 
				
			||||||
        menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            label: '1',
 | 
					            label: '1',
 | 
				
			||||||
            id: '1'
 | 
					            id: '1'
 | 
				
			||||||
| 
						 | 
					@ -71,9 +70,9 @@ describe('menu module', function() {
 | 
				
			||||||
        assert.equal(menu.items[1].label, '2');
 | 
					        assert.equal(menu.items[1].label, '2');
 | 
				
			||||||
        return assert.equal(menu.items[2].label, '3');
 | 
					        return assert.equal(menu.items[2].label, '3');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('should position at endof existing separator groups', function() {
 | 
					      it('should position at endof existing separator groups', function() {
 | 
				
			||||||
        var menu;
 | 
					        var menu = Menu.buildFromTemplate([
 | 
				
			||||||
        menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            type: 'separator',
 | 
					            type: 'separator',
 | 
				
			||||||
            id: 'numbers'
 | 
					            id: 'numbers'
 | 
				
			||||||
| 
						 | 
					@ -115,9 +114,9 @@ describe('menu module', function() {
 | 
				
			||||||
        assert.equal(menu.items[6].label, 'b');
 | 
					        assert.equal(menu.items[6].label, 'b');
 | 
				
			||||||
        return assert.equal(menu.items[7].label, 'c');
 | 
					        return assert.equal(menu.items[7].label, 'c');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('should create separator group if endof does not reference existing separator group', function() {
 | 
					      it('should create separator group if endof does not reference existing separator group', function() {
 | 
				
			||||||
        var menu;
 | 
					        var menu = Menu.buildFromTemplate([
 | 
				
			||||||
        menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            label: 'a',
 | 
					            label: 'a',
 | 
				
			||||||
            id: 'a',
 | 
					            id: 'a',
 | 
				
			||||||
| 
						 | 
					@ -153,9 +152,9 @@ describe('menu module', function() {
 | 
				
			||||||
        assert.equal(menu.items[6].label, '2');
 | 
					        assert.equal(menu.items[6].label, '2');
 | 
				
			||||||
        return assert.equal(menu.items[7].label, '3');
 | 
					        return assert.equal(menu.items[7].label, '3');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('should continue inserting items at next index when no specifier is present', function() {
 | 
					      return it('should continue inserting items at next index when no specifier is present', function() {
 | 
				
			||||||
        var menu;
 | 
					        var menu = Menu.buildFromTemplate([
 | 
				
			||||||
        menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            label: '4',
 | 
					            label: '4',
 | 
				
			||||||
            id: '4'
 | 
					            id: '4'
 | 
				
			||||||
| 
						 | 
					@ -182,10 +181,10 @@ describe('menu module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('Menu.insert', function() {
 | 
					  describe('Menu.insert', function() {
 | 
				
			||||||
    return it('should store item in @items by its index', function() {
 | 
					    return it('should store item in @items by its index', function() {
 | 
				
			||||||
      var item, menu;
 | 
					      var menu = Menu.buildFromTemplate([
 | 
				
			||||||
      menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          label: '1'
 | 
					          label: '1'
 | 
				
			||||||
        }, {
 | 
					        }, {
 | 
				
			||||||
| 
						 | 
					@ -194,7 +193,7 @@ describe('menu module', function() {
 | 
				
			||||||
          label: '3'
 | 
					          label: '3'
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      ]);
 | 
					      ]);
 | 
				
			||||||
      item = new MenuItem({
 | 
					      var item = new MenuItem({
 | 
				
			||||||
        label: 'inserted'
 | 
					        label: 'inserted'
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      menu.insert(1, item);
 | 
					      menu.insert(1, item);
 | 
				
			||||||
| 
						 | 
					@ -204,10 +203,10 @@ describe('menu module', function() {
 | 
				
			||||||
      return assert.equal(menu.items[3].label, '3');
 | 
					      return assert.equal(menu.items[3].label, '3');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('MenuItem.click', function() {
 | 
					  describe('MenuItem.click', function() {
 | 
				
			||||||
    return it('should be called with the item object passed', function(done) {
 | 
					    return it('should be called with the item object passed', function(done) {
 | 
				
			||||||
      var menu;
 | 
					      var menu = Menu.buildFromTemplate([
 | 
				
			||||||
      menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          label: 'text',
 | 
					          label: 'text',
 | 
				
			||||||
          click: function(item) {
 | 
					          click: function(item) {
 | 
				
			||||||
| 
						 | 
					@ -220,10 +219,10 @@ describe('menu module', function() {
 | 
				
			||||||
      return menu.delegate.executeCommand(menu.items[0].commandId);
 | 
					      return menu.delegate.executeCommand(menu.items[0].commandId);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('MenuItem with checked property', function() {
 | 
					  return describe('MenuItem with checked property', function() {
 | 
				
			||||||
    it('clicking an checkbox item should flip the checked property', function() {
 | 
					    it('clicking an checkbox item should flip the checked property', function() {
 | 
				
			||||||
      var menu;
 | 
					      var menu = Menu.buildFromTemplate([
 | 
				
			||||||
      menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          label: 'text',
 | 
					          label: 'text',
 | 
				
			||||||
          type: 'checkbox'
 | 
					          type: 'checkbox'
 | 
				
			||||||
| 
						 | 
					@ -233,9 +232,9 @@ describe('menu module', function() {
 | 
				
			||||||
      menu.delegate.executeCommand(menu.items[0].commandId);
 | 
					      menu.delegate.executeCommand(menu.items[0].commandId);
 | 
				
			||||||
      return assert.equal(menu.items[0].checked, true);
 | 
					      return assert.equal(menu.items[0].checked, true);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('clicking an radio item should always make checked property true', function() {
 | 
					    it('clicking an radio item should always make checked property true', function() {
 | 
				
			||||||
      var menu;
 | 
					      var menu = Menu.buildFromTemplate([
 | 
				
			||||||
      menu = Menu.buildFromTemplate([
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          label: 'text',
 | 
					          label: 'text',
 | 
				
			||||||
          type: 'radio'
 | 
					          type: 'radio'
 | 
				
			||||||
| 
						 | 
					@ -246,6 +245,7 @@ describe('menu module', function() {
 | 
				
			||||||
      menu.delegate.executeCommand(menu.items[0].commandId);
 | 
					      menu.delegate.executeCommand(menu.items[0].commandId);
 | 
				
			||||||
      return assert.equal(menu.items[0].checked, true);
 | 
					      return assert.equal(menu.items[0].checked, true);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('at least have one item checked in each group', function() {
 | 
					    it('at least have one item checked in each group', function() {
 | 
				
			||||||
      var i, j, k, menu, template;
 | 
					      var i, j, k, menu, template;
 | 
				
			||||||
      template = [];
 | 
					      template = [];
 | 
				
			||||||
| 
						 | 
					@ -269,6 +269,7 @@ describe('menu module', function() {
 | 
				
			||||||
      assert.equal(menu.items[0].checked, true);
 | 
					      assert.equal(menu.items[0].checked, true);
 | 
				
			||||||
      return assert.equal(menu.items[12].checked, true);
 | 
					      return assert.equal(menu.items[12].checked, true);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('should assign groupId automatically', function() {
 | 
					    it('should assign groupId automatically', function() {
 | 
				
			||||||
      var groupId, i, j, k, l, m, menu, results, template;
 | 
					      var groupId, i, j, k, l, m, menu, results, template;
 | 
				
			||||||
      template = [];
 | 
					      template = [];
 | 
				
			||||||
| 
						 | 
					@ -298,6 +299,7 @@ describe('menu module', function() {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return results;
 | 
					      return results;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it("setting 'checked' should flip other items' 'checked' property", function() {
 | 
					    return it("setting 'checked' should flip other items' 'checked' property", function() {
 | 
				
			||||||
      var i, j, k, l, m, menu, n, o, p, q, results, template;
 | 
					      var i, j, k, l, m, menu, n, o, p, q, results, template;
 | 
				
			||||||
      template = [];
 | 
					      template = [];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,13 +6,13 @@ const remote = require('electron').remote;
 | 
				
			||||||
const protocol = remote.require('electron').protocol;
 | 
					const protocol = remote.require('electron').protocol;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('protocol module', function() {
 | 
					describe('protocol module', function() {
 | 
				
			||||||
  var postData, protocolName, text;
 | 
					  var protocolName = 'sp';
 | 
				
			||||||
  protocolName = 'sp';
 | 
					  var text = 'valar morghulis';
 | 
				
			||||||
  text = 'valar morghulis';
 | 
					  var postData = {
 | 
				
			||||||
  postData = {
 | 
					 | 
				
			||||||
    name: 'post test',
 | 
					    name: 'post test',
 | 
				
			||||||
    type: 'string'
 | 
					    type: 'string'
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(function(done) {
 | 
					  afterEach(function(done) {
 | 
				
			||||||
    return protocol.unregisterProtocol(protocolName, function() {
 | 
					    return protocol.unregisterProtocol(protocolName, function() {
 | 
				
			||||||
      return protocol.uninterceptProtocol('http', function() {
 | 
					      return protocol.uninterceptProtocol('http', function() {
 | 
				
			||||||
| 
						 | 
					@ -20,11 +20,12 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.register(Any)Protocol', function() {
 | 
					  describe('protocol.register(Any)Protocol', function() {
 | 
				
			||||||
    var emptyHandler;
 | 
					    var emptyHandler = function(request, callback) {
 | 
				
			||||||
    emptyHandler = function(request, callback) {
 | 
					 | 
				
			||||||
      return callback();
 | 
					      return callback();
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('throws error when scheme is already registered', function(done) {
 | 
					    it('throws error when scheme is already registered', function(done) {
 | 
				
			||||||
      return protocol.registerStringProtocol(protocolName, emptyHandler, function(error) {
 | 
					      return protocol.registerStringProtocol(protocolName, emptyHandler, function(error) {
 | 
				
			||||||
        assert.equal(error, null);
 | 
					        assert.equal(error, null);
 | 
				
			||||||
| 
						 | 
					@ -34,9 +35,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('does not crash when handler is called twice', function(done) {
 | 
					    it('does not crash when handler is called twice', function(done) {
 | 
				
			||||||
      var doubleHandler;
 | 
					      var doubleHandler = function(request, callback) {
 | 
				
			||||||
      doubleHandler = function(request, callback) {
 | 
					 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
          callback(text);
 | 
					          callback(text);
 | 
				
			||||||
          return callback();
 | 
					          return callback();
 | 
				
			||||||
| 
						 | 
					@ -60,6 +61,7 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('sends error when callback is called with nothing', function(done) {
 | 
					    it('sends error when callback is called with nothing', function(done) {
 | 
				
			||||||
      return protocol.registerBufferProtocol(protocolName, emptyHandler, function(error) {
 | 
					      return protocol.registerBufferProtocol(protocolName, emptyHandler, function(error) {
 | 
				
			||||||
        if (error) {
 | 
					        if (error) {
 | 
				
			||||||
| 
						 | 
					@ -77,9 +79,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('does not crash when callback is called in next tick', function(done) {
 | 
					    return it('does not crash when callback is called in next tick', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return setImmediate(function() {
 | 
					        return setImmediate(function() {
 | 
				
			||||||
          return callback(text);
 | 
					          return callback(text);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
| 
						 | 
					@ -101,6 +103,7 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.unregisterProtocol', function() {
 | 
					  describe('protocol.unregisterProtocol', function() {
 | 
				
			||||||
    return it('returns error when scheme does not exist', function(done) {
 | 
					    return it('returns error when scheme does not exist', function(done) {
 | 
				
			||||||
      return protocol.unregisterProtocol('not-exist', function(error) {
 | 
					      return protocol.unregisterProtocol('not-exist', function(error) {
 | 
				
			||||||
| 
						 | 
					@ -109,10 +112,10 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.registerStringProtocol', function() {
 | 
					  describe('protocol.registerStringProtocol', function() {
 | 
				
			||||||
    it('sends string as response', function(done) {
 | 
					    it('sends string as response', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(text);
 | 
					        return callback(text);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerStringProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerStringProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -131,9 +134,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('sets Access-Control-Allow-Origin', function(done) {
 | 
					    it('sets Access-Control-Allow-Origin', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(text);
 | 
					        return callback(text);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerStringProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerStringProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -153,9 +156,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('sends object as response', function(done) {
 | 
					    it('sends object as response', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback({
 | 
					        return callback({
 | 
				
			||||||
          data: text,
 | 
					          data: text,
 | 
				
			||||||
          mimeType: 'text/html'
 | 
					          mimeType: 'text/html'
 | 
				
			||||||
| 
						 | 
					@ -177,9 +180,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('fails when sending object other than string', function(done) {
 | 
					    return it('fails when sending object other than string', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(new Date);
 | 
					        return callback(new Date);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -199,12 +202,12 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.registerBufferProtocol', function() {
 | 
					  describe('protocol.registerBufferProtocol', function() {
 | 
				
			||||||
    var buffer;
 | 
					    var buffer = new Buffer(text);
 | 
				
			||||||
    buffer = new Buffer(text);
 | 
					
 | 
				
			||||||
    it('sends Buffer as response', function(done) {
 | 
					    it('sends Buffer as response', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(buffer);
 | 
					        return callback(buffer);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -223,11 +226,12 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('sets Access-Control-Allow-Origin', function(done) {
 | 
					    it('sets Access-Control-Allow-Origin', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(buffer);
 | 
					        return callback(buffer);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
        if (error) {
 | 
					        if (error) {
 | 
				
			||||||
          return done(error);
 | 
					          return done(error);
 | 
				
			||||||
| 
						 | 
					@ -245,9 +249,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('sends object as response', function(done) {
 | 
					    it('sends object as response', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback({
 | 
					        return callback({
 | 
				
			||||||
          data: buffer,
 | 
					          data: buffer,
 | 
				
			||||||
          mimeType: 'text/html'
 | 
					          mimeType: 'text/html'
 | 
				
			||||||
| 
						 | 
					@ -269,9 +273,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('fails when sending string', function(done) {
 | 
					    return it('fails when sending string', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(text);
 | 
					        return callback(text);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -291,15 +295,15 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.registerFileProtocol', function() {
 | 
					  describe('protocol.registerFileProtocol', function() {
 | 
				
			||||||
    var fileContent, filePath, normalContent, normalPath;
 | 
					    var filePath = path.join(__dirname, 'fixtures', 'asar', 'a.asar', 'file1');
 | 
				
			||||||
    filePath = path.join(__dirname, 'fixtures', 'asar', 'a.asar', 'file1');
 | 
					    var fileContent = require('fs').readFileSync(filePath);
 | 
				
			||||||
    fileContent = require('fs').readFileSync(filePath);
 | 
					    var normalPath = path.join(__dirname, 'fixtures', 'pages', 'a.html');
 | 
				
			||||||
    normalPath = path.join(__dirname, 'fixtures', 'pages', 'a.html');
 | 
					    var normalContent = require('fs').readFileSync(normalPath);
 | 
				
			||||||
    normalContent = require('fs').readFileSync(normalPath);
 | 
					
 | 
				
			||||||
    it('sends file path as response', function(done) {
 | 
					    it('sends file path as response', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(filePath);
 | 
					        return callback(filePath);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerFileProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerFileProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -318,9 +322,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('sets Access-Control-Allow-Origin', function(done) {
 | 
					    it('sets Access-Control-Allow-Origin', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(filePath);
 | 
					        return callback(filePath);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerFileProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerFileProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -363,11 +367,12 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can send normal file', function(done) {
 | 
					    it('can send normal file', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(normalPath);
 | 
					        return callback(normalPath);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return protocol.registerFileProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerFileProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
        if (error) {
 | 
					        if (error) {
 | 
				
			||||||
          return done(error);
 | 
					          return done(error);
 | 
				
			||||||
| 
						 | 
					@ -384,10 +389,10 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('fails when sending unexist-file', function(done) {
 | 
					    it('fails when sending unexist-file', function(done) {
 | 
				
			||||||
      var fakeFilePath, handler;
 | 
					      var fakeFilePath = path.join(__dirname, 'fixtures', 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
      fakeFilePath = path.join(__dirname, 'fixtures', 'asar', 'a.asar', 'not-exist');
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(fakeFilePath);
 | 
					        return callback(fakeFilePath);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -406,9 +411,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('fails when sending unsupported content', function(done) {
 | 
					    return it('fails when sending unsupported content', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(new Date);
 | 
					        return callback(new Date);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerBufferProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -428,10 +433,10 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.registerHttpProtocol', function() {
 | 
					  describe('protocol.registerHttpProtocol', function() {
 | 
				
			||||||
    it('sends url as response', function(done) {
 | 
					    it('sends url as response', function(done) {
 | 
				
			||||||
      var server;
 | 
					      var server = http.createServer(function(req, res) {
 | 
				
			||||||
      server = http.createServer(function(req, res) {
 | 
					 | 
				
			||||||
        assert.notEqual(req.headers.accept, '');
 | 
					        assert.notEqual(req.headers.accept, '');
 | 
				
			||||||
        res.end(text);
 | 
					        res.end(text);
 | 
				
			||||||
        return server.close();
 | 
					        return server.close();
 | 
				
			||||||
| 
						 | 
					@ -462,9 +467,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('fails when sending invalid url', function(done) {
 | 
					    it('fails when sending invalid url', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback({
 | 
					        return callback({
 | 
				
			||||||
          url: 'url'
 | 
					          url: 'url'
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
| 
						 | 
					@ -485,9 +490,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('fails when sending unsupported content', function(done) {
 | 
					    return it('fails when sending unsupported content', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(new Date);
 | 
					        return callback(new Date);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerHttpProtocol(protocolName, handler, function(error) {
 | 
					      return protocol.registerHttpProtocol(protocolName, handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -507,6 +512,7 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.isProtocolHandled', function() {
 | 
					  describe('protocol.isProtocolHandled', function() {
 | 
				
			||||||
    it('returns true for file:', function(done) {
 | 
					    it('returns true for file:', function(done) {
 | 
				
			||||||
      return protocol.isProtocolHandled('file', function(result) {
 | 
					      return protocol.isProtocolHandled('file', function(result) {
 | 
				
			||||||
| 
						 | 
					@ -514,27 +520,30 @@ describe('protocol module', function() {
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('returns true for http:', function(done) {
 | 
					    it('returns true for http:', function(done) {
 | 
				
			||||||
      return protocol.isProtocolHandled('http', function(result) {
 | 
					      return protocol.isProtocolHandled('http', function(result) {
 | 
				
			||||||
        assert.equal(result, true);
 | 
					        assert.equal(result, true);
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('returns true for https:', function(done) {
 | 
					    it('returns true for https:', function(done) {
 | 
				
			||||||
      return protocol.isProtocolHandled('https', function(result) {
 | 
					      return protocol.isProtocolHandled('https', function(result) {
 | 
				
			||||||
        assert.equal(result, true);
 | 
					        assert.equal(result, true);
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('returns false when scheme is not registred', function(done) {
 | 
					    it('returns false when scheme is not registred', function(done) {
 | 
				
			||||||
      return protocol.isProtocolHandled('no-exist', function(result) {
 | 
					      return protocol.isProtocolHandled('no-exist', function(result) {
 | 
				
			||||||
        assert.equal(result, false);
 | 
					        assert.equal(result, false);
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('returns true for custom protocol', function(done) {
 | 
					    it('returns true for custom protocol', function(done) {
 | 
				
			||||||
      var emptyHandler;
 | 
					      var emptyHandler = function(request, callback) {
 | 
				
			||||||
      emptyHandler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback();
 | 
					        return callback();
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.registerStringProtocol(protocolName, emptyHandler, function(error) {
 | 
					      return protocol.registerStringProtocol(protocolName, emptyHandler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -545,9 +554,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('returns true for intercepted protocol', function(done) {
 | 
					    return it('returns true for intercepted protocol', function(done) {
 | 
				
			||||||
      var emptyHandler;
 | 
					      var emptyHandler = function(request, callback) {
 | 
				
			||||||
      emptyHandler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback();
 | 
					        return callback();
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.interceptStringProtocol('http', emptyHandler, function(error) {
 | 
					      return protocol.interceptStringProtocol('http', emptyHandler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -559,11 +568,12 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.intercept(Any)Protocol', function() {
 | 
					  describe('protocol.intercept(Any)Protocol', function() {
 | 
				
			||||||
    var emptyHandler;
 | 
					    var emptyHandler = function(request, callback) {
 | 
				
			||||||
    emptyHandler = function(request, callback) {
 | 
					 | 
				
			||||||
      return callback();
 | 
					      return callback();
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('throws error when scheme is already intercepted', function(done) {
 | 
					    it('throws error when scheme is already intercepted', function(done) {
 | 
				
			||||||
      return protocol.interceptStringProtocol('http', emptyHandler, function(error) {
 | 
					      return protocol.interceptStringProtocol('http', emptyHandler, function(error) {
 | 
				
			||||||
        assert.equal(error, null);
 | 
					        assert.equal(error, null);
 | 
				
			||||||
| 
						 | 
					@ -573,9 +583,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('does not crash when handler is called twice', function(done) {
 | 
					    it('does not crash when handler is called twice', function(done) {
 | 
				
			||||||
      var doubleHandler;
 | 
					      var doubleHandler = function(request, callback) {
 | 
				
			||||||
      doubleHandler = function(request, callback) {
 | 
					 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
          callback(text);
 | 
					          callback(text);
 | 
				
			||||||
          return callback();
 | 
					          return callback();
 | 
				
			||||||
| 
						 | 
					@ -599,6 +609,7 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('sends error when callback is called with nothing', function(done) {
 | 
					    return it('sends error when callback is called with nothing', function(done) {
 | 
				
			||||||
      if (process.env.TRAVIS === 'true') {
 | 
					      if (process.env.TRAVIS === 'true') {
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
| 
						 | 
					@ -620,10 +631,10 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.interceptStringProtocol', function() {
 | 
					  describe('protocol.interceptStringProtocol', function() {
 | 
				
			||||||
    it('can intercept http protocol', function(done) {
 | 
					    it('can intercept http protocol', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(text);
 | 
					        return callback(text);
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.interceptStringProtocol('http', handler, function(error) {
 | 
					      return protocol.interceptStringProtocol('http', handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -642,9 +653,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can set content-type', function(done) {
 | 
					    it('can set content-type', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback({
 | 
					        return callback({
 | 
				
			||||||
          mimeType: 'application/json',
 | 
					          mimeType: 'application/json',
 | 
				
			||||||
          data: '{"value": 1}'
 | 
					          data: '{"value": 1}'
 | 
				
			||||||
| 
						 | 
					@ -667,9 +678,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('can receive post data', function(done) {
 | 
					    return it('can receive post data', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        var uploadData;
 | 
					        var uploadData;
 | 
				
			||||||
        uploadData = request.uploadData[0].bytes.toString();
 | 
					        uploadData = request.uploadData[0].bytes.toString();
 | 
				
			||||||
        return callback({
 | 
					        return callback({
 | 
				
			||||||
| 
						 | 
					@ -695,10 +706,10 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.interceptBufferProtocol', function() {
 | 
					  describe('protocol.interceptBufferProtocol', function() {
 | 
				
			||||||
    it('can intercept http protocol', function(done) {
 | 
					    it('can intercept http protocol', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        return callback(new Buffer(text));
 | 
					        return callback(new Buffer(text));
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return protocol.interceptBufferProtocol('http', handler, function(error) {
 | 
					      return protocol.interceptBufferProtocol('http', handler, function(error) {
 | 
				
			||||||
| 
						 | 
					@ -717,9 +728,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('can receive post data', function(done) {
 | 
					    return it('can receive post data', function(done) {
 | 
				
			||||||
      var handler;
 | 
					      var handler = function(request, callback) {
 | 
				
			||||||
      handler = function(request, callback) {
 | 
					 | 
				
			||||||
        var uploadData;
 | 
					        var uploadData;
 | 
				
			||||||
        uploadData = request.uploadData[0].bytes;
 | 
					        uploadData = request.uploadData[0].bytes;
 | 
				
			||||||
        return callback(uploadData);
 | 
					        return callback(uploadData);
 | 
				
			||||||
| 
						 | 
					@ -743,10 +754,10 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('protocol.interceptHttpProtocol', function() {
 | 
					  describe('protocol.interceptHttpProtocol', function() {
 | 
				
			||||||
    return it('can send POST request', function(done) {
 | 
					    return it('can send POST request', function(done) {
 | 
				
			||||||
      var server;
 | 
					      var server = http.createServer(function(req, res) {
 | 
				
			||||||
      server = http.createServer(function(req, res) {
 | 
					 | 
				
			||||||
        var body;
 | 
					        var body;
 | 
				
			||||||
        body = '';
 | 
					        body = '';
 | 
				
			||||||
        req.on('data', function(chunk) {
 | 
					        req.on('data', function(chunk) {
 | 
				
			||||||
| 
						 | 
					@ -758,10 +769,9 @@ describe('protocol module', function() {
 | 
				
			||||||
        return server.close();
 | 
					        return server.close();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      return server.listen(0, '127.0.0.1', function() {
 | 
					      return server.listen(0, '127.0.0.1', function() {
 | 
				
			||||||
        var handler, port, url;
 | 
					        var port = server.address().port;
 | 
				
			||||||
        port = server.address().port;
 | 
					        var url = "http://127.0.0.1:" + port;
 | 
				
			||||||
        url = "http://127.0.0.1:" + port;
 | 
					        var handler = function(request, callback) {
 | 
				
			||||||
        handler = function(request, callback) {
 | 
					 | 
				
			||||||
          var data;
 | 
					          var data;
 | 
				
			||||||
          data = {
 | 
					          data = {
 | 
				
			||||||
            url: url,
 | 
					            url: url,
 | 
				
			||||||
| 
						 | 
					@ -794,6 +804,7 @@ describe('protocol module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('protocol.uninterceptProtocol', function() {
 | 
					  return describe('protocol.uninterceptProtocol', function() {
 | 
				
			||||||
    it('returns error when scheme does not exist', function(done) {
 | 
					    it('returns error when scheme does not exist', function(done) {
 | 
				
			||||||
      return protocol.uninterceptProtocol('not-exist', function(error) {
 | 
					      return protocol.uninterceptProtocol('not-exist', function(error) {
 | 
				
			||||||
| 
						 | 
					@ -801,6 +812,7 @@ describe('protocol module', function() {
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('returns error when scheme is not intercepted', function(done) {
 | 
					    return it('returns error when scheme is not intercepted', function(done) {
 | 
				
			||||||
      return protocol.uninterceptProtocol('http', function(error) {
 | 
					      return protocol.uninterceptProtocol('http', function(error) {
 | 
				
			||||||
        assert.notEqual(error, null);
 | 
					        assert.notEqual(error, null);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,16 +4,15 @@ const screen = require('electron').screen;
 | 
				
			||||||
describe('screen module', function() {
 | 
					describe('screen module', function() {
 | 
				
			||||||
  describe('screen.getCursorScreenPoint()', function() {
 | 
					  describe('screen.getCursorScreenPoint()', function() {
 | 
				
			||||||
    return it('returns a point object', function() {
 | 
					    return it('returns a point object', function() {
 | 
				
			||||||
      var point;
 | 
					      var point = screen.getCursorScreenPoint();
 | 
				
			||||||
      point = screen.getCursorScreenPoint();
 | 
					 | 
				
			||||||
      assert.equal(typeof point.x, 'number');
 | 
					      assert.equal(typeof point.x, 'number');
 | 
				
			||||||
      return assert.equal(typeof point.y, 'number');
 | 
					      return assert.equal(typeof point.y, 'number');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('screen.getPrimaryDisplay()', function() {
 | 
					  return describe('screen.getPrimaryDisplay()', function() {
 | 
				
			||||||
    return it('returns a display object', function() {
 | 
					    return it('returns a display object', function() {
 | 
				
			||||||
      var display;
 | 
					      var display = screen.getPrimaryDisplay();
 | 
				
			||||||
      display = screen.getPrimaryDisplay();
 | 
					 | 
				
			||||||
      assert.equal(typeof display.scaleFactor, 'number');
 | 
					      assert.equal(typeof display.scaleFactor, 'number');
 | 
				
			||||||
      assert(display.size.width > 0);
 | 
					      assert(display.size.width > 0);
 | 
				
			||||||
      return assert(display.size.height > 0);
 | 
					      return assert(display.size.height > 0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,11 +11,12 @@ const session = remote.session;
 | 
				
			||||||
const BrowserWindow = remote.BrowserWindow;
 | 
					const BrowserWindow = remote.BrowserWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('session module', function() {
 | 
					describe('session module', function() {
 | 
				
			||||||
  var fixtures, url, w;
 | 
					 | 
				
			||||||
  this.timeout(10000);
 | 
					  this.timeout(10000);
 | 
				
			||||||
  fixtures = path.resolve(__dirname, 'fixtures');
 | 
					
 | 
				
			||||||
  w = null;
 | 
					  var fixtures = path.resolve(__dirname, 'fixtures');
 | 
				
			||||||
  url = "http://127.0.0.1";
 | 
					  var w = null;
 | 
				
			||||||
 | 
					  var url = "http://127.0.0.1";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(function() {
 | 
					  beforeEach(function() {
 | 
				
			||||||
    return w = new BrowserWindow({
 | 
					    return w = new BrowserWindow({
 | 
				
			||||||
      show: false,
 | 
					      show: false,
 | 
				
			||||||
| 
						 | 
					@ -23,6 +24,7 @@ describe('session module', function() {
 | 
				
			||||||
      height: 400
 | 
					      height: 400
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(function() {
 | 
					  afterEach(function() {
 | 
				
			||||||
    return w.destroy();
 | 
					    return w.destroy();
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
| 
						 | 
					@ -62,6 +64,7 @@ describe('session module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('should over-write the existent cookie', function(done) {
 | 
					    it('should over-write the existent cookie', function(done) {
 | 
				
			||||||
      return session.defaultSession.cookies.set({
 | 
					      return session.defaultSession.cookies.set({
 | 
				
			||||||
        url: url,
 | 
					        url: url,
 | 
				
			||||||
| 
						 | 
					@ -92,6 +95,7 @@ describe('session module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('should remove cookies', function(done) {
 | 
					    it('should remove cookies', function(done) {
 | 
				
			||||||
      return session.defaultSession.cookies.set({
 | 
					      return session.defaultSession.cookies.set({
 | 
				
			||||||
        url: url,
 | 
					        url: url,
 | 
				
			||||||
| 
						 | 
					@ -155,6 +159,7 @@ describe('session module', function() {
 | 
				
			||||||
        height: 400
 | 
					        height: 400
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return w.destroy();
 | 
					      return w.destroy();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
| 
						 | 
					@ -213,6 +218,7 @@ describe('session module', function() {
 | 
				
			||||||
      assert(fs.existsSync(downloadFilePath));
 | 
					      assert(fs.existsSync(downloadFilePath));
 | 
				
			||||||
      return fs.unlinkSync(downloadFilePath);
 | 
					      return fs.unlinkSync(downloadFilePath);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can download using BrowserWindow.loadURL', function(done) {
 | 
					    it('can download using BrowserWindow.loadURL', function(done) {
 | 
				
			||||||
      return downloadServer.listen(0, '127.0.0.1', function() {
 | 
					      return downloadServer.listen(0, '127.0.0.1', function() {
 | 
				
			||||||
        var port;
 | 
					        var port;
 | 
				
			||||||
| 
						 | 
					@ -225,6 +231,7 @@ describe('session module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can download using WebView.downloadURL', function(done) {
 | 
					    it('can download using WebView.downloadURL', function(done) {
 | 
				
			||||||
      return downloadServer.listen(0, '127.0.0.1', function() {
 | 
					      return downloadServer.listen(0, '127.0.0.1', function() {
 | 
				
			||||||
        var port, webview;
 | 
					        var port, webview;
 | 
				
			||||||
| 
						 | 
					@ -243,6 +250,7 @@ describe('session module', function() {
 | 
				
			||||||
        return document.body.appendChild(webview);
 | 
					        return document.body.appendChild(webview);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can cancel download', function(done) {
 | 
					    it('can cancel download', function(done) {
 | 
				
			||||||
      return downloadServer.listen(0, '127.0.0.1', function() {
 | 
					      return downloadServer.listen(0, '127.0.0.1', function() {
 | 
				
			||||||
        var port;
 | 
					        var port;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,13 +3,11 @@ const path = require('path');
 | 
				
			||||||
const webFrame = require('electron').webFrame;
 | 
					const webFrame = require('electron').webFrame;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('webFrame module', function() {
 | 
					describe('webFrame module', function() {
 | 
				
			||||||
  var fixtures;
 | 
					  var fixtures = path.resolve(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.resolve(__dirname, 'fixtures');
 | 
					 | 
				
			||||||
  return describe('webFrame.registerURLSchemeAsPrivileged', function() {
 | 
					  return describe('webFrame.registerURLSchemeAsPrivileged', function() {
 | 
				
			||||||
    return it('supports fetch api', function(done) {
 | 
					    return it('supports fetch api', function(done) {
 | 
				
			||||||
      var url;
 | 
					 | 
				
			||||||
      webFrame.registerURLSchemeAsPrivileged('file');
 | 
					      webFrame.registerURLSchemeAsPrivileged('file');
 | 
				
			||||||
      url = "file://" + fixtures + "/assets/logo.png";
 | 
					      var url = "file://" + fixtures + "/assets/logo.png";
 | 
				
			||||||
      return fetch(url).then(function(response) {
 | 
					      return fetch(url).then(function(response) {
 | 
				
			||||||
        assert(response.ok);
 | 
					        assert(response.ok);
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,9 +5,8 @@ const remote = require('electron').remote;
 | 
				
			||||||
const session = remote.session;
 | 
					const session = remote.session;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('webRequest module', function() {
 | 
					describe('webRequest module', function() {
 | 
				
			||||||
  var defaultURL, server, ses;
 | 
					  var ses = session.defaultSession;
 | 
				
			||||||
  ses = session.defaultSession;
 | 
					  var server = http.createServer(function(req, res) {
 | 
				
			||||||
  server = http.createServer(function(req, res) {
 | 
					 | 
				
			||||||
    var content;
 | 
					    var content;
 | 
				
			||||||
    res.setHeader('Custom', ['Header']);
 | 
					    res.setHeader('Custom', ['Header']);
 | 
				
			||||||
    content = req.url;
 | 
					    content = req.url;
 | 
				
			||||||
| 
						 | 
					@ -16,7 +15,8 @@ describe('webRequest module', function() {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return res.end(content);
 | 
					    return res.end(content);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  defaultURL = null;
 | 
					  var defaultURL = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  before(function(done) {
 | 
					  before(function(done) {
 | 
				
			||||||
    return server.listen(0, '127.0.0.1', function() {
 | 
					    return server.listen(0, '127.0.0.1', function() {
 | 
				
			||||||
      var port;
 | 
					      var port;
 | 
				
			||||||
| 
						 | 
					@ -25,13 +25,16 @@ describe('webRequest module', function() {
 | 
				
			||||||
      return done();
 | 
					      return done();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  after(function() {
 | 
					  after(function() {
 | 
				
			||||||
    return server.close();
 | 
					    return server.close();
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('webRequest.onBeforeRequest', function() {
 | 
					  describe('webRequest.onBeforeRequest', function() {
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return ses.webRequest.onBeforeRequest(null);
 | 
					      return ses.webRequest.onBeforeRequest(null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can cancel the request', function(done) {
 | 
					    it('can cancel the request', function(done) {
 | 
				
			||||||
      ses.webRequest.onBeforeRequest(function(details, callback) {
 | 
					      ses.webRequest.onBeforeRequest(function(details, callback) {
 | 
				
			||||||
        return callback({
 | 
					        return callback({
 | 
				
			||||||
| 
						 | 
					@ -48,9 +51,9 @@ describe('webRequest module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can filter URLs', function(done) {
 | 
					    it('can filter URLs', function(done) {
 | 
				
			||||||
      var filter;
 | 
					      var filter = {
 | 
				
			||||||
      filter = {
 | 
					 | 
				
			||||||
        urls: [defaultURL + "filter/*"]
 | 
					        urls: [defaultURL + "filter/*"]
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      ses.webRequest.onBeforeRequest(filter, function(details, callback) {
 | 
					      ses.webRequest.onBeforeRequest(filter, function(details, callback) {
 | 
				
			||||||
| 
						 | 
					@ -77,6 +80,7 @@ describe('webRequest module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('receives details object', function(done) {
 | 
					    it('receives details object', function(done) {
 | 
				
			||||||
      ses.webRequest.onBeforeRequest(function(details, callback) {
 | 
					      ses.webRequest.onBeforeRequest(function(details, callback) {
 | 
				
			||||||
        assert.equal(typeof details.id, 'number');
 | 
					        assert.equal(typeof details.id, 'number');
 | 
				
			||||||
| 
						 | 
					@ -98,6 +102,7 @@ describe('webRequest module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('receives post data in details object', function(done) {
 | 
					    it('receives post data in details object', function(done) {
 | 
				
			||||||
      var postData = {
 | 
					      var postData = {
 | 
				
			||||||
        name: 'post test',
 | 
					        name: 'post test',
 | 
				
			||||||
| 
						 | 
					@ -125,6 +130,7 @@ describe('webRequest module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('can redirect the request', function(done) {
 | 
					    return it('can redirect the request', function(done) {
 | 
				
			||||||
      ses.webRequest.onBeforeRequest(function(details, callback) {
 | 
					      ses.webRequest.onBeforeRequest(function(details, callback) {
 | 
				
			||||||
        if (details.url === defaultURL) {
 | 
					        if (details.url === defaultURL) {
 | 
				
			||||||
| 
						 | 
					@ -147,10 +153,12 @@ describe('webRequest module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('webRequest.onBeforeSendHeaders', function() {
 | 
					  describe('webRequest.onBeforeSendHeaders', function() {
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return ses.webRequest.onBeforeSendHeaders(null);
 | 
					      return ses.webRequest.onBeforeSendHeaders(null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('receives details object', function(done) {
 | 
					    it('receives details object', function(done) {
 | 
				
			||||||
      ses.webRequest.onBeforeSendHeaders(function(details, callback) {
 | 
					      ses.webRequest.onBeforeSendHeaders(function(details, callback) {
 | 
				
			||||||
        assert.equal(typeof details.requestHeaders, 'object');
 | 
					        assert.equal(typeof details.requestHeaders, 'object');
 | 
				
			||||||
| 
						 | 
					@ -167,6 +175,7 @@ describe('webRequest module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can change the request headers', function(done) {
 | 
					    it('can change the request headers', function(done) {
 | 
				
			||||||
      ses.webRequest.onBeforeSendHeaders(function(details, callback) {
 | 
					      ses.webRequest.onBeforeSendHeaders(function(details, callback) {
 | 
				
			||||||
        var requestHeaders;
 | 
					        var requestHeaders;
 | 
				
			||||||
| 
						 | 
					@ -187,6 +196,7 @@ describe('webRequest module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('resets the whole headers', function(done) {
 | 
					    return it('resets the whole headers', function(done) {
 | 
				
			||||||
      var requestHeaders;
 | 
					      var requestHeaders;
 | 
				
			||||||
      requestHeaders = {
 | 
					      requestHeaders = {
 | 
				
			||||||
| 
						 | 
					@ -209,10 +219,12 @@ describe('webRequest module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('webRequest.onSendHeaders', function() {
 | 
					  describe('webRequest.onSendHeaders', function() {
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return ses.webRequest.onSendHeaders(null);
 | 
					      return ses.webRequest.onSendHeaders(null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('receives details object', function(done) {
 | 
					    return it('receives details object', function(done) {
 | 
				
			||||||
      ses.webRequest.onSendHeaders(function(details) {
 | 
					      ses.webRequest.onSendHeaders(function(details) {
 | 
				
			||||||
        return assert.equal(typeof details.requestHeaders, 'object');
 | 
					        return assert.equal(typeof details.requestHeaders, 'object');
 | 
				
			||||||
| 
						 | 
					@ -229,10 +241,12 @@ describe('webRequest module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('webRequest.onHeadersReceived', function() {
 | 
					  describe('webRequest.onHeadersReceived', function() {
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return ses.webRequest.onHeadersReceived(null);
 | 
					      return ses.webRequest.onHeadersReceived(null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('receives details object', function(done) {
 | 
					    it('receives details object', function(done) {
 | 
				
			||||||
      ses.webRequest.onHeadersReceived(function(details, callback) {
 | 
					      ses.webRequest.onHeadersReceived(function(details, callback) {
 | 
				
			||||||
        assert.equal(details.statusLine, 'HTTP/1.1 200 OK');
 | 
					        assert.equal(details.statusLine, 'HTTP/1.1 200 OK');
 | 
				
			||||||
| 
						 | 
					@ -251,6 +265,7 @@ describe('webRequest module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can change the response header', function(done) {
 | 
					    it('can change the response header', function(done) {
 | 
				
			||||||
      ses.webRequest.onHeadersReceived(function(details, callback) {
 | 
					      ses.webRequest.onHeadersReceived(function(details, callback) {
 | 
				
			||||||
        var responseHeaders;
 | 
					        var responseHeaders;
 | 
				
			||||||
| 
						 | 
					@ -272,6 +287,7 @@ describe('webRequest module', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('does not change header by default', function(done) {
 | 
					    return it('does not change header by default', function(done) {
 | 
				
			||||||
      ses.webRequest.onHeadersReceived(function(details, callback) {
 | 
					      ses.webRequest.onHeadersReceived(function(details, callback) {
 | 
				
			||||||
        return callback({});
 | 
					        return callback({});
 | 
				
			||||||
| 
						 | 
					@ -289,10 +305,12 @@ describe('webRequest module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('webRequest.onResponseStarted', function() {
 | 
					  describe('webRequest.onResponseStarted', function() {
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return ses.webRequest.onResponseStarted(null);
 | 
					      return ses.webRequest.onResponseStarted(null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('receives details object', function(done) {
 | 
					    return it('receives details object', function(done) {
 | 
				
			||||||
      ses.webRequest.onResponseStarted(function(details) {
 | 
					      ses.webRequest.onResponseStarted(function(details) {
 | 
				
			||||||
        assert.equal(typeof details.fromCache, 'boolean');
 | 
					        assert.equal(typeof details.fromCache, 'boolean');
 | 
				
			||||||
| 
						 | 
					@ -313,11 +331,13 @@ describe('webRequest module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('webRequest.onBeforeRedirect', function() {
 | 
					  describe('webRequest.onBeforeRedirect', function() {
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      ses.webRequest.onBeforeRedirect(null);
 | 
					      ses.webRequest.onBeforeRedirect(null);
 | 
				
			||||||
      return ses.webRequest.onBeforeRequest(null);
 | 
					      return ses.webRequest.onBeforeRequest(null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('receives details object', function(done) {
 | 
					    return it('receives details object', function(done) {
 | 
				
			||||||
      var redirectURL;
 | 
					      var redirectURL;
 | 
				
			||||||
      redirectURL = defaultURL + "redirect";
 | 
					      redirectURL = defaultURL + "redirect";
 | 
				
			||||||
| 
						 | 
					@ -348,10 +368,12 @@ describe('webRequest module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('webRequest.onCompleted', function() {
 | 
					  describe('webRequest.onCompleted', function() {
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return ses.webRequest.onCompleted(null);
 | 
					      return ses.webRequest.onCompleted(null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('receives details object', function(done) {
 | 
					    return it('receives details object', function(done) {
 | 
				
			||||||
      ses.webRequest.onCompleted(function(details) {
 | 
					      ses.webRequest.onCompleted(function(details) {
 | 
				
			||||||
        assert.equal(typeof details.fromCache, 'boolean');
 | 
					        assert.equal(typeof details.fromCache, 'boolean');
 | 
				
			||||||
| 
						 | 
					@ -370,11 +392,13 @@ describe('webRequest module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('webRequest.onErrorOccurred', function() {
 | 
					  return describe('webRequest.onErrorOccurred', function() {
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      ses.webRequest.onErrorOccurred(null);
 | 
					      ses.webRequest.onErrorOccurred(null);
 | 
				
			||||||
      return ses.webRequest.onBeforeRequest(null);
 | 
					      return ses.webRequest.onBeforeRequest(null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('receives details object', function(done) {
 | 
					    return it('receives details object', function(done) {
 | 
				
			||||||
      ses.webRequest.onBeforeRequest(function(details, callback) {
 | 
					      ses.webRequest.onBeforeRequest(function(details, callback) {
 | 
				
			||||||
        return callback({
 | 
					        return callback({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,8 +10,8 @@ const ipcMain = remote.require('electron').ipcMain;
 | 
				
			||||||
const BrowserWindow = remote.require('electron').BrowserWindow;
 | 
					const BrowserWindow = remote.require('electron').BrowserWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('asar package', function() {
 | 
					describe('asar package', function() {
 | 
				
			||||||
  var fixtures;
 | 
					  var fixtures = path.join(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.join(__dirname, 'fixtures');
 | 
					
 | 
				
			||||||
  describe('node api', function() {
 | 
					  describe('node api', function() {
 | 
				
			||||||
    describe('fs.readFileSync', function() {
 | 
					    describe('fs.readFileSync', function() {
 | 
				
			||||||
      it('does not leak fd', function() {
 | 
					      it('does not leak fd', function() {
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,7 @@ describe('asar package', function() {
 | 
				
			||||||
          readCalls++;
 | 
					          readCalls++;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads a normal file', function() {
 | 
					      it('reads a normal file', function() {
 | 
				
			||||||
        var file1, file2, file3;
 | 
					        var file1, file2, file3;
 | 
				
			||||||
        file1 = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
					        file1 = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
				
			||||||
| 
						 | 
					@ -30,6 +31,7 @@ describe('asar package', function() {
 | 
				
			||||||
        file3 = path.join(fixtures, 'asar', 'a.asar', 'file3');
 | 
					        file3 = path.join(fixtures, 'asar', 'a.asar', 'file3');
 | 
				
			||||||
        return assert.equal(fs.readFileSync(file3).toString().trim(), 'file3');
 | 
					        return assert.equal(fs.readFileSync(file3).toString().trim(), 'file3');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads from a empty file', function() {
 | 
					      it('reads from a empty file', function() {
 | 
				
			||||||
        var buffer, file;
 | 
					        var buffer, file;
 | 
				
			||||||
        file = path.join(fixtures, 'asar', 'empty.asar', 'file1');
 | 
					        file = path.join(fixtures, 'asar', 'empty.asar', 'file1');
 | 
				
			||||||
| 
						 | 
					@ -37,11 +39,13 @@ describe('asar package', function() {
 | 
				
			||||||
        assert.equal(buffer.length, 0);
 | 
					        assert.equal(buffer.length, 0);
 | 
				
			||||||
        return assert.equal(buffer.toString(), '');
 | 
					        return assert.equal(buffer.toString(), '');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads a linked file', function() {
 | 
					      it('reads a linked file', function() {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'link1');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar', 'link1');
 | 
				
			||||||
        return assert.equal(fs.readFileSync(p).toString().trim(), 'file1');
 | 
					        return assert.equal(fs.readFileSync(p).toString().trim(), 'file1');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads a file from linked directory', function() {
 | 
					      it('reads a file from linked directory', function() {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'file1');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'file1');
 | 
				
			||||||
| 
						 | 
					@ -49,6 +53,7 @@ describe('asar package', function() {
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2', 'file1');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2', 'file1');
 | 
				
			||||||
        return assert.equal(fs.readFileSync(p).toString().trim(), 'file1');
 | 
					        return assert.equal(fs.readFileSync(p).toString().trim(), 'file1');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('throws ENOENT error when can not find file', function() {
 | 
					      it('throws ENOENT error when can not find file', function() {
 | 
				
			||||||
        var p, throws;
 | 
					        var p, throws;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
| 
						 | 
					@ -57,6 +62,7 @@ describe('asar package', function() {
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        return assert.throws(throws, /ENOENT/);
 | 
					        return assert.throws(throws, /ENOENT/);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('passes ENOENT error to callback when can not find file', function() {
 | 
					      it('passes ENOENT error to callback when can not find file', function() {
 | 
				
			||||||
        var async, p;
 | 
					        var async, p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
| 
						 | 
					@ -67,12 +73,14 @@ describe('asar package', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return async = true;
 | 
					        return async = true;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('reads a normal file with unpacked files', function() {
 | 
					      return it('reads a normal file with unpacked files', function() {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'unpack.asar', 'a.txt');
 | 
					        p = path.join(fixtures, 'asar', 'unpack.asar', 'a.txt');
 | 
				
			||||||
        return assert.equal(fs.readFileSync(p).toString().trim(), 'a');
 | 
					        return assert.equal(fs.readFileSync(p).toString().trim(), 'a');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.readFile', function() {
 | 
					    describe('fs.readFile', function() {
 | 
				
			||||||
      it('reads a normal file', function(done) {
 | 
					      it('reads a normal file', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
| 
						 | 
					@ -83,6 +91,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads from a empty file', function(done) {
 | 
					      it('reads from a empty file', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'empty.asar', 'file1');
 | 
					        p = path.join(fixtures, 'asar', 'empty.asar', 'file1');
 | 
				
			||||||
| 
						 | 
					@ -92,6 +101,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads a linked file', function(done) {
 | 
					      it('reads a linked file', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'link1');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar', 'link1');
 | 
				
			||||||
| 
						 | 
					@ -101,6 +111,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads a file from linked directory', function(done) {
 | 
					      it('reads a file from linked directory', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2', 'file1');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2', 'file1');
 | 
				
			||||||
| 
						 | 
					@ -110,6 +121,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function(done) {
 | 
					      return it('throws ENOENT error when can not find file', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
| 
						 | 
					@ -119,6 +131,7 @@ describe('asar package', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.lstatSync', function() {
 | 
					    describe('fs.lstatSync', function() {
 | 
				
			||||||
      it('handles path with trailing slash correctly', function() {
 | 
					      it('handles path with trailing slash correctly', function() {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
| 
						 | 
					@ -126,6 +139,7 @@ describe('asar package', function() {
 | 
				
			||||||
        fs.lstatSync(p);
 | 
					        fs.lstatSync(p);
 | 
				
			||||||
        return fs.lstatSync(p + '/');
 | 
					        return fs.lstatSync(p + '/');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of root', function() {
 | 
					      it('returns information of root', function() {
 | 
				
			||||||
        var p, stats;
 | 
					        var p, stats;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar');
 | 
					        p = path.join(fixtures, 'asar', 'a.asar');
 | 
				
			||||||
| 
						 | 
					@ -135,6 +149,7 @@ describe('asar package', function() {
 | 
				
			||||||
        assert.equal(stats.isSymbolicLink(), false);
 | 
					        assert.equal(stats.isSymbolicLink(), false);
 | 
				
			||||||
        return assert.equal(stats.size, 0);
 | 
					        return assert.equal(stats.size, 0);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of a normal file', function() {
 | 
					      it('returns information of a normal file', function() {
 | 
				
			||||||
        var file, j, len, p, ref2, results, stats;
 | 
					        var file, j, len, p, ref2, results, stats;
 | 
				
			||||||
        ref2 = ['file1', 'file2', 'file3', path.join('dir1', 'file1'), path.join('link2', 'file1')];
 | 
					        ref2 = ['file1', 'file2', 'file3', path.join('dir1', 'file1'), path.join('link2', 'file1')];
 | 
				
			||||||
| 
						 | 
					@ -150,6 +165,7 @@ describe('asar package', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return results;
 | 
					        return results;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of a normal directory', function() {
 | 
					      it('returns information of a normal directory', function() {
 | 
				
			||||||
        var file, j, len, p, ref2, results, stats;
 | 
					        var file, j, len, p, ref2, results, stats;
 | 
				
			||||||
        ref2 = ['dir1', 'dir2', 'dir3'];
 | 
					        ref2 = ['dir1', 'dir2', 'dir3'];
 | 
				
			||||||
| 
						 | 
					@ -165,6 +181,7 @@ describe('asar package', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return results;
 | 
					        return results;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of a linked file', function() {
 | 
					      it('returns information of a linked file', function() {
 | 
				
			||||||
        var file, j, len, p, ref2, results, stats;
 | 
					        var file, j, len, p, ref2, results, stats;
 | 
				
			||||||
        ref2 = ['link1', path.join('dir1', 'link1'), path.join('link2', 'link2')];
 | 
					        ref2 = ['link1', path.join('dir1', 'link1'), path.join('link2', 'link2')];
 | 
				
			||||||
| 
						 | 
					@ -180,6 +197,7 @@ describe('asar package', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return results;
 | 
					        return results;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of a linked directory', function() {
 | 
					      it('returns information of a linked directory', function() {
 | 
				
			||||||
        var file, j, len, p, ref2, results, stats;
 | 
					        var file, j, len, p, ref2, results, stats;
 | 
				
			||||||
        ref2 = ['link2', path.join('dir1', 'link2'), path.join('link2', 'link2')];
 | 
					        ref2 = ['link2', path.join('dir1', 'link2'), path.join('link2', 'link2')];
 | 
				
			||||||
| 
						 | 
					@ -195,6 +213,7 @@ describe('asar package', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return results;
 | 
					        return results;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function() {
 | 
					      return it('throws ENOENT error when can not find file', function() {
 | 
				
			||||||
        var file, j, len, p, ref2, results, throws;
 | 
					        var file, j, len, p, ref2, results, throws;
 | 
				
			||||||
        ref2 = ['file4', 'file5', path.join('dir1', 'file4')];
 | 
					        ref2 = ['file4', 'file5', path.join('dir1', 'file4')];
 | 
				
			||||||
| 
						 | 
					@ -210,12 +229,13 @@ describe('asar package', function() {
 | 
				
			||||||
        return results;
 | 
					        return results;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.lstat', function() {
 | 
					    describe('fs.lstat', function() {
 | 
				
			||||||
      it('handles path with trailing slash correctly', function(done) {
 | 
					      it('handles path with trailing slash correctly', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2', 'file1');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2', 'file1');
 | 
					 | 
				
			||||||
        return fs.lstat(p + '/', done);
 | 
					        return fs.lstat(p + '/', done);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of root', function(done) {
 | 
					      it('returns information of root', function(done) {
 | 
				
			||||||
        var p = path.join(fixtures, 'asar', 'a.asar');
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar');
 | 
				
			||||||
        fs.lstat(p, function(err, stats) {
 | 
					        fs.lstat(p, function(err, stats) {
 | 
				
			||||||
| 
						 | 
					@ -227,6 +247,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of a normal file', function(done) {
 | 
					      it('returns information of a normal file', function(done) {
 | 
				
			||||||
        var p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'file1');
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'file1');
 | 
				
			||||||
        fs.lstat(p, function(err, stats) {
 | 
					        fs.lstat(p, function(err, stats) {
 | 
				
			||||||
| 
						 | 
					@ -238,6 +259,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of a normal directory', function(done) {
 | 
					      it('returns information of a normal directory', function(done) {
 | 
				
			||||||
        var p = path.join(fixtures, 'asar', 'a.asar', 'dir1');
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'dir1');
 | 
				
			||||||
        fs.lstat(p, function(err, stats) {
 | 
					        fs.lstat(p, function(err, stats) {
 | 
				
			||||||
| 
						 | 
					@ -249,6 +271,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of a linked file', function(done) {
 | 
					      it('returns information of a linked file', function(done) {
 | 
				
			||||||
        var p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link1');
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link1');
 | 
				
			||||||
        fs.lstat(p, function(err, stats) {
 | 
					        fs.lstat(p, function(err, stats) {
 | 
				
			||||||
| 
						 | 
					@ -260,6 +283,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns information of a linked directory', function(done) {
 | 
					      it('returns information of a linked directory', function(done) {
 | 
				
			||||||
        var p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2');
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2');
 | 
				
			||||||
        fs.lstat(p, function(err, stats) {
 | 
					        fs.lstat(p, function(err, stats) {
 | 
				
			||||||
| 
						 | 
					@ -271,6 +295,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function(done) {
 | 
					      return it('throws ENOENT error when can not find file', function(done) {
 | 
				
			||||||
        var p = path.join(fixtures, 'asar', 'a.asar', 'file4');
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'file4');
 | 
				
			||||||
        fs.lstat(p, function(err) {
 | 
					        fs.lstat(p, function(err) {
 | 
				
			||||||
| 
						 | 
					@ -279,97 +304,97 @@ describe('asar package', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.realpathSync', function() {
 | 
					    describe('fs.realpathSync', function() {
 | 
				
			||||||
      it('returns real path root', function() {
 | 
					      it('returns real path root', function() {
 | 
				
			||||||
        var p, parent, r;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = 'a.asar';
 | 
				
			||||||
        p = 'a.asar';
 | 
					        var r = fs.realpathSync(path.join(parent, p));
 | 
				
			||||||
        r = fs.realpathSync(path.join(parent, p));
 | 
					 | 
				
			||||||
        return assert.equal(r, path.join(parent, p));
 | 
					        return assert.equal(r, path.join(parent, p));
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns real path of a normal file', function() {
 | 
					      it('returns real path of a normal file', function() {
 | 
				
			||||||
        var p, parent, r;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'file1');
 | 
				
			||||||
        p = path.join('a.asar', 'file1');
 | 
					        var r = fs.realpathSync(path.join(parent, p));
 | 
				
			||||||
        r = fs.realpathSync(path.join(parent, p));
 | 
					 | 
				
			||||||
        return assert.equal(r, path.join(parent, p));
 | 
					        return assert.equal(r, path.join(parent, p));
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns real path of a normal directory', function() {
 | 
					      it('returns real path of a normal directory', function() {
 | 
				
			||||||
        var p, parent, r;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'dir1');
 | 
				
			||||||
        p = path.join('a.asar', 'dir1');
 | 
					        var r = fs.realpathSync(path.join(parent, p));
 | 
				
			||||||
        r = fs.realpathSync(path.join(parent, p));
 | 
					 | 
				
			||||||
        return assert.equal(r, path.join(parent, p));
 | 
					        return assert.equal(r, path.join(parent, p));
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns real path of a linked file', function() {
 | 
					      it('returns real path of a linked file', function() {
 | 
				
			||||||
        var p, parent, r;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'link2', 'link1');
 | 
				
			||||||
        p = path.join('a.asar', 'link2', 'link1');
 | 
					        var r = fs.realpathSync(path.join(parent, p));
 | 
				
			||||||
        r = fs.realpathSync(path.join(parent, p));
 | 
					 | 
				
			||||||
        return assert.equal(r, path.join(parent, 'a.asar', 'file1'));
 | 
					        return assert.equal(r, path.join(parent, 'a.asar', 'file1'));
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns real path of a linked directory', function() {
 | 
					      it('returns real path of a linked directory', function() {
 | 
				
			||||||
        var p, parent, r;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'link2', 'link2');
 | 
				
			||||||
        p = path.join('a.asar', 'link2', 'link2');
 | 
					        var r = fs.realpathSync(path.join(parent, p));
 | 
				
			||||||
        r = fs.realpathSync(path.join(parent, p));
 | 
					 | 
				
			||||||
        return assert.equal(r, path.join(parent, 'a.asar', 'dir1'));
 | 
					        return assert.equal(r, path.join(parent, 'a.asar', 'dir1'));
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function() {
 | 
					      return it('throws ENOENT error when can not find file', function() {
 | 
				
			||||||
        var p, parent, throws;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'not-exist');
 | 
				
			||||||
        p = path.join('a.asar', 'not-exist');
 | 
					        var throws = function() {
 | 
				
			||||||
        throws = function() {
 | 
					 | 
				
			||||||
          return fs.realpathSync(path.join(parent, p));
 | 
					          return fs.realpathSync(path.join(parent, p));
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        return assert.throws(throws, /ENOENT/);
 | 
					        return assert.throws(throws, /ENOENT/);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.realpath', function() {
 | 
					    describe('fs.realpath', function() {
 | 
				
			||||||
      it('returns real path root', function(done) {
 | 
					      it('returns real path root', function(done) {
 | 
				
			||||||
        var p, parent;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = 'a.asar';
 | 
				
			||||||
        p = 'a.asar';
 | 
					 | 
				
			||||||
        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
					        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
				
			||||||
          assert.equal(err, null);
 | 
					          assert.equal(err, null);
 | 
				
			||||||
          assert.equal(r, path.join(parent, p));
 | 
					          assert.equal(r, path.join(parent, p));
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns real path of a normal file', function(done) {
 | 
					      it('returns real path of a normal file', function(done) {
 | 
				
			||||||
        var p, parent;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'file1');
 | 
				
			||||||
        p = path.join('a.asar', 'file1');
 | 
					 | 
				
			||||||
        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
					        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
				
			||||||
          assert.equal(err, null);
 | 
					          assert.equal(err, null);
 | 
				
			||||||
          assert.equal(r, path.join(parent, p));
 | 
					          assert.equal(r, path.join(parent, p));
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns real path of a normal directory', function(done) {
 | 
					      it('returns real path of a normal directory', function(done) {
 | 
				
			||||||
        var p, parent;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'dir1');
 | 
				
			||||||
        p = path.join('a.asar', 'dir1');
 | 
					 | 
				
			||||||
        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
					        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
				
			||||||
          assert.equal(err, null);
 | 
					          assert.equal(err, null);
 | 
				
			||||||
          assert.equal(r, path.join(parent, p));
 | 
					          assert.equal(r, path.join(parent, p));
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns real path of a linked file', function(done) {
 | 
					      it('returns real path of a linked file', function(done) {
 | 
				
			||||||
        var p, parent;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'link2', 'link1');
 | 
				
			||||||
        p = path.join('a.asar', 'link2', 'link1');
 | 
					 | 
				
			||||||
        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
					        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
				
			||||||
          assert.equal(err, null);
 | 
					          assert.equal(err, null);
 | 
				
			||||||
          assert.equal(r, path.join(parent, 'a.asar', 'file1'));
 | 
					          assert.equal(r, path.join(parent, 'a.asar', 'file1'));
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('returns real path of a linked directory', function(done) {
 | 
					      it('returns real path of a linked directory', function(done) {
 | 
				
			||||||
        var p, parent;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'link2', 'link2');
 | 
				
			||||||
        p = path.join('a.asar', 'link2', 'link2');
 | 
					 | 
				
			||||||
        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
					        return fs.realpath(path.join(parent, p), function(err, r) {
 | 
				
			||||||
          assert.equal(err, null);
 | 
					          assert.equal(err, null);
 | 
				
			||||||
          assert.equal(r, path.join(parent, 'a.asar', 'dir1'));
 | 
					          assert.equal(r, path.join(parent, 'a.asar', 'dir1'));
 | 
				
			||||||
| 
						 | 
					@ -377,9 +402,8 @@ describe('asar package', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function(done) {
 | 
					      return it('throws ENOENT error when can not find file', function(done) {
 | 
				
			||||||
        var p, parent;
 | 
					        var parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
				
			||||||
        parent = fs.realpathSync(path.join(fixtures, 'asar'));
 | 
					        var p = path.join('a.asar', 'not-exist');
 | 
				
			||||||
        p = path.join('a.asar', 'not-exist');
 | 
					 | 
				
			||||||
        return fs.realpath(path.join(parent, p), function(err) {
 | 
					        return fs.realpath(path.join(parent, p), function(err) {
 | 
				
			||||||
          assert.equal(err.code, 'ENOENT');
 | 
					          assert.equal(err.code, 'ENOENT');
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
| 
						 | 
					@ -388,32 +412,32 @@ describe('asar package', function() {
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    describe('fs.readdirSync', function() {
 | 
					    describe('fs.readdirSync', function() {
 | 
				
			||||||
      it('reads dirs from root', function() {
 | 
					      it('reads dirs from root', function() {
 | 
				
			||||||
        var dirs, p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar');
 | 
					        var dirs = fs.readdirSync(p);
 | 
				
			||||||
        dirs = fs.readdirSync(p);
 | 
					 | 
				
			||||||
        return assert.deepEqual(dirs, ['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']);
 | 
					        return assert.deepEqual(dirs, ['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads dirs from a normal dir', function() {
 | 
					      it('reads dirs from a normal dir', function() {
 | 
				
			||||||
        var dirs, p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'dir1');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'dir1');
 | 
					        var dirs = fs.readdirSync(p);
 | 
				
			||||||
        dirs = fs.readdirSync(p);
 | 
					 | 
				
			||||||
        return assert.deepEqual(dirs, ['file1', 'file2', 'file3', 'link1', 'link2']);
 | 
					        return assert.deepEqual(dirs, ['file1', 'file2', 'file3', 'link1', 'link2']);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads dirs from a linked dir', function() {
 | 
					      it('reads dirs from a linked dir', function() {
 | 
				
			||||||
        var dirs, p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'link2', 'link2');
 | 
					        var dirs = fs.readdirSync(p);
 | 
				
			||||||
        dirs = fs.readdirSync(p);
 | 
					 | 
				
			||||||
        return assert.deepEqual(dirs, ['file1', 'file2', 'file3', 'link1', 'link2']);
 | 
					        return assert.deepEqual(dirs, ['file1', 'file2', 'file3', 'link1', 'link2']);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function() {
 | 
					      return it('throws ENOENT error when can not find file', function() {
 | 
				
			||||||
        var p, throws;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					        var throws = function() {
 | 
				
			||||||
        throws = function() {
 | 
					 | 
				
			||||||
          return fs.readdirSync(p);
 | 
					          return fs.readdirSync(p);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        return assert.throws(throws, /ENOENT/);
 | 
					        return assert.throws(throws, /ENOENT/);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.readdir', function() {
 | 
					    describe('fs.readdir', function() {
 | 
				
			||||||
      it('reads dirs from root', function(done) {
 | 
					      it('reads dirs from root', function(done) {
 | 
				
			||||||
        var p = path.join(fixtures, 'asar', 'a.asar');
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar');
 | 
				
			||||||
| 
						 | 
					@ -423,6 +447,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('reads dirs from a normal dir', function(done) {
 | 
					      it('reads dirs from a normal dir', function(done) {
 | 
				
			||||||
        var p = path.join(fixtures, 'asar', 'a.asar', 'dir1');
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'dir1');
 | 
				
			||||||
        fs.readdir(p, function(err, dirs) {
 | 
					        fs.readdir(p, function(err, dirs) {
 | 
				
			||||||
| 
						 | 
					@ -439,15 +464,16 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function(done) {
 | 
					      return it('throws ENOENT error when can not find file', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					 | 
				
			||||||
        return fs.readdir(p, function(err) {
 | 
					        return fs.readdir(p, function(err) {
 | 
				
			||||||
          assert.equal(err.code, 'ENOENT');
 | 
					          assert.equal(err.code, 'ENOENT');
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.openSync', function() {
 | 
					    describe('fs.openSync', function() {
 | 
				
			||||||
      it('opens a normal/linked/under-linked-directory file', function() {
 | 
					      it('opens a normal/linked/under-linked-directory file', function() {
 | 
				
			||||||
        var buffer, fd, file, j, len, p, ref2, results;
 | 
					        var buffer, fd, file, j, len, p, ref2, results;
 | 
				
			||||||
| 
						 | 
					@ -464,19 +490,19 @@ describe('asar package', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return results;
 | 
					        return results;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function() {
 | 
					      return it('throws ENOENT error when can not find file', function() {
 | 
				
			||||||
        var p, throws;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					        var throws = function() {
 | 
				
			||||||
        throws = function() {
 | 
					 | 
				
			||||||
          return fs.openSync(p);
 | 
					          return fs.openSync(p);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        return assert.throws(throws, /ENOENT/);
 | 
					        return assert.throws(throws, /ENOENT/);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.open', function() {
 | 
					    describe('fs.open', function() {
 | 
				
			||||||
      it('opens a normal file', function(done) {
 | 
					      it('opens a normal file', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
					 | 
				
			||||||
        return fs.open(p, 'r', function(err, fd) {
 | 
					        return fs.open(p, 'r', function(err, fd) {
 | 
				
			||||||
          var buffer;
 | 
					          var buffer;
 | 
				
			||||||
          assert.equal(err, null);
 | 
					          assert.equal(err, null);
 | 
				
			||||||
| 
						 | 
					@ -488,48 +514,48 @@ describe('asar package', function() {
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('throws ENOENT error when can not find file', function(done) {
 | 
					      return it('throws ENOENT error when can not find file', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					 | 
				
			||||||
        return fs.open(p, 'r', function(err) {
 | 
					        return fs.open(p, 'r', function(err) {
 | 
				
			||||||
          assert.equal(err.code, 'ENOENT');
 | 
					          assert.equal(err.code, 'ENOENT');
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.mkdir', function() {
 | 
					    describe('fs.mkdir', function() {
 | 
				
			||||||
      return it('throws error when calling inside asar archive', function(done) {
 | 
					      return it('throws error when calling inside asar archive', function(done) {
 | 
				
			||||||
        var p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					 | 
				
			||||||
        return fs.mkdir(p, function(err) {
 | 
					        return fs.mkdir(p, function(err) {
 | 
				
			||||||
          assert.equal(err.code, 'ENOTDIR');
 | 
					          assert.equal(err.code, 'ENOTDIR');
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('fs.mkdirSync', function() {
 | 
					    describe('fs.mkdirSync', function() {
 | 
				
			||||||
      return it('throws error when calling inside asar archive', function() {
 | 
					      return it('throws error when calling inside asar archive', function() {
 | 
				
			||||||
        var p;
 | 
					        var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					 | 
				
			||||||
        return assert.throws((function() {
 | 
					        return assert.throws((function() {
 | 
				
			||||||
          return fs.mkdirSync(p);
 | 
					          return fs.mkdirSync(p);
 | 
				
			||||||
        }), new RegExp('ENOTDIR'));
 | 
					        }), new RegExp('ENOTDIR'));
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('child_process.fork', function() {
 | 
					    describe('child_process.fork', function() {
 | 
				
			||||||
      it('opens a normal js file', function(done) {
 | 
					      it('opens a normal js file', function(done) {
 | 
				
			||||||
        var child;
 | 
					        var child = child_process.fork(path.join(fixtures, 'asar', 'a.asar', 'ping.js'));
 | 
				
			||||||
        child = child_process.fork(path.join(fixtures, 'asar', 'a.asar', 'ping.js'));
 | 
					 | 
				
			||||||
        child.on('message', function(msg) {
 | 
					        child.on('message', function(msg) {
 | 
				
			||||||
          assert.equal(msg, 'message');
 | 
					          assert.equal(msg, 'message');
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return child.send('message');
 | 
					        return child.send('message');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('supports asar in the forked js', function(done) {
 | 
					      return it('supports asar in the forked js', function(done) {
 | 
				
			||||||
        var child, file;
 | 
					        var file = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
				
			||||||
        file = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
					        var child = child_process.fork(path.join(fixtures, 'module', 'asar.js'));
 | 
				
			||||||
        child = child_process.fork(path.join(fixtures, 'module', 'asar.js'));
 | 
					 | 
				
			||||||
        child.on('message', function(content) {
 | 
					        child.on('message', function(content) {
 | 
				
			||||||
          assert.equal(content, fs.readFileSync(file).toString());
 | 
					          assert.equal(content, fs.readFileSync(file).toString());
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
| 
						 | 
					@ -537,6 +563,7 @@ describe('asar package', function() {
 | 
				
			||||||
        return child.send(file);
 | 
					        return child.send(file);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('child_process.execFile', function() {
 | 
					    describe('child_process.execFile', function() {
 | 
				
			||||||
      var echo, execFile, execFileSync, ref2;
 | 
					      var echo, execFile, execFileSync, ref2;
 | 
				
			||||||
      if (process.platform !== 'darwin') {
 | 
					      if (process.platform !== 'darwin') {
 | 
				
			||||||
| 
						 | 
					@ -544,6 +571,7 @@ describe('asar package', function() {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      ref2 = require('child_process'), execFile = ref2.execFile, execFileSync = ref2.execFileSync;
 | 
					      ref2 = require('child_process'), execFile = ref2.execFile, execFileSync = ref2.execFileSync;
 | 
				
			||||||
      echo = path.join(fixtures, 'asar', 'echo.asar', 'echo');
 | 
					      echo = path.join(fixtures, 'asar', 'echo.asar', 'echo');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('executes binaries', function(done) {
 | 
					      it('executes binaries', function(done) {
 | 
				
			||||||
        execFile(echo, ['test'], function(error, stdout) {
 | 
					        execFile(echo, ['test'], function(error, stdout) {
 | 
				
			||||||
          assert.equal(error, null);
 | 
					          assert.equal(error, null);
 | 
				
			||||||
| 
						 | 
					@ -551,15 +579,17 @@ describe('asar package', function() {
 | 
				
			||||||
          return done();
 | 
					          return done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return xit('execFileSync executes binaries', function() {
 | 
					      return xit('execFileSync executes binaries', function() {
 | 
				
			||||||
        var output;
 | 
					        var output;
 | 
				
			||||||
        output = execFileSync(echo, ['test']);
 | 
					        output = execFileSync(echo, ['test']);
 | 
				
			||||||
        return assert.equal(String(output), 'test\n');
 | 
					        return assert.equal(String(output), 'test\n');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('internalModuleReadFile', function() {
 | 
					    describe('internalModuleReadFile', function() {
 | 
				
			||||||
      var internalModuleReadFile;
 | 
					      var internalModuleReadFile = process.binding('fs').internalModuleReadFile;
 | 
				
			||||||
      internalModuleReadFile = process.binding('fs').internalModuleReadFile;
 | 
					
 | 
				
			||||||
      it('read a normal file', function() {
 | 
					      it('read a normal file', function() {
 | 
				
			||||||
        var file1, file2, file3;
 | 
					        var file1, file2, file3;
 | 
				
			||||||
        file1 = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
					        file1 = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
				
			||||||
| 
						 | 
					@ -569,25 +599,28 @@ describe('asar package', function() {
 | 
				
			||||||
        file3 = path.join(fixtures, 'asar', 'a.asar', 'file3');
 | 
					        file3 = path.join(fixtures, 'asar', 'a.asar', 'file3');
 | 
				
			||||||
        return assert.equal(internalModuleReadFile(file3).toString().trim(), 'file3');
 | 
					        return assert.equal(internalModuleReadFile(file3).toString().trim(), 'file3');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('reads a normal file with unpacked files', function() {
 | 
					      return it('reads a normal file with unpacked files', function() {
 | 
				
			||||||
        var p;
 | 
					        var p;
 | 
				
			||||||
        p = path.join(fixtures, 'asar', 'unpack.asar', 'a.txt');
 | 
					        p = path.join(fixtures, 'asar', 'unpack.asar', 'a.txt');
 | 
				
			||||||
        return assert.equal(internalModuleReadFile(p).toString().trim(), 'a');
 | 
					        return assert.equal(internalModuleReadFile(p).toString().trim(), 'a');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return describe('process.noAsar', function() {
 | 
					    return describe('process.noAsar', function() {
 | 
				
			||||||
      var errorName;
 | 
					      var errorName = process.platform === 'win32' ? 'ENOENT' : 'ENOTDIR';
 | 
				
			||||||
      errorName = process.platform === 'win32' ? 'ENOENT' : 'ENOTDIR';
 | 
					
 | 
				
			||||||
      beforeEach(function() {
 | 
					      beforeEach(function() {
 | 
				
			||||||
        return process.noAsar = true;
 | 
					        return process.noAsar = true;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      afterEach(function() {
 | 
					      afterEach(function() {
 | 
				
			||||||
        return process.noAsar = false;
 | 
					        return process.noAsar = false;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('disables asar support in sync API', function() {
 | 
					      it('disables asar support in sync API', function() {
 | 
				
			||||||
        var dir, file;
 | 
					        var file = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
				
			||||||
        file = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
					        var dir = path.join(fixtures, 'asar', 'a.asar', 'dir1');
 | 
				
			||||||
        dir = path.join(fixtures, 'asar', 'a.asar', 'dir1');
 | 
					 | 
				
			||||||
        assert.throws((function() {
 | 
					        assert.throws((function() {
 | 
				
			||||||
          return fs.readFileSync(file);
 | 
					          return fs.readFileSync(file);
 | 
				
			||||||
        }), new RegExp(errorName));
 | 
					        }), new RegExp(errorName));
 | 
				
			||||||
| 
						 | 
					@ -601,6 +634,7 @@ describe('asar package', function() {
 | 
				
			||||||
          return fs.readdirSync(dir);
 | 
					          return fs.readdirSync(dir);
 | 
				
			||||||
        }), new RegExp(errorName));
 | 
					        }), new RegExp(errorName));
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('disables asar support in async API', function(done) {
 | 
					      it('disables asar support in async API', function(done) {
 | 
				
			||||||
        var dir, file;
 | 
					        var dir, file;
 | 
				
			||||||
        file = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
					        file = path.join(fixtures, 'asar', 'a.asar', 'file1');
 | 
				
			||||||
| 
						 | 
					@ -619,6 +653,7 @@ describe('asar package', function() {
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('treats *.asar as normal file', function() {
 | 
					      return it('treats *.asar as normal file', function() {
 | 
				
			||||||
        var asar, content1, content2, originalFs;
 | 
					        var asar, content1, content2, originalFs;
 | 
				
			||||||
        originalFs = require('original-fs');
 | 
					        originalFs = require('original-fs');
 | 
				
			||||||
| 
						 | 
					@ -632,44 +667,44 @@ describe('asar package', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('asar protocol', function() {
 | 
					  describe('asar protocol', function() {
 | 
				
			||||||
    var url;
 | 
					    var url = require('url');
 | 
				
			||||||
    url = require('url');
 | 
					
 | 
				
			||||||
    it('can request a file in package', function(done) {
 | 
					    it('can request a file in package', function(done) {
 | 
				
			||||||
      var p;
 | 
					      var p = path.resolve(fixtures, 'asar', 'a.asar', 'file1');
 | 
				
			||||||
      p = path.resolve(fixtures, 'asar', 'a.asar', 'file1');
 | 
					 | 
				
			||||||
      return $.get("file://" + p, function(data) {
 | 
					      return $.get("file://" + p, function(data) {
 | 
				
			||||||
        assert.equal(data.trim(), 'file1');
 | 
					        assert.equal(data.trim(), 'file1');
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can request a file in package with unpacked files', function(done) {
 | 
					    it('can request a file in package with unpacked files', function(done) {
 | 
				
			||||||
      var p;
 | 
					      var p = path.resolve(fixtures, 'asar', 'unpack.asar', 'a.txt');
 | 
				
			||||||
      p = path.resolve(fixtures, 'asar', 'unpack.asar', 'a.txt');
 | 
					 | 
				
			||||||
      return $.get("file://" + p, function(data) {
 | 
					      return $.get("file://" + p, function(data) {
 | 
				
			||||||
        assert.equal(data.trim(), 'a');
 | 
					        assert.equal(data.trim(), 'a');
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can request a linked file in package', function(done) {
 | 
					    it('can request a linked file in package', function(done) {
 | 
				
			||||||
      var p;
 | 
					      var p = path.resolve(fixtures, 'asar', 'a.asar', 'link2', 'link1');
 | 
				
			||||||
      p = path.resolve(fixtures, 'asar', 'a.asar', 'link2', 'link1');
 | 
					 | 
				
			||||||
      return $.get("file://" + p, function(data) {
 | 
					      return $.get("file://" + p, function(data) {
 | 
				
			||||||
        assert.equal(data.trim(), 'file1');
 | 
					        assert.equal(data.trim(), 'file1');
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('can request a file in filesystem', function(done) {
 | 
					    it('can request a file in filesystem', function(done) {
 | 
				
			||||||
      var p;
 | 
					      var p = path.resolve(fixtures, 'asar', 'file');
 | 
				
			||||||
      p = path.resolve(fixtures, 'asar', 'file');
 | 
					 | 
				
			||||||
      return $.get("file://" + p, function(data) {
 | 
					      return $.get("file://" + p, function(data) {
 | 
				
			||||||
        assert.equal(data.trim(), 'file');
 | 
					        assert.equal(data.trim(), 'file');
 | 
				
			||||||
        return done();
 | 
					        return done();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('gets 404 when file is not found', function(done) {
 | 
					    it('gets 404 when file is not found', function(done) {
 | 
				
			||||||
      var p;
 | 
					      var p = path.resolve(fixtures, 'asar', 'a.asar', 'no-exist');
 | 
				
			||||||
      p = path.resolve(fixtures, 'asar', 'a.asar', 'no-exist');
 | 
					 | 
				
			||||||
      return $.ajax({
 | 
					      return $.ajax({
 | 
				
			||||||
        url: "file://" + p,
 | 
					        url: "file://" + p,
 | 
				
			||||||
        error: function(err) {
 | 
					        error: function(err) {
 | 
				
			||||||
| 
						 | 
					@ -678,19 +713,20 @@ describe('asar package', function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('sets __dirname correctly', function(done) {
 | 
					    it('sets __dirname correctly', function(done) {
 | 
				
			||||||
      var p, u, w;
 | 
					 | 
				
			||||||
      after(function() {
 | 
					      after(function() {
 | 
				
			||||||
        w.destroy();
 | 
					        w.destroy();
 | 
				
			||||||
        return ipcMain.removeAllListeners('dirname');
 | 
					        return ipcMain.removeAllListeners('dirname');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      w = new BrowserWindow({
 | 
					
 | 
				
			||||||
 | 
					      var w = new BrowserWindow({
 | 
				
			||||||
        show: false,
 | 
					        show: false,
 | 
				
			||||||
        width: 400,
 | 
					        width: 400,
 | 
				
			||||||
        height: 400
 | 
					        height: 400
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      p = path.resolve(fixtures, 'asar', 'web.asar', 'index.html');
 | 
					      var p = path.resolve(fixtures, 'asar', 'web.asar', 'index.html');
 | 
				
			||||||
      u = url.format({
 | 
					      var u = url.format({
 | 
				
			||||||
        protocol: 'file',
 | 
					        protocol: 'file',
 | 
				
			||||||
        slashed: true,
 | 
					        slashed: true,
 | 
				
			||||||
        pathname: p
 | 
					        pathname: p
 | 
				
			||||||
| 
						 | 
					@ -701,19 +737,20 @@ describe('asar package', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      return w.loadURL(u);
 | 
					      return w.loadURL(u);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('loads script tag in html', function(done) {
 | 
					    return it('loads script tag in html', function(done) {
 | 
				
			||||||
      var p, u, w;
 | 
					 | 
				
			||||||
      after(function() {
 | 
					      after(function() {
 | 
				
			||||||
        w.destroy();
 | 
					        w.destroy();
 | 
				
			||||||
        return ipcMain.removeAllListeners('ping');
 | 
					        return ipcMain.removeAllListeners('ping');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      w = new BrowserWindow({
 | 
					
 | 
				
			||||||
 | 
					      var w = new BrowserWindow({
 | 
				
			||||||
        show: false,
 | 
					        show: false,
 | 
				
			||||||
        width: 400,
 | 
					        width: 400,
 | 
				
			||||||
        height: 400
 | 
					        height: 400
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      p = path.resolve(fixtures, 'asar', 'script.asar', 'index.html');
 | 
					      var p = path.resolve(fixtures, 'asar', 'script.asar', 'index.html');
 | 
				
			||||||
      u = url.format({
 | 
					      var u = url.format({
 | 
				
			||||||
        protocol: 'file',
 | 
					        protocol: 'file',
 | 
				
			||||||
        slashed: true,
 | 
					        slashed: true,
 | 
				
			||||||
        pathname: p
 | 
					        pathname: p
 | 
				
			||||||
| 
						 | 
					@ -725,15 +762,17 @@ describe('asar package', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('original-fs module', function() {
 | 
					  describe('original-fs module', function() {
 | 
				
			||||||
    var originalFs;
 | 
					    var originalFs = require('original-fs');
 | 
				
			||||||
    originalFs = require('original-fs');
 | 
					
 | 
				
			||||||
    it('treats .asar as file', function() {
 | 
					    it('treats .asar as file', function() {
 | 
				
			||||||
      var file, stats;
 | 
					      var file, stats;
 | 
				
			||||||
      file = path.join(fixtures, 'asar', 'a.asar');
 | 
					      file = path.join(fixtures, 'asar', 'a.asar');
 | 
				
			||||||
      stats = originalFs.statSync(file);
 | 
					      stats = originalFs.statSync(file);
 | 
				
			||||||
      return assert(stats.isFile());
 | 
					      return assert(stats.isFile());
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('is available in forked scripts', function(done) {
 | 
					    return it('is available in forked scripts', function(done) {
 | 
				
			||||||
      var child;
 | 
					      var child;
 | 
				
			||||||
      child = child_process.fork(path.join(fixtures, 'module', 'original-fs.js'));
 | 
					      child = child_process.fork(path.join(fixtures, 'module', 'original-fs.js'));
 | 
				
			||||||
| 
						 | 
					@ -744,9 +783,10 @@ describe('asar package', function() {
 | 
				
			||||||
      return child.send('message');
 | 
					      return child.send('message');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('graceful-fs module', function() {
 | 
					  describe('graceful-fs module', function() {
 | 
				
			||||||
    var gfs;
 | 
					    var gfs = require('graceful-fs');
 | 
				
			||||||
    gfs = require('graceful-fs');
 | 
					
 | 
				
			||||||
    it('recognize asar archvies', function() {
 | 
					    it('recognize asar archvies', function() {
 | 
				
			||||||
      var p;
 | 
					      var p;
 | 
				
			||||||
      p = path.join(fixtures, 'asar', 'a.asar', 'link1');
 | 
					      p = path.join(fixtures, 'asar', 'a.asar', 'link1');
 | 
				
			||||||
| 
						 | 
					@ -756,9 +796,10 @@ describe('asar package', function() {
 | 
				
			||||||
      return assert.notEqual(fs.readdir, gfs.readdir);
 | 
					      return assert.notEqual(fs.readdir, gfs.readdir);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('mkdirp module', function() {
 | 
					  describe('mkdirp module', function() {
 | 
				
			||||||
    var mkdirp;
 | 
					    var mkdirp = require('mkdirp');
 | 
				
			||||||
    mkdirp = require('mkdirp');
 | 
					
 | 
				
			||||||
    return it('throws error when calling inside asar archive', function() {
 | 
					    return it('throws error when calling inside asar archive', function() {
 | 
				
			||||||
      var p;
 | 
					      var p;
 | 
				
			||||||
      p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
					      p = path.join(fixtures, 'asar', 'a.asar', 'not-exist');
 | 
				
			||||||
| 
						 | 
					@ -767,20 +808,20 @@ describe('asar package', function() {
 | 
				
			||||||
      }), new RegExp('ENOTDIR'));
 | 
					      }), new RegExp('ENOTDIR'));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('native-image', function() {
 | 
					  return describe('native-image', function() {
 | 
				
			||||||
    it('reads image from asar archive', function() {
 | 
					    it('reads image from asar archive', function() {
 | 
				
			||||||
      var logo, p;
 | 
					      var p = path.join(fixtures, 'asar', 'logo.asar', 'logo.png');
 | 
				
			||||||
      p = path.join(fixtures, 'asar', 'logo.asar', 'logo.png');
 | 
					      var logo = nativeImage.createFromPath(p);
 | 
				
			||||||
      logo = nativeImage.createFromPath(p);
 | 
					 | 
				
			||||||
      return assert.deepEqual(logo.getSize(), {
 | 
					      return assert.deepEqual(logo.getSize(), {
 | 
				
			||||||
        width: 55,
 | 
					        width: 55,
 | 
				
			||||||
        height: 55
 | 
					        height: 55
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('reads image from asar archive with unpacked files', function() {
 | 
					    return it('reads image from asar archive with unpacked files', function() {
 | 
				
			||||||
      var logo, p;
 | 
					      var p = path.join(fixtures, 'asar', 'unpack.asar', 'atom.png');
 | 
				
			||||||
      p = path.join(fixtures, 'asar', 'unpack.asar', 'atom.png');
 | 
					      var logo = nativeImage.createFromPath(p);
 | 
				
			||||||
      logo = nativeImage.createFromPath(p);
 | 
					 | 
				
			||||||
      return assert.deepEqual(logo.getSize(), {
 | 
					      return assert.deepEqual(logo.getSize(), {
 | 
				
			||||||
        width: 1024,
 | 
					        width: 1024,
 | 
				
			||||||
        height: 1024
 | 
					        height: 1024
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,20 +8,22 @@ const BrowserWindow = remote.require('electron').BrowserWindow;
 | 
				
			||||||
const session = remote.require('electron').session;
 | 
					const session = remote.require('electron').session;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('chromium feature', function() {
 | 
					describe('chromium feature', function() {
 | 
				
			||||||
  var fixtures, listener;
 | 
					  var fixtures = path.resolve(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.resolve(__dirname, 'fixtures');
 | 
					  var listener = null;
 | 
				
			||||||
  listener = null;
 | 
					
 | 
				
			||||||
  afterEach(function() {
 | 
					  afterEach(function() {
 | 
				
			||||||
    if (listener != null) {
 | 
					    if (listener != null) {
 | 
				
			||||||
      window.removeEventListener('message', listener);
 | 
					      window.removeEventListener('message', listener);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return listener = null;
 | 
					    return listener = null;
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  xdescribe('heap snapshot', function() {
 | 
					  xdescribe('heap snapshot', function() {
 | 
				
			||||||
    return it('does not crash', function() {
 | 
					    return it('does not crash', function() {
 | 
				
			||||||
      return process.atomBinding('v8_util').takeHeapSnapshot();
 | 
					      return process.atomBinding('v8_util').takeHeapSnapshot();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('sending request of http protocol urls', function() {
 | 
					  describe('sending request of http protocol urls', function() {
 | 
				
			||||||
    return it('does not crash', function(done) {
 | 
					    return it('does not crash', function(done) {
 | 
				
			||||||
      var server;
 | 
					      var server;
 | 
				
			||||||
| 
						 | 
					@ -38,13 +40,15 @@ describe('chromium feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('document.hidden', function() {
 | 
					  describe('document.hidden', function() {
 | 
				
			||||||
    var url, w;
 | 
					    var url = "file://" + fixtures + "/pages/document-hidden.html";
 | 
				
			||||||
    url = "file://" + fixtures + "/pages/document-hidden.html";
 | 
					    var w = null;
 | 
				
			||||||
    w = null;
 | 
					
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return w != null ? w.destroy() : void 0;
 | 
					      return w != null ? w.destroy() : void 0;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('is set correctly when window is not shown', function(done) {
 | 
					    it('is set correctly when window is not shown', function(done) {
 | 
				
			||||||
      w = new BrowserWindow({
 | 
					      w = new BrowserWindow({
 | 
				
			||||||
        show: false
 | 
					        show: false
 | 
				
			||||||
| 
						 | 
					@ -55,6 +59,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      return w.loadURL(url);
 | 
					      return w.loadURL(url);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('is set correctly when window is inactive', function(done) {
 | 
					    return it('is set correctly when window is inactive', function(done) {
 | 
				
			||||||
      w = new BrowserWindow({
 | 
					      w = new BrowserWindow({
 | 
				
			||||||
        show: false
 | 
					        show: false
 | 
				
			||||||
| 
						 | 
					@ -67,6 +72,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      return w.loadURL(url);
 | 
					      return w.loadURL(url);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  xdescribe('navigator.webkitGetUserMedia', function() {
 | 
					  xdescribe('navigator.webkitGetUserMedia', function() {
 | 
				
			||||||
    return it('calls its callbacks', function(done) {
 | 
					    return it('calls its callbacks', function(done) {
 | 
				
			||||||
      this.timeout(5000);
 | 
					      this.timeout(5000);
 | 
				
			||||||
| 
						 | 
					@ -80,18 +86,21 @@ describe('chromium feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('navigator.language', function() {
 | 
					  describe('navigator.language', function() {
 | 
				
			||||||
    return it('should not be empty', function() {
 | 
					    return it('should not be empty', function() {
 | 
				
			||||||
      return assert.notEqual(navigator.language, '');
 | 
					      return assert.notEqual(navigator.language, '');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('navigator.serviceWorker', function() {
 | 
					  describe('navigator.serviceWorker', function() {
 | 
				
			||||||
    var url, w;
 | 
					    var url = "file://" + fixtures + "/pages/service-worker/index.html";
 | 
				
			||||||
    url = "file://" + fixtures + "/pages/service-worker/index.html";
 | 
					    var w = null;
 | 
				
			||||||
    w = null;
 | 
					
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return w != null ? w.destroy() : void 0;
 | 
					      return w != null ? w.destroy() : void 0;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('should register for file scheme', function(done) {
 | 
					    return it('should register for file scheme', function(done) {
 | 
				
			||||||
      w = new BrowserWindow({
 | 
					      w = new BrowserWindow({
 | 
				
			||||||
        show: false
 | 
					        show: false
 | 
				
			||||||
| 
						 | 
					@ -113,8 +122,10 @@ describe('chromium feature', function() {
 | 
				
			||||||
      return w.loadURL(url);
 | 
					      return w.loadURL(url);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('window.open', function() {
 | 
					  describe('window.open', function() {
 | 
				
			||||||
    this.timeout(20000);
 | 
					    this.timeout(20000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('returns a BrowserWindowProxy object', function() {
 | 
					    it('returns a BrowserWindowProxy object', function() {
 | 
				
			||||||
      var b;
 | 
					      var b;
 | 
				
			||||||
      b = window.open('about:blank', '', 'show=no');
 | 
					      b = window.open('about:blank', '', 'show=no');
 | 
				
			||||||
| 
						 | 
					@ -122,6 +133,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      assert.equal(b.constructor.name, 'BrowserWindowProxy');
 | 
					      assert.equal(b.constructor.name, 'BrowserWindowProxy');
 | 
				
			||||||
      return b.close();
 | 
					      return b.close();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('accepts "node-integration" as feature', function(done) {
 | 
					    it('accepts "node-integration" as feature', function(done) {
 | 
				
			||||||
      var b;
 | 
					      var b;
 | 
				
			||||||
      listener = function(event) {
 | 
					      listener = function(event) {
 | 
				
			||||||
| 
						 | 
					@ -132,6 +144,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      window.addEventListener('message', listener);
 | 
					      window.addEventListener('message', listener);
 | 
				
			||||||
      return b = window.open("file://" + fixtures + "/pages/window-opener-node.html", '', 'nodeIntegration=no,show=no');
 | 
					      return b = window.open("file://" + fixtures + "/pages/window-opener-node.html", '', 'nodeIntegration=no,show=no');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('inherit options of parent window', function(done) {
 | 
					    it('inherit options of parent window', function(done) {
 | 
				
			||||||
      var b;
 | 
					      var b;
 | 
				
			||||||
      listener = function(event) {
 | 
					      listener = function(event) {
 | 
				
			||||||
| 
						 | 
					@ -144,6 +157,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      window.addEventListener('message', listener);
 | 
					      window.addEventListener('message', listener);
 | 
				
			||||||
      return b = window.open("file://" + fixtures + "/pages/window-open-size.html", '', 'show=no');
 | 
					      return b = window.open("file://" + fixtures + "/pages/window-open-size.html", '', 'show=no');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('does not override child options', function(done) {
 | 
					    return it('does not override child options', function(done) {
 | 
				
			||||||
      var b, size;
 | 
					      var b, size;
 | 
				
			||||||
      size = {
 | 
					      size = {
 | 
				
			||||||
| 
						 | 
					@ -159,6 +173,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      return b = window.open("file://" + fixtures + "/pages/window-open-size.html", '', "show=no,width=" + size.width + ",height=" + size.height);
 | 
					      return b = window.open("file://" + fixtures + "/pages/window-open-size.html", '', "show=no,width=" + size.width + ",height=" + size.height);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('window.opener', function() {
 | 
					  describe('window.opener', function() {
 | 
				
			||||||
    var url, w;
 | 
					    var url, w;
 | 
				
			||||||
    this.timeout(10000);
 | 
					    this.timeout(10000);
 | 
				
			||||||
| 
						 | 
					@ -188,6 +203,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      return b = window.open(url, '', 'show=no');
 | 
					      return b = window.open(url, '', 'show=no');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('window.postMessage', function() {
 | 
					  describe('window.postMessage', function() {
 | 
				
			||||||
    return it('sets the source and origin correctly', function(done) {
 | 
					    return it('sets the source and origin correctly', function(done) {
 | 
				
			||||||
      var b, sourceId;
 | 
					      var b, sourceId;
 | 
				
			||||||
| 
						 | 
					@ -211,6 +227,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('window.opener.postMessage', function() {
 | 
					  describe('window.opener.postMessage', function() {
 | 
				
			||||||
    return it('sets source and origin correctly', function(done) {
 | 
					    return it('sets source and origin correctly', function(done) {
 | 
				
			||||||
      var b;
 | 
					      var b;
 | 
				
			||||||
| 
						 | 
					@ -225,6 +242,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      return b = window.open("file://" + fixtures + "/pages/window-opener-postMessage.html", '', 'show=no');
 | 
					      return b = window.open("file://" + fixtures + "/pages/window-opener-postMessage.html", '', 'show=no');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('creating a Uint8Array under browser side', function() {
 | 
					  describe('creating a Uint8Array under browser side', function() {
 | 
				
			||||||
    return it('does not crash', function() {
 | 
					    return it('does not crash', function() {
 | 
				
			||||||
      var RUint8Array;
 | 
					      var RUint8Array;
 | 
				
			||||||
| 
						 | 
					@ -232,6 +250,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      return new RUint8Array;
 | 
					      return new RUint8Array;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('webgl', function() {
 | 
					  describe('webgl', function() {
 | 
				
			||||||
    return it('can be get as context in canvas', function() {
 | 
					    return it('can be get as context in canvas', function() {
 | 
				
			||||||
      var webgl;
 | 
					      var webgl;
 | 
				
			||||||
| 
						 | 
					@ -242,6 +261,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      return assert.notEqual(webgl, null);
 | 
					      return assert.notEqual(webgl, null);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('web workers', function() {
 | 
					  describe('web workers', function() {
 | 
				
			||||||
    it('Worker can work', function(done) {
 | 
					    it('Worker can work', function(done) {
 | 
				
			||||||
      var message, worker;
 | 
					      var message, worker;
 | 
				
			||||||
| 
						 | 
					@ -254,6 +274,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      return worker.postMessage(message);
 | 
					      return worker.postMessage(message);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('SharedWorker can work', function(done) {
 | 
					    return it('SharedWorker can work', function(done) {
 | 
				
			||||||
      var message, worker;
 | 
					      var message, worker;
 | 
				
			||||||
      worker = new SharedWorker('../fixtures/workers/shared_worker.js');
 | 
					      worker = new SharedWorker('../fixtures/workers/shared_worker.js');
 | 
				
			||||||
| 
						 | 
					@ -265,15 +286,18 @@ describe('chromium feature', function() {
 | 
				
			||||||
      return worker.port.postMessage(message);
 | 
					      return worker.port.postMessage(message);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('iframe', function() {
 | 
					  describe('iframe', function() {
 | 
				
			||||||
    var iframe;
 | 
					    var iframe = null;
 | 
				
			||||||
    iframe = null;
 | 
					
 | 
				
			||||||
    beforeEach(function() {
 | 
					    beforeEach(function() {
 | 
				
			||||||
      return iframe = document.createElement('iframe');
 | 
					      return iframe = document.createElement('iframe');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      return document.body.removeChild(iframe);
 | 
					      return document.body.removeChild(iframe);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('does not have node integration', function(done) {
 | 
					    return it('does not have node integration', function(done) {
 | 
				
			||||||
      iframe.src = "file://" + fixtures + "/pages/set-global.html";
 | 
					      iframe.src = "file://" + fixtures + "/pages/set-global.html";
 | 
				
			||||||
      document.body.appendChild(iframe);
 | 
					      document.body.appendChild(iframe);
 | 
				
			||||||
| 
						 | 
					@ -283,6 +307,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('storage', function() {
 | 
					  describe('storage', function() {
 | 
				
			||||||
    return it('requesting persitent quota works', function(done) {
 | 
					    return it('requesting persitent quota works', function(done) {
 | 
				
			||||||
      return navigator.webkitPersistentStorage.requestQuota(1024 * 1024, function(grantedBytes) {
 | 
					      return navigator.webkitPersistentStorage.requestQuota(1024 * 1024, function(grantedBytes) {
 | 
				
			||||||
| 
						 | 
					@ -291,15 +316,17 @@ describe('chromium feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('websockets', function() {
 | 
					  describe('websockets', function() {
 | 
				
			||||||
    var WebSocketServer, server, wss;
 | 
					    var wss = null;
 | 
				
			||||||
    wss = null;
 | 
					    var server = null;
 | 
				
			||||||
    server = null;
 | 
					    var WebSocketServer = ws.Server;
 | 
				
			||||||
    WebSocketServer = ws.Server;
 | 
					
 | 
				
			||||||
    afterEach(function() {
 | 
					    afterEach(function() {
 | 
				
			||||||
      wss.close();
 | 
					      wss.close();
 | 
				
			||||||
      return server.close();
 | 
					      return server.close();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('has user agent', function(done) {
 | 
					    return it('has user agent', function(done) {
 | 
				
			||||||
      server = http.createServer();
 | 
					      server = http.createServer();
 | 
				
			||||||
      return server.listen(0, '127.0.0.1', function() {
 | 
					      return server.listen(0, '127.0.0.1', function() {
 | 
				
			||||||
| 
						 | 
					@ -319,6 +346,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('Promise', function() {
 | 
					  return describe('Promise', function() {
 | 
				
			||||||
    it('resolves correctly in Node.js calls', function(done) {
 | 
					    it('resolves correctly in Node.js calls', function(done) {
 | 
				
			||||||
      document.registerElement('x-element', {
 | 
					      document.registerElement('x-element', {
 | 
				
			||||||
| 
						 | 
					@ -338,6 +366,7 @@ describe('chromium feature', function() {
 | 
				
			||||||
        return called = true;
 | 
					        return called = true;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('resolves correctly in Electron calls', function(done) {
 | 
					    return it('resolves correctly in Electron calls', function(done) {
 | 
				
			||||||
      document.registerElement('y-element', {
 | 
					      document.registerElement('y-element', {
 | 
				
			||||||
        prototype: Object.create(HTMLElement.prototype, {
 | 
					        prototype: Object.create(HTMLElement.prototype, {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,14 +3,15 @@ const path = require('path');
 | 
				
			||||||
const temp = require('temp');
 | 
					const temp = require('temp');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('third-party module', function() {
 | 
					describe('third-party module', function() {
 | 
				
			||||||
  var fixtures;
 | 
					  var fixtures = path.join(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.join(__dirname, 'fixtures');
 | 
					 | 
				
			||||||
  temp.track();
 | 
					  temp.track();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (process.platform !== 'win32' || process.execPath.toLowerCase().indexOf('\\out\\d\\') === -1) {
 | 
					  if (process.platform !== 'win32' || process.execPath.toLowerCase().indexOf('\\out\\d\\') === -1) {
 | 
				
			||||||
    describe('runas', function() {
 | 
					    describe('runas', function() {
 | 
				
			||||||
      it('can be required in renderer', function() {
 | 
					      it('can be required in renderer', function() {
 | 
				
			||||||
        return require('runas');
 | 
					        return require('runas');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('can be required in node binary', function(done) {
 | 
					      return it('can be required in node binary', function(done) {
 | 
				
			||||||
        var child, runas;
 | 
					        var child, runas;
 | 
				
			||||||
        runas = path.join(fixtures, 'module', 'runas.js');
 | 
					        runas = path.join(fixtures, 'module', 'runas.js');
 | 
				
			||||||
| 
						 | 
					@ -21,6 +22,7 @@ describe('third-party module', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('ffi', function() {
 | 
					    describe('ffi', function() {
 | 
				
			||||||
      return it('does not crash', function() {
 | 
					      return it('does not crash', function() {
 | 
				
			||||||
        var ffi, libm;
 | 
					        var ffi, libm;
 | 
				
			||||||
| 
						 | 
					@ -32,6 +34,7 @@ describe('third-party module', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return describe('q', function() {
 | 
					  return describe('q', function() {
 | 
				
			||||||
    var Q;
 | 
					    var Q;
 | 
				
			||||||
    Q = require('q');
 | 
					    Q = require('q');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,8 +6,8 @@ const os = require('os');
 | 
				
			||||||
const remote = require('electron').remote;
 | 
					const remote = require('electron').remote;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('node feature', function() {
 | 
					describe('node feature', function() {
 | 
				
			||||||
  var fixtures;
 | 
					  var fixtures = path.join(__dirname, 'fixtures');
 | 
				
			||||||
  fixtures = path.join(__dirname, 'fixtures');
 | 
					
 | 
				
			||||||
  describe('child_process', function() {
 | 
					  describe('child_process', function() {
 | 
				
			||||||
    return describe('child_process.fork', function() {
 | 
					    return describe('child_process.fork', function() {
 | 
				
			||||||
      it('works in current process', function(done) {
 | 
					      it('works in current process', function(done) {
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@ describe('node feature', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return child.send('message');
 | 
					        return child.send('message');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('preserves args', function(done) {
 | 
					      it('preserves args', function(done) {
 | 
				
			||||||
        var args, child;
 | 
					        var args, child;
 | 
				
			||||||
        args = ['--expose_gc', '-test', '1'];
 | 
					        args = ['--expose_gc', '-test', '1'];
 | 
				
			||||||
| 
						 | 
					@ -29,6 +30,7 @@ describe('node feature', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return child.send('message');
 | 
					        return child.send('message');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('works in forked process', function(done) {
 | 
					      it('works in forked process', function(done) {
 | 
				
			||||||
        var child;
 | 
					        var child;
 | 
				
			||||||
        child = child_process.fork(path.join(fixtures, 'module', 'fork_ping.js'));
 | 
					        child = child_process.fork(path.join(fixtures, 'module', 'fork_ping.js'));
 | 
				
			||||||
| 
						 | 
					@ -38,6 +40,7 @@ describe('node feature', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return child.send('message');
 | 
					        return child.send('message');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('works in forked process when options.env is specifed', function(done) {
 | 
					      it('works in forked process when options.env is specifed', function(done) {
 | 
				
			||||||
        var child;
 | 
					        var child;
 | 
				
			||||||
        child = child_process.fork(path.join(fixtures, 'module', 'fork_ping.js'), [], {
 | 
					        child = child_process.fork(path.join(fixtures, 'module', 'fork_ping.js'), [], {
 | 
				
			||||||
| 
						 | 
					@ -49,6 +52,7 @@ describe('node feature', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return child.send('message');
 | 
					        return child.send('message');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('works in browser process', function(done) {
 | 
					      it('works in browser process', function(done) {
 | 
				
			||||||
        var child, fork;
 | 
					        var child, fork;
 | 
				
			||||||
        fork = remote.require('child_process').fork;
 | 
					        fork = remote.require('child_process').fork;
 | 
				
			||||||
| 
						 | 
					@ -59,6 +63,7 @@ describe('node feature', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return child.send('message');
 | 
					        return child.send('message');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      it('has String::localeCompare working in script', function(done) {
 | 
					      it('has String::localeCompare working in script', function(done) {
 | 
				
			||||||
        var child;
 | 
					        var child;
 | 
				
			||||||
        child = child_process.fork(path.join(fixtures, 'module', 'locale-compare.js'));
 | 
					        child = child_process.fork(path.join(fixtures, 'module', 'locale-compare.js'));
 | 
				
			||||||
| 
						 | 
					@ -68,6 +73,7 @@ describe('node feature', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return child.send('message');
 | 
					        return child.send('message');
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('has setImmediate working in script', function(done) {
 | 
					      return it('has setImmediate working in script', function(done) {
 | 
				
			||||||
        var child;
 | 
					        var child;
 | 
				
			||||||
        child = child_process.fork(path.join(fixtures, 'module', 'set-immediate.js'));
 | 
					        child = child_process.fork(path.join(fixtures, 'module', 'set-immediate.js'));
 | 
				
			||||||
| 
						 | 
					@ -79,17 +85,20 @@ describe('node feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('contexts', function() {
 | 
					  describe('contexts', function() {
 | 
				
			||||||
    describe('setTimeout in fs callback', function() {
 | 
					    describe('setTimeout in fs callback', function() {
 | 
				
			||||||
      if (process.env.TRAVIS === 'true') {
 | 
					      if (process.env.TRAVIS === 'true') {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('does not crash', function(done) {
 | 
					      return it('does not crash', function(done) {
 | 
				
			||||||
        return fs.readFile(__filename, function() {
 | 
					        return fs.readFile(__filename, function() {
 | 
				
			||||||
          return setTimeout(done, 0);
 | 
					          return setTimeout(done, 0);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('throw error in node context', function() {
 | 
					    describe('throw error in node context', function() {
 | 
				
			||||||
      return it('gets caught', function(done) {
 | 
					      return it('gets caught', function(done) {
 | 
				
			||||||
        var error, lsts;
 | 
					        var error, lsts;
 | 
				
			||||||
| 
						 | 
					@ -110,11 +119,13 @@ describe('node feature', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe('setTimeout called under Chromium event loop in browser process', function() {
 | 
					    describe('setTimeout called under Chromium event loop in browser process', function() {
 | 
				
			||||||
      return it('can be scheduled in time', function(done) {
 | 
					      return it('can be scheduled in time', function(done) {
 | 
				
			||||||
        return remote.getGlobal('setTimeout')(done, 0);
 | 
					        return remote.getGlobal('setTimeout')(done, 0);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return describe('setInterval called under Chromium event loop in browser process', function() {
 | 
					    return describe('setInterval called under Chromium event loop in browser process', function() {
 | 
				
			||||||
      return it('can be scheduled in time', function(done) {
 | 
					      return it('can be scheduled in time', function(done) {
 | 
				
			||||||
        var clear, interval;
 | 
					        var clear, interval;
 | 
				
			||||||
| 
						 | 
					@ -126,11 +137,13 @@ describe('node feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('message loop', function() {
 | 
					  describe('message loop', function() {
 | 
				
			||||||
    describe('process.nextTick', function() {
 | 
					    describe('process.nextTick', function() {
 | 
				
			||||||
      it('emits the callback', function(done) {
 | 
					      it('emits the callback', function(done) {
 | 
				
			||||||
        return process.nextTick(done);
 | 
					        return process.nextTick(done);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('works in nested calls', function(done) {
 | 
					      return it('works in nested calls', function(done) {
 | 
				
			||||||
        return process.nextTick(function() {
 | 
					        return process.nextTick(function() {
 | 
				
			||||||
          return process.nextTick(function() {
 | 
					          return process.nextTick(function() {
 | 
				
			||||||
| 
						 | 
					@ -139,10 +152,12 @@ describe('node feature', function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return describe('setImmediate', function() {
 | 
					    return describe('setImmediate', function() {
 | 
				
			||||||
      it('emits the callback', function(done) {
 | 
					      it('emits the callback', function(done) {
 | 
				
			||||||
        return setImmediate(done);
 | 
					        return setImmediate(done);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return it('works in nested calls', function(done) {
 | 
					      return it('works in nested calls', function(done) {
 | 
				
			||||||
        return setImmediate(function() {
 | 
					        return setImmediate(function() {
 | 
				
			||||||
          return setImmediate(function() {
 | 
					          return setImmediate(function() {
 | 
				
			||||||
| 
						 | 
					@ -152,10 +167,12 @@ describe('node feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('net.connect', function() {
 | 
					  describe('net.connect', function() {
 | 
				
			||||||
    if (process.platform !== 'darwin') {
 | 
					    if (process.platform !== 'darwin') {
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('emit error when connect to a socket path without listeners', function(done) {
 | 
					    return it('emit error when connect to a socket path without listeners', function(done) {
 | 
				
			||||||
      var child, script, socketPath;
 | 
					      var child, script, socketPath;
 | 
				
			||||||
      socketPath = path.join(os.tmpdir(), 'atom-shell-test.sock');
 | 
					      socketPath = path.join(os.tmpdir(), 'atom-shell-test.sock');
 | 
				
			||||||
| 
						 | 
					@ -172,6 +189,7 @@ describe('node feature', function() {
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('Buffer', function() {
 | 
					  describe('Buffer', function() {
 | 
				
			||||||
    it('can be created from WebKit external string', function() {
 | 
					    it('can be created from WebKit external string', function() {
 | 
				
			||||||
      var b, p;
 | 
					      var b, p;
 | 
				
			||||||
| 
						 | 
					@ -181,6 +199,7 @@ describe('node feature', function() {
 | 
				
			||||||
      assert.equal(b.toString(), '闲云潭影日悠悠,物换星移几度秋');
 | 
					      assert.equal(b.toString(), '闲云潭影日悠悠,物换星移几度秋');
 | 
				
			||||||
      return assert.equal(Buffer.byteLength(p.innerText), 45);
 | 
					      return assert.equal(Buffer.byteLength(p.innerText), 45);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return it('correctly parses external one-byte UTF8 string', function() {
 | 
					    return it('correctly parses external one-byte UTF8 string', function() {
 | 
				
			||||||
      var b, p;
 | 
					      var b, p;
 | 
				
			||||||
      p = document.createElement('p');
 | 
					      p = document.createElement('p');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue