Chromium Code Reviews| Index: LayoutTests/http/tests/websocket/cookie-document-to-ws.html |
| diff --git a/LayoutTests/http/tests/websocket/cookie-document-to-ws.html b/LayoutTests/http/tests/websocket/cookie-document-to-ws.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..eb64c94b2edbf50d444b26b1ac984f69ef2c47c0 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/websocket/cookie-document-to-ws.html |
| @@ -0,0 +1,36 @@ |
| +<html> |
| +<body> |
| +<script src="/js-test-resources/testharness.js"></script> |
| +<script src="/js-test-resources/testharnessreport.js"></script> |
| +<script> |
| +var t = async_test('Cookies set by document.cookie are sent in a WebSocket handshake'); |
| +t.step(function() { |
| + var cookie_id = 'test_' + Date.now() + '.' + Math.random(); |
| + |
| + document.cookie = cookie_id + '=1; Path=/echo-cookie'; |
| + |
| + new Promise(t.step_func(function(resolve, reject) { |
| + var echo_ws = new WebSocket('ws://127.0.0.1:8880/echo-cookie'); |
| + echo_ws.onmessage = t.step_func(function (e) { |
| + resolve(e.data); |
| + }); |
| + echo_ws.onerror = t.step_func(function () { |
| + reject('Unexpected error event'); |
| + }); |
| + echo_ws.onclose = t.step_func(function (e) { |
| + reject('Unexpected close event: ' + e); |
| + }); |
| + })).then(t.step_func(function(actual) { |
| + var expected = cookie_id + '=1'; |
| + assert_equals(actual, expected); |
| + |
| + document.cookie = cookie_id + '=1; Path=/echo-cookie; Max-Age=0'; |
|
Adam Rice
2014/06/05 03:47:50
If the test fails, the cookie will not be deleted.
tyoshino (SeeGerritForStatus)
2014/06/05 05:11:11
I believe so. content_shell processes are reused b
|
| + |
| + t.done(); |
| + }), t.step_func(function(e) { |
| + assert_unreached(e); |
| + })); |
| +}); |
| +</script> |
| +</body> |
| +</html> |