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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <title>script.aculo.us Unit test file</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <script src="../../lib/prototype.js" type="text/javascript"></script>
8 <script src="../../src/scriptaculous.js" type="text/javascript"></script>
9 <script src="../../src/unittest.js" type="text/javascript"></script>
10 <link rel="stylesheet" href="../test.css" type="text/css" />
11 </head>
12 <body>
13 <h1>script.aculo.us Unit test file</h1>
15 <!-- Log output -->
16 <div id="testlog"> </div>
18 <div id="d">initial</div>
20 <!-- Tests follow -->
21 <script type="text/javascript" language="javascript" charset="utf-8">
22 // <![CDATA[
23 var moo = 0;
25 var assertMethods = [];
26 for(method in Test.Unit.Assertions.prototype) {
27 if(/^assert/.test(method)) assertMethods.push(method);
28 }
30 var testObj = {
31 isNice: function(){
32 return true;
33 },
34 isBroken: function(){
35 return false;
36 }
37 }
39 Test.context("BDD-style testing",{
41 setup: function() {
42 $('d').update('setup!');
43 moo++;
44 },
46 teardown: function() {
47 moo--;
48 },
50 'should run setup before each specification': function(){
51 assert($('d').innerHTML == 'setup!');
52 assert(moo == 1);
53 },
55 'should run teardown after each specification': function(){
56 assert(moo == 1);
57 },
59 'should provide extensions to tie in isSomething and respondsTo object methods': function(){
60 Object.extend(testObj, Test.BDDMethods);
62 testObj.shouldBe('nice');
63 testObj.shouldNotBe('broken');
65 testObj.shouldRespondTo('isNice');
66 testObj.shouldRespondTo('isBroken');
67 },
69 'should automatically add extensions to strings': function(){
70 'a'.shouldEqual('a');
71 'a'.shouldNotEqual('b');
72 'a'.shouldNotBeNull();
73 'a'.shouldBeA(String);
75 var aString = 'boo!';
76 aString.shouldEqual('boo!');
77 aString.shouldBeA(String);
78 aString.shouldNotBeA(Number);
79 },
81 'should automatically add extensions to numbers': function(){
82 var n = 123;
83 n.shouldEqual(123);
84 n.shouldNotEqual(4);
86 n.shouldBeA(Number);
87 n.shouldNotBeA(Test);
88 },
90 'should automatically add extensions to arrays': function(){
91 ['a'].shouldNotBeA(String);
92 [1,2,3].shouldBeAn(Array);
93 [1,2,3].shouldEqualEnum([1,2,3]);
94 },
96 'should support the eval() method': function(){
97 eval('2*2').shouldEqual(4);
98 },
100 'should support equality assertion': function(){
101 assertEqual(1, 1);
102 assertEqual('a', 'a');
103 assertEqual(1, '1');
105 var x = 1;
106 var y = 1;
107 assertEqual(1, x)
108 assertEqual(x, y);
109 },
111 'should provide all assertions': function(){
112 assertMethods.each(function(m){
113 assert(typeof this[m] == 'function');
114 }.bind(this));
115 },
117 'should support deferred execution': function(){
118 wait(10,function(){
119 'a'.shouldEqual('a');
120 });
122 wait(10,function(){
123 'a'.shouldEqual('a');
124 wait(10,function(){
125 'a'.shouldEqual('a');
126 wait(10,function(){
127 'a'.shouldEqual('a');
128 });
129 });
130 });
131 }
133 });
135 // ]]>
136 </script>
137 </body>
138 </html>