|
63
|
1 |
/** |
|
|
2 |
* Sinon.JS 1.2.0, 2011/09/27 |
|
|
3 |
* |
|
|
4 |
* @author Christian Johansen (christian@cjohansen.no) |
|
|
5 |
* |
|
|
6 |
* (The BSD License) |
|
|
7 |
* |
|
|
8 |
* Copyright (c) 2010-2011, Christian Johansen, christian@cjohansen.no |
|
|
9 |
* All rights reserved. |
|
|
10 |
* |
|
|
11 |
* Redistribution and use in source and binary forms, with or without modification, |
|
|
12 |
* are permitted provided that the following conditions are met: |
|
|
13 |
* |
|
|
14 |
* * Redistributions of source code must retain the above copyright notice, |
|
|
15 |
* this list of conditions and the following disclaimer. |
|
|
16 |
* * Redistributions in binary form must reproduce the above copyright notice, |
|
|
17 |
* this list of conditions and the following disclaimer in the documentation |
|
|
18 |
* and/or other materials provided with the distribution. |
|
|
19 |
* * Neither the name of Christian Johansen nor the names of his contributors |
|
|
20 |
* may be used to endorse or promote products derived from this software |
|
|
21 |
* without specific prior written permission. |
|
|
22 |
* |
|
|
23 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
|
24 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
|
25 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
|
26 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
|
|
27 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
|
28 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
|
29 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
|
30 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
|
31 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
|
32 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
33 |
*/ |
|
|
34 |
|
|
|
35 |
"use strict"; |
|
|
36 |
/*global sinon, setTimeout, setInterval, clearTimeout, clearInterval, Date*/ |
|
|
37 |
/** |
|
|
38 |
* Helps IE run the fake timers. By defining global functions, IE allows |
|
|
39 |
* them to be overwritten at a later point. If these are not defined like |
|
|
40 |
* this, overwriting them will result in anything from an exception to browser |
|
|
41 |
* crash. |
|
|
42 |
* |
|
|
43 |
* If you don't require fake timers to work in IE, don't include this file. |
|
|
44 |
* |
|
|
45 |
* @author Christian Johansen (christian@cjohansen.no) |
|
|
46 |
* @license BSD |
|
|
47 |
* |
|
|
48 |
* Copyright (c) 2010-2011 Christian Johansen |
|
|
49 |
*/ |
|
|
50 |
function setTimeout() {} |
|
|
51 |
function clearTimeout() {} |
|
|
52 |
function setInterval() {} |
|
|
53 |
function clearInterval() {} |
|
|
54 |
function Date() {} |
|
|
55 |
|
|
|
56 |
// Reassign the original functions. Now their writable attribute |
|
|
57 |
// should be true. Hackish, I know, but it works. |
|
|
58 |
setTimeout = sinon.timers.setTimeout; |
|
|
59 |
clearTimeout = sinon.timers.clearTimeout; |
|
|
60 |
setInterval = sinon.timers.setInterval; |
|
|
61 |
clearInterval = sinon.timers.clearInterval; |
|
|
62 |
Date = sinon.timers.Date; |
|
|
63 |
|
|
|
64 |
/*global sinon*/ |
|
|
65 |
/** |
|
|
66 |
* Helps IE run the fake XMLHttpRequest. By defining global functions, IE allows |
|
|
67 |
* them to be overwritten at a later point. If these are not defined like |
|
|
68 |
* this, overwriting them will result in anything from an exception to browser |
|
|
69 |
* crash. |
|
|
70 |
* |
|
|
71 |
* If you don't require fake XHR to work in IE, don't include this file. |
|
|
72 |
* |
|
|
73 |
* @author Christian Johansen (christian@cjohansen.no) |
|
|
74 |
* @license BSD |
|
|
75 |
* |
|
|
76 |
* Copyright (c) 2010-2011 Christian Johansen |
|
|
77 |
*/ |
|
|
78 |
function XMLHttpRequest() {} |
|
|
79 |
|
|
|
80 |
// Reassign the original function. Now its writable attribute |
|
|
81 |
// should be true. Hackish, I know, but it works. |
|
|
82 |
XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined; |