<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>idlharness: Primary interface</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="/resources/WebIDLParser.js"></script>
  <script src="/resources/idlharness.js"></script>
</head>
<body>
<p>Verify the series of sub-tests that are executed for "tested" interface
objects but skipped for "untested" interface objects.</p>
<script>
"use strict";

function FooParent() {
    if (!new.target) {
        throw new TypeError('FooParent() must be called with new');
    }
}
Object.defineProperty(window, "Foo", {
    enumerable: false,
    writable: true,
    configurable: true,
    value: function Foo() {
        if (!new.target) {
            throw new TypeError('Foo() must be called with new');
        }
    }
  });
Object.defineProperty(window.Foo, "prototype", {
    writable: false,
    value: new FooParent()
  });
Object.defineProperty(window.Foo.prototype, "constructor", {
    enumerable: false,
    writable: true,
    configurable: true,
    value: window.Foo
  });
Object.setPrototypeOf(Foo, FooParent);
Foo.prototype[Symbol.toStringTag] = "Foo";

var idlArray = new IdlArray();
idlArray.add_untested_idls("interface FooParent {};");
idlArray.add_idls(
    "interface Foo : FooParent { constructor(); };"
  );
idlArray.add_objects({
  Foo: ["new Foo()"],
  FooParent: ["new FooParent()"]
});
idlArray.test();
</script>
<script type="text/json" id="expected">
{
  "summarized_status": {
    "status_string": "OK",
    "message": null
  },
  "summarized_tests": [
    {
      "name": "Foo interface object length",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "Foo interface object name",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "Foo interface: existence and properties of interface object",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "Foo interface: existence and properties of interface prototype object",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "Foo interface: existence and properties of interface prototype object's \"constructor\" property",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "Foo interface: existence and properties of interface prototype object's @@unscopables property",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "Foo must be primary interface of new Foo()",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "Stringification of new Foo()",
      "status_string": "PASS",
      "properties": {},
      "message": null
    }
  ],
  "type": "complete"
}
</script>
</body>
</html>
