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
85c1791b
Commit
85c1791b
authored
Oct 20, 2014
by
Glenn Adams
Browse files
Populate level 3 origin tests.
parent
5da3f5a8
Changes
10
Hide whitespace changes
Inline
Side-by-side
specs/cookies/resources/set-cookie.py
View file @
85c1791b
import
pprint
def
main
(
request
,
response
):
headers
=
[(
"Content-Type"
,
"text/plain"
)]
ident
=
request
.
GET
.
first
(
'ident'
,
'test'
)
...
...
specs/origin/helpers/ProtocolOrigin.js
0 → 100644
View file @
85c1791b
"
use strict
"
;
function
run
(
t
)
{
var
defProperties
=
t
.
properties
.
def
;
var
url
=
CROSSDOMAIN
+
'
./resources/check-origin.py
'
;
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
onload
=
t
.
step_func_done
(
function
()
{
var
response
=
JSON
.
parse
(
xhr
.
response
);
test
(
function
()
{
assert_true
(
response
);
},
defProperties
.
expandedName
+
'
-test-origin-present
'
);
});
xhr
.
onerror
=
function
()
{
assert_unreached
(
'
unable to load
'
+
url
);
};
xhr
.
send
();
}
specs/origin/origin.config.json
View file @
85c1791b
...
...
@@ -5,5 +5,16 @@
"local"
:
"rfc6454.txt"
,
"dontFetch"
:
true
,
"dontFetchReason"
:
"specification is final"
,
"helpers3"
:
[]
"helpers3"
:
[
"ProtocolOrigin"
],
"crossDomainSupport"
:
true
,
"tests"
:
[
{
"name"
:
"ProtocolOrigin"
,
"helper"
:
"ProtocolOrigin"
,
"code"
:
"run(t)"
,
"async"
:
true
}
]
}
specs/origin/resources/check-origin.py
0 → 100644
View file @
85c1791b
def
main
(
request
,
response
):
response
.
headers
.
set
(
"Content-Type"
,
"text/plain"
)
origin
=
request
.
headers
.
get
(
"origin"
)
if
origin
is
not
None
:
response
.
headers
.
set
(
"Access-Control-Allow-Origin"
,
origin
)
body
=
"true"
else
:
body
=
"false"
return
body
tests/origin/helpers/ProtocolOrigin.js
0 → 100644
View file @
85c1791b
"
use strict
"
;
function
run
(
t
)
{
var
defProperties
=
t
.
properties
.
def
;
var
url
=
CROSSDOMAIN
+
'
./resources/check-origin.py
'
;
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
onload
=
t
.
step_func_done
(
function
()
{
var
response
=
JSON
.
parse
(
xhr
.
response
);
test
(
function
()
{
assert_true
(
response
);
},
defProperties
.
expandedName
+
'
-test-origin-present
'
);
});
xhr
.
onerror
=
function
()
{
assert_unreached
(
'
unable to load
'
+
url
);
};
xhr
.
send
();
}
tests/origin/origin-ProtocolOrigin.html
0 → 100644
View file @
85c1791b
<!-- Copyright (C) 2014, Cable Television Laboratories, Inc. & Skynav, Inc. -->
<!-- DO NOT EDIT! This test was generated by $(CVP2TS)/tools/level2/generate/generate.js. -->
<!doctype html>
<meta
charset=
'utf-8'
>
<title>
Test ProtocolOrigin
</title>
<script
src=
'/resources/testharness.js'
></script>
<script
src=
'/resources/testharnessreport.js'
></script>
<script
src=
'/tools/common/level3.js'
></script>
<script
src=
'/tools/common/crossdomain.js?pipe=sub'
></script>
<script
src=
'./helpers/ProtocolOrigin.js'
></script>
<script
type=
'text/plain'
id=
'testDef'
>
{
"
name
"
:
"
ProtocolOrigin
"
,
"
helper
"
:
"
ProtocolOrigin
"
,
"
code
"
:
"
run(t)
"
,
"
async
"
:
true
}
</script>
<h1>
Test ProtocolOrigin Support
</h1>
<div
id=
'log'
></div>
<script>
level3Async
(
'
origin
'
,
JSON
.
parse
(
document
.
getElementById
(
'
testDef
'
).
textContent
),
function
(
t
){
return
run
(
t
);});
</script>
tests/origin/resources/check-origin.py
0 → 100644
View file @
85c1791b
def
main
(
request
,
response
):
response
.
headers
.
set
(
"Content-Type"
,
"text/plain"
)
origin
=
request
.
headers
.
get
(
"origin"
)
if
origin
is
not
None
:
response
.
headers
.
set
(
"Access-Control-Allow-Origin"
,
origin
)
body
=
"true"
else
:
body
=
"false"
return
body
tools/common/crossdomain.js
0 → 100644
View file @
85c1791b
function
dirname
(
path
)
{
return
path
.
replace
(
/
\/[^\/]
*$/
,
'
/
'
)
}
var
SUBDOMAIN
=
'
www1
'
var
PORT
=
{{
ports
[
http
][
1
]}}
var
CROSSDOMAIN
=
dirname
(
location
.
href
).
replace
(
'
://
'
,
'
://
'
+
SUBDOMAIN
+
'
.
'
)
var
REMOTE_HOST
=
SUBDOMAIN
+
'
.
'
+
location
.
host
var
REMOTE_PROTOCOL
=
location
.
protocol
var
REMOTE_ORIGIN
=
REMOTE_PROTOCOL
+
'
//
'
+
REMOTE_HOST
tools/level3/generate/generate.js
View file @
85c1791b
...
...
@@ -37,6 +37,7 @@
var
defaults
=
{
configFile
:
undefined
,
configFileEncoding
:
'
utf8
'
,
crossDomainSupport
:
false
,
helpers3
:
undefined
,
level
:
3
,
local
:
undefined
,
...
...
@@ -171,6 +172,8 @@
html
+=
"
<script src='/resources/testharness.js'></script>
\n
"
;
html
+=
"
<script src='/resources/testharnessreport.js'></script>
\n
"
;
html
+=
"
<script src='/tools/common/level3.js'></script>
\n
"
;
if
(
$
.
options
[
'
crossDomainSupport
'
])
html
+=
"
<script src='/tools/common/crossdomain.js?pipe=sub'></script>
\n
"
;
if
(
!!
helper
)
html
+=
"
<script src='./helpers/
"
+
helper
+
"
.js'></script>
\n
"
;
html
+=
"
<script type='text/plain' id='testDef'>
\n
"
;
...
...
tools/w3c/scripts/server.config.default.json
View file @
85c1791b
...
...
@@ -5,6 +5,6 @@
"https"
:
[
"auto"
]
},
"check_subdomains"
:
true
,
"log_level"
:
"
debug
"
,
"log_level"
:
"
info
"
,
"bind_hostname"
:
true
}
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