<!DOCTYPE html> <!-- webkit-test-runner [ ContactPickerAPIEnabled=true ] -->
<html>
    <head>
        <script src="../resources/js-test.js"></script>
    </head>
    <script>
        function runTest()
        {
            description("Tests the interfaces of the Contact Picker API, which include ContactsManager and extensions to Navigator.");

            shouldBeTrue("ContactsManager instanceof Function");
            shouldBeEqualToString("typeof ContactsManager", "function");
            shouldBeTrue("navigator.contacts instanceof ContactsManager");
            shouldBeTrue("Object.getPrototypeOf(navigator.contacts) === ContactsManager.prototype");
            shouldBeTrue("ContactsManager.prototype.getProperties instanceof Function");
            shouldBeTrue("ContactsManager.prototype.select instanceof Function");
            shouldThrow("ContactsManager()");
            shouldThrow("new ContactsManager()");
            shouldBeEqualToString("ContactsManager.toString()", "function ContactsManager() {\n    [native code]\n}");
            shouldBeEqualToString("navigator.contacts.toString()", "[object ContactsManager]");
            shouldBeTrue("navigator.contacts.getProperties() instanceof Promise");
            shouldBeTrue("navigator.contacts.select(['name', 'email'], {multiple: true}) instanceof Promise");
        }
    </script>
    <body onload=runTest()></body>
</html>
