Sha256: 36529d11c65209180bcb699e534f7e1f5eb3083228c54fb5bf9548710a038188

Contents?: true

Size: 1.95 KB

Versions: 6

Compression:

Stored size: 1.95 KB

Contents

<!DOCTYPE html>
<html>
<!--
Copyright 2011 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.PortNetwork
</title>
<script src="../base.js"></script>
<script>
goog.require('goog.events.EventTarget');
goog.require('goog.messaging.PortChannel');
goog.require('goog.messaging.PortOperator');
goog.require('goog.testing.AsyncTestCase');
goog.require('goog.testing.MockControl');
goog.require('goog.testing.async.MockControl');
goog.require('goog.testing.messaging.MockMessageEvent');
goog.require('goog.testing.jsunit');
</script>
</head>
<body>
<iframe style="display: none;" name="inner" id="inner"
        src="testdata/portnetwork_inner.html"></iframe>
<script>

var asyncTestCase = goog.testing.AsyncTestCase.createAndInstall();

// Use a relatively long timeout because workers can take a while to start up.
asyncTestCase.stepTimeout = 5 * 1000;

var timer;

function setUp() {
  timer = new goog.Timer(50);
}

function tearDown() {
  goog.dispose(timer);
}

function testRouteMessageThroughWorkers() {
  if (!('MessageChannel' in goog.global)) {
    return;
  }

  var master = new goog.messaging.PortOperator('main');
  master.addPort('worker1', new goog.messaging.PortChannel(
      new Worker('testdata/portnetwork_worker1.js')));
  master.addPort('worker2', new goog.messaging.PortChannel(
      new Worker('testdata/portnetwork_worker2.js')));
  master.addPort(
      'frame', goog.messaging.PortChannel.forEmbeddedWindow(
          window.frames['inner'], '*', timer));

  master.dial('worker1').registerService('result', function(msg) {
    assertArrayEquals(['main', 'worker2', 'frame', 'worker1'], msg);
    master.dispose();
    asyncTestCase.continueTesting();
  }, true);

  master.dial('worker2').send('sendToFrame', ['main']);

  asyncTestCase.waitForAsync('routing messages');
}

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
k4compiler-0.0.1 third_party/closure-library/closure/goog/messaging/portnetwork_test.html
middleman-wizard-template-1.0.4 lib/middleman-wizard-template/template/closure/library/closure/goog/messaging/portnetwork_test.html
middleman-wizard-template-1.0.3 lib/middleman-wizard-template/template/closure/library/closure/goog/messaging/portnetwork_test.html
middleman-wizard-template-1.0.2 lib/middleman-wizard-template/template/closure/library/closure/goog/messaging/portnetwork_test.html
middleman-wizard-template-1.0.1 lib/middleman-wizard-template/template/closure/library/closure/goog/messaging/portnetwork_test.html
middleman-wizard-template-1.0.0.pre.1 lib/middleman-wizard-template/template/closure/library/closure/goog/messaging/portnetwork_test.html