Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 var expect = require('chai').expect;
2 var util = require('./util');
4 var endpoint = require('../lib/endpoint');
5 var Endpoint = endpoint.Endpoint;
7 var settings = {
8 SETTINGS_MAX_CONCURRENT_STREAMS: 100,
9 SETTINGS_INITIAL_WINDOW_SIZE: 100000
10 };
12 describe('endpoint.js', function() {
13 describe('scenario', function() {
14 describe('connection setup', function() {
15 it('should work as expected', function(done) {
16 var c = new Endpoint(util.log.child({ role: 'client' }), 'CLIENT', settings);
17 var s = new Endpoint(util.log.child({ role: 'client' }), 'SERVER', settings);
19 util.log.debug('Test initialization over, starting piping.');
20 c.pipe(s).pipe(c);
22 setTimeout(function() {
23 // If there are no exception until this, then we're done
24 done();
25 }, 10);
26 });
27 });
28 });
29 describe('bunyan serializer', function() {
30 describe('`e`', function() {
31 var format = endpoint.serializers.e;
32 it('should assign a unique ID to each endpoint', function() {
33 var c = new Endpoint(util.log.child({ role: 'client' }), 'CLIENT', settings);
34 var s = new Endpoint(util.log.child({ role: 'client' }), 'SERVER', settings);
35 expect(format(c)).to.not.equal(format(s));
36 expect(format(c)).to.equal(format(c));
37 expect(format(s)).to.equal(format(s));
38 });
39 });
40 });
41 });