Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DLNA-RUI
cvp2ts
Commits
382366ae
Commit
382366ae
authored
Oct 19, 2014
by
Glenn Adams
Browse files
Populate level 3 cookies test.
parent
01eab788
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
specs/cookies/helpers/ProtocolCookies.js
View file @
382366ae
"
use strict
"
;
function
run
(
t
)
{
var
defProperties
=
t
.
properties
.
def
;
t
.
done
();
var
ident
=
'
test
'
;
var
url
=
'
./resources/set-cookie.py?ident=
'
+
ident
;
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
onload
=
t
.
step_func
(
function
()
{
test
(
function
()
{
assert_equals
(
xhr
.
status
,
200
);
},
defProperties
.
expandedName
+
'
-test-response-status
'
);
if
(
xhr
.
status
==
200
)
{
test
(
function
()
{
assert_equals
(
xhr
.
response
,
"
NO_COOKIE
"
);
},
defProperties
.
expandedName
+
'
-test-cookie-not-present
'
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
onload
=
t
.
step_func_done
(
function
()
{
test
(
function
()
{
assert_equals
(
xhr
.
response
,
"
COOKIE
"
);
},
defProperties
.
expandedName
+
'
-test-cookie-present
'
);
});
xhr
.
send
();
}
else
t
.
done
();
});
xhr
.
onerror
=
function
()
{
assert_unreached
(
'
unable to load
'
+
url
);
};
document
.
cookie
=
ident
+
'
=; expires=Thu, 01 Jan 1970 00:00:00 UTC
'
;
xhr
.
send
();
}
specs/cookies/resources/set-cookie.py
0 → 100644
View file @
382366ae
import
pprint
def
main
(
request
,
response
):
headers
=
[(
"Content-Type"
,
"text/plain"
)]
ident
=
request
.
GET
.
first
(
'ident'
,
'test'
)
if
ident
in
request
.
cookies
:
body
=
request
.
cookies
[
ident
].
value
response
.
delete_cookie
(
ident
)
else
:
response
.
set_cookie
(
ident
,
"COOKIE"
);
body
=
"NO_COOKIE"
return
headers
,
body
specs/index/index.idl.json
View file @
382366ae
This diff is collapsed.
Click to expand it.
tests/cookies/helpers/ProtocolCookies.js
View file @
382366ae
"
use strict
"
;
function
run
(
t
)
{
var
defProperties
=
t
.
properties
.
def
;
t
.
done
();
var
ident
=
'
test
'
;
var
url
=
'
./resources/set-cookie.py?ident=
'
+
ident
;
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
onload
=
t
.
step_func
(
function
()
{
test
(
function
()
{
assert_equals
(
xhr
.
status
,
200
);
},
defProperties
.
expandedName
+
'
-test-response-status
'
);
if
(
xhr
.
status
==
200
)
{
test
(
function
()
{
assert_equals
(
xhr
.
response
,
"
NO_COOKIE
"
);
},
defProperties
.
expandedName
+
'
-test-cookie-not-present
'
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
onload
=
t
.
step_func_done
(
function
()
{
test
(
function
()
{
assert_equals
(
xhr
.
response
,
"
COOKIE
"
);
},
defProperties
.
expandedName
+
'
-test-cookie-present
'
);
});
xhr
.
send
();
}
else
t
.
done
();
});
xhr
.
onerror
=
function
()
{
assert_unreached
(
'
unable to load
'
+
url
);
};
document
.
cookie
=
ident
+
'
=; expires=Thu, 01 Jan 1970 00:00:00 UTC
'
;
xhr
.
send
();
}
tests/cookies/resources/set-cookie.py
0 → 100644
View file @
382366ae
import
pprint
def
main
(
request
,
response
):
headers
=
[(
"Content-Type"
,
"text/plain"
)]
ident
=
request
.
GET
.
first
(
'ident'
,
'test'
)
if
ident
in
request
.
cookies
:
body
=
request
.
cookies
[
ident
].
value
response
.
delete_cookie
(
ident
)
else
:
response
.
set_cookie
(
ident
,
"COOKIE"
);
body
=
"NO_COOKIE"
return
headers
,
body
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment