Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: LayoutTests/http/tests/websocket/cookie-document-to-ws.html

Issue 315113002: Test that cookies set by document.cookie are sent in a WebSocket handshake. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/websocket/cookie-document-to-ws-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/http/tests/websocket/cookie-document-to-ws-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698