<!DOCTYPE html>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
test(function() {
assert_true(!!window.internals
&& !!internals.runtimeFlags,
"This test only works when run as a layout test!");
}, "Prerequisites to running the rest of the tests");
test(function () {
assert_false(window.navigator.webdriver);
}, "Test if navigator.webdriver is false without automation");
internals.runtimeFlags.automationControlledEnabled = true;
test(function() {
assert_true(internals.runtimeFlags.automationControlledEnabled);
assert_true("webdriver" in window.navigator);
assert_true(navigator.webdriver);
}, "Test if Navigator implements NavigatorAutomationInformation interface");
test(function() {
const descriptor = Object.getOwnPropertyDescriptor(Navigator.prototype, "webdriver");
assert_true(descriptor !== undefined);
assert_true(descriptor.configurable);
assert_true(descriptor.enumerable);
assert_true(descriptor.set === undefined);
}, "Test that the navigator.webdriver descriptor has expected properties");
</script>
</body>
</html>