diff options
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/messaging/deferredchannel_test.html')
-rw-r--r-- | contexts/data/lib/closure-library/closure/goog/messaging/deferredchannel_test.html | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/messaging/deferredchannel_test.html b/contexts/data/lib/closure-library/closure/goog/messaging/deferredchannel_test.html deleted file mode 100644 index 287c282..0000000 --- a/contexts/data/lib/closure-library/closure/goog/messaging/deferredchannel_test.html +++ /dev/null @@ -1,113 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- -Copyright 2010 The Closure Library Authors. All Rights Reserved. - -Use of this source code is governed by the Apache License, Version 2.0. -See the COPYING file for details. ---> -<!-- ---> -<head> -<title> - Closure Unit Tests - goog.messaging.DeferredChannel -</title> -<script src="../base.js"></script> -<script> -goog.require('goog.async.Deferred'); -goog.require('goog.messaging.DeferredChannel'); -goog.require('goog.testing.MockControl'); -goog.require('goog.testing.async.MockControl'); -goog.require('goog.testing.jsunit'); -goog.require('goog.testing.messaging.MockMessageChannel'); -</script> -</head> -<body> -<script> - -var mockControl, asyncMockControl; -var mockChannel, deferredChannel; -var cancelled; -var deferred; - -function setUp() { - mockControl = new goog.testing.MockControl(); - asyncMockControl = new goog.testing.async.MockControl(mockControl); - mockChannel = new goog.testing.messaging.MockMessageChannel(mockControl); - cancelled = false; - deferred = new goog.async.Deferred(function() { cancelled = true; }); - deferredChannel = new goog.messaging.DeferredChannel(deferred); -} - -function tearDown() { - mockControl.$verifyAll(); -} - -function testDeferredResolvedBeforeSend() { - mockChannel.send('test', 'val'); - mockControl.$replayAll(); - deferred.callback(mockChannel); - deferredChannel.send('test', 'val'); -} - -function testDeferredResolvedBeforeRegister() { - deferred.callback(mockChannel); - deferredChannel.registerService( - 'test', asyncMockControl.asyncAssertEquals('passes on register', 'val')); - mockChannel.receive('test', 'val'); -} - -function testDeferredResolvedBeforeRegisterObject() { - deferred.callback(mockChannel); - deferredChannel.registerService( - 'test', - asyncMockControl.asyncAssertEquals('passes on register', {'key': 'val'}), - true); - mockChannel.receive('test', {'key': 'val'}); -} - -function testDeferredResolvedBeforeRegisterDefault() { - deferred.callback(mockChannel); - deferredChannel.registerDefaultService( - asyncMockControl.asyncAssertEquals('passes on register', 'test', 'val')); - mockChannel.receive('test', 'val'); -} - -function testDeferredResolvedAfterSend() { - mockChannel.send('test', 'val'); - mockControl.$replayAll(); - deferredChannel.send('test', 'val'); - deferred.callback(mockChannel); -} - -function testDeferredResolvedAfterRegister() { - deferredChannel.registerService( - 'test', asyncMockControl.asyncAssertEquals('passes on register', 'val')); - deferred.callback(mockChannel); - mockChannel.receive('test', 'val'); -} - -function testDeferredResolvedAfterRegisterObject() { - deferredChannel.registerService( - 'test', - asyncMockControl.asyncAssertEquals('passes on register', {'key': 'val'}), - true); - deferred.callback(mockChannel); - mockChannel.receive('test', {'key': 'val'}); -} - -function testDeferredResolvedAfterRegisterDefault() { - deferredChannel.registerDefaultService( - asyncMockControl.asyncAssertEquals('passes on register', 'test', 'val')); - deferred.callback(mockChannel); - mockChannel.receive('test', 'val'); -} - -function testCancel() { - deferredChannel.cancel(); - assertTrue(cancelled); -} - -</script> -</body> -</html> |