aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/net/iframeio_different_base_test.html
blob: 476cbe862e943ad127d3709b3d83c5072d039b12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<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.net.IframeIo (with different base URL)</title>
<script>
// We use a different base to reproduce the conditions of crbug.com/66987
var href = window.location.href;
var newHref = href.replace(/net.*/, '');
document.write('<base href="' + newHref + '">');

var baseScript = 'base.js';
document.write('<script src="' + baseScript + '"><\/script>');
</script>
<script>
  goog.require('goog.net.IframeIo');
  goog.require('goog.testing.AsyncTestCase');
  goog.require('goog.testing.jsunit');
</script>
</head>
<body>
<script>

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

function testDifferentBaseUri() {
  var io = new goog.net.IframeIo();
  goog.events.listen(io, goog.net.EventType.COMPLETE,
      function() {
        assertNotEquals('File should have expected content.',
            -1, io.getResponseText().indexOf('just a file'));
        asyncTestCase.continueTesting();
      });
  io.send('net/iframeio_different_base_test.data');
  asyncTestCase.waitForAsync('Waiting for iframeIo respons.');
}

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