Sha256: 1a7b31d4a21032de47cddf379ca0918e1c0daf0f22cb4d0609455632d9624184

Contents?: true

Size: 1.65 KB

Versions: 8

Compression:

Stored size: 1.65 KB

Contents

<!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.

Author: nicksantos@google.com (Nick Santos)
-->

<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>JsUnit tests for goog.module.ModuleLoadCallback</title>
<script src="../base.js"></script>
<script>

goog.require('goog.debug.ErrorHandler');
goog.require('goog.debug.entryPointRegistry');
goog.require('goog.functions');
goog.require('goog.module.ModuleLoadCallback');
goog.require('goog.testing.jsunit');
goog.require('goog.testing.recordFunction');


</script>
</head>
<body>
<script type='text/javascript'>

function testProtectEntryPoint() {
  // Test a callback created before the protect method is called.
  var callback1 = new goog.module.ModuleLoadCallback(
      goog.functions.error('callback1'));

  var errorFn = goog.testing.recordFunction();
  var errorHandler = new goog.debug.ErrorHandler(errorFn);
  goog.debug.entryPointRegistry.monitorAll(errorHandler);

  assertEquals(0, errorFn.getCallCount());
  assertThrows(goog.bind(callback1.execute, callback1));
  assertEquals(1, errorFn.getCallCount());
  assertContains('callback1', errorFn.getLastCall().getArguments()[0].message);

  // Test a callback created after the protect method is called.
  var callback2 = new goog.module.ModuleLoadCallback(
      goog.functions.error('callback2'));
  assertThrows(goog.bind(callback1.execute, callback2));
  assertEquals(2, errorFn.getCallCount());
  assertContains('callback2', errorFn.getLastCall().getArguments()[0].message);
}

</script>
</body>
</html>

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
k4compiler-0.0.1 third_party/closure-library/closure/goog/module/moduleloadcallback_test.html
middleman-wizard-template-1.0.4 lib/middleman-wizard-template/template/closure/library/closure/goog/module/moduleloadcallback_test.html
middleman-wizard-template-1.0.3 lib/middleman-wizard-template/template/closure/library/closure/goog/module/moduleloadcallback_test.html
middleman-wizard-template-1.0.2 lib/middleman-wizard-template/template/closure/library/closure/goog/module/moduleloadcallback_test.html
middleman-wizard-template-1.0.1 lib/middleman-wizard-template/template/closure/library/closure/goog/module/moduleloadcallback_test.html
middleman-wizard-template-1.0.0.pre.1 lib/middleman-wizard-template/template/closure/library/closure/goog/module/moduleloadcallback_test.html
closure-1.2.701 closure-library/closure/goog/module/moduleloadcallback_test.html
closure-1.1.692 closure-library/closure/goog/module/moduleloadcallback_test.html