You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by dd...@apache.org on 2012/09/05 17:28:03 UTC

svn commit: r1381226 - /shindig/trunk/features/src/test/javascript/features/mocks/window.js

Author: ddumont
Date: Wed Sep  5 15:28:03 2012
New Revision: 1381226

URL: http://svn.apache.org/viewvc?rev=1381226&view=rev
Log:
oauthpopup - delay checking for container code till it's defined.

Modified:
    shindig/trunk/features/src/test/javascript/features/mocks/window.js

Modified: shindig/trunk/features/src/test/javascript/features/mocks/window.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/mocks/window.js?rev=1381226&r1=1381225&r2=1381226&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/mocks/window.js (original)
+++ shindig/trunk/features/src/test/javascript/features/mocks/window.js Wed Sep  5 15:28:03 2012
@@ -24,13 +24,32 @@
  * the global window object in each test case that uses the window.
  *
  * Example:
- * 
+ *
  * ExampleTest.prototype.testSomething = function() {
  *   window = new mocks.FakeWindow();
  *   // Test things
  * };
  */
 
+// So tests aren't broken :/
+(function() {
+  var timer = new java.util.Timer(),
+      timerIds = {},
+      inc = 1;
+
+  this.setTimeout = function (fn, delay) {
+    var id = inc++;
+    timerIds[id] = new JavaAdapter(java.util.TimerTask, {run: fn});
+    timer.schedule(timerIds[id], delay);
+  };
+
+  this.clearTimeout = function(id) {
+    ids[id].cancel();
+    timer.purge();
+    delete timerIds[id];
+  };
+}).call(this);
+
 var mocks = mocks || {};
 
 /**