removed race condition possibility from auth cache test & fixed up test errors

This commit is contained in:
Bryan Gilbert 2016-09-15 16:47:05 -04:00
parent 712b1d5ea0
commit 715682c3a8
4 changed files with 40 additions and 22 deletions

View file

@ -1533,7 +1533,7 @@ fn test_if_auth_creds_not_in_url_but_in_cache_it_sets_it() {
password: "test".to_owned(), password: "test".to_owned(),
}; };
http_state.auth_cache.write().unwrap().entries.insert(url.origin().clone(), auth_entry); http_state.auth_cache.write().unwrap().entries.insert(url.origin().clone().ascii_serialization(), auth_entry);
let mut load_data = LoadData::new(LoadContext::Browsing, url, &HttpTest); let mut load_data = LoadData::new(LoadContext::Browsing, url, &HttpTest);
load_data.credentials_flag = true; load_data.credentials_flag = true;

View file

@ -37479,14 +37479,6 @@
"deleted": [], "deleted": [],
"deleted_reftests": {}, "deleted_reftests": {},
"items": { "items": {
"testharness": {
"dom/lists/DOMTokenList-Iterable.html": [
{
"path": "dom/lists/DOMTokenList-Iterable.html",
"url": "/dom/lists/DOMTokenList-Iterable.html"
}
]
},
"reftest": { "reftest": {
"http/basic-auth-cache-test.html": [ "http/basic-auth-cache-test.html": [
{ {
@ -37500,10 +37492,18 @@
"url": "/http/basic-auth-cache-test.html" "url": "/http/basic-auth-cache-test.html"
} }
] ]
},
"testharness": {
"dom/lists/DOMTokenList-Iterable.html": [
{
"path": "dom/lists/DOMTokenList-Iterable.html",
"url": "/dom/lists/DOMTokenList-Iterable.html"
}
]
} }
}, },
"reftest_nodes": { "reftest_nodes": {
"http/reftest-basic-auth-cache-test.html": [ "http/basic-auth-cache-test.html": [
{ {
"path": "http/basic-auth-cache-test.html", "path": "http/basic-auth-cache-test.html",
"references": [ "references": [

View file

@ -1,6 +1,9 @@
<!doctype html> <!doctype html>
<meta charset="utf-8">
<html> <html>
<head>
<meta charset="utf-8">
</head>
<img src="resources/image.png"> <img src="resources/image.png">
<img src="resources/image.png"> <img src="resources/image.png">
</html> </html>

View file

@ -1,15 +1,30 @@
<!doctype html> <!doctype html>
<meta charset="utf-8"> <html id="doc" class="reftest-wait">
<link rel="match" href="basic-auth-cache-test-ref.html"> <head>
<html> <meta charset="utf-8">
<div id="auth"> </div> </head>
<div id="noauth"> </div>
<link rel="match" href="basic-auth-cache-test-ref.html">
<img id="auth" onload="loadNoAuth()">
<img id="noauth" onload="removeWait()">
<script type="text/javascript"> <script type="text/javascript">
var authImg = '<img src="http://testuser:testpass@' + window.location.host + '/http/resources/securedimage.py">'; function loadAuth() {
document.getElementById('auth').innerHTML = authImg; var authUrl = 'http://testuser:testpass@' + window.location.host + '/http/resources/securedimage.py';
setTimeout(function() { document.getElementById('auth').src = authUrl;
var noAuthImg = '<img src="http://' + window.location.host + '/http/resources/securedimage.py">'; }
document.getElementById('noauth').innerHTML = noAuthImg;
}, 100); function loadNoAuth() {
var noAuthUrl = 'http://' + window.location.host + '/http/resources/securedimage.py';
document.getElementById('noauth').src = noAuthUrl;
}
function removeWait() {
document.getElementById('doc').className = "";
}
window.onload = loadAuth;
</script> </script>
</html> </html>