summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/windows/browsing-context-names/choose-_top-002.html
blob: f29da80c6eefacef0ef3cc38967d8758d49978de (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
<!doctype html>
<title>HTML Test: Browsing context name - _top</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/PrefixedLocalStorage.js"></script>
<div id="log"></div>
<script>
var prefixedStorage;
setup (() => prefixedStorage = new PrefixedLocalStorageTest());

async_test(t => {
  t.add_cleanup(() => prefixedStorage.cleanup());

  var testFunc = (function (t) {
    var completed = 0;
    var testCount = 2;
    return function (actual, expected) {
      assert_equals(actual, expected);
      if (++completed >= testCount) {
        t.done();
      }
    }
  }(t));

  prefixedStorage.onSet('isTop', t.step_func(e => {
    testFunc(e.newValue, 'true');
  }));
  prefixedStorage.onSet('name', t.step_func(e => {
    testFunc(e.newValue, 'topWin2');
  }));
  window.open(prefixedStorage.url('resources/choose-_top-002-window.html'), '_blank');
}, 'Should choose top browsing context for "_top" if current is not top');
</script>