Bug 1475925 [wpt PR 11996] - Add tests for cookieEnabled, a=testonly
authorkaixinjxq <xiuqix.jiang@intel.com>
Fri, 05 Oct 2018 14:21:38 +0000
changeset 495813 ad9556381625d7b52bbb2ab024a736ebb875636d
parent 495812 c7ddb680470c8b83b6bd7ab8a12c5034a4ba523c
child 495814 15142b2ebe328cced5c2f777cf2646f2bb1bf5da
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1475925, 11996
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1475925 [wpt PR 11996] - Add tests for cookieEnabled, a=testonly Automatic update from web-platform-testsAdd tests for cookieEnabled (#11996) And an infrastructure/ test to check that cookies are enabled. -- wpt-commits: 76fcdb7782f64aacd25ff96eacf3fe2c9ae94c73 wpt-pr: 11996
testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorcookies-cookieenabled-false-manual.html
testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorcookies-cookieenabled-true.html
testing/web-platform/tests/infrastructure/assumptions/cookie.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorcookies-cookieenabled-false-manual.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>navigator.cookieEnabled false</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://html.spec.whatwg.org/#dom-navigator-cookieenabled">
+<meta name="flags" content="interact">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<h2>Preconditions</h2>
+<p>Disable cookies in browser settings.</p>
+
+<script>
+  test(() => {
+    assert_false(navigator.cookieEnabled);
+  }, "navigator.cookieEnabled is false when cookies are disabled");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorcookies-cookieenabled-true.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>navigator.cookieEnabled true</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://html.spec.whatwg.org/#dom-navigator-cookieenabled">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+  test(() => {
+    assert_true(navigator.cookieEnabled);
+  }, "navigator.cookieEnabled is true when cookies are enabled");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/infrastructure/assumptions/cookie.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<title>cookies work in default browse settings</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://html.spec.whatwg.org/#dom-document-cookie">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+  test(t => {
+    t.add_cleanup(() => {
+      let date = new Date();
+      date.setTime(date.getTime() - 10000);
+      document.cookie = "name=''; expires=" + date.toGMTString();
+    });
+    document.cookie = "name=test_cookie";
+    assert_not_equals(document.cookie.match(/name=test_cookie/), null);
+  });
+</script>