Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@ -53,10 +53,13 @@ public class ServicePointTest
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
HttpWebResponse res = (HttpWebResponse) req.GetResponse ();
#if FOUND_SOME_OTHER_URL
// URL is no longer found, disabled the test until a more reliable URL is found :P
//WriteServicePoint ("google after getting a response", google);
ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));
Assert.AreEqual (google, google2, "#equals");
res.Close ();
#endif
// in both instances property CurrentConnections is 0 according to ms.net.
// let's see what it says when we do async operations...
@ -83,10 +86,11 @@ public class ServicePointTest
//Console.WriteLine ("ContentLength: " + res2.ContentLength);
res2.Close ();
ServicePoint sp2;
#if FOUND_SOME_OTHER_URL
// unless of course some buffering is taking place.. let's check
Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz");
ServicePoint sp2 = ServicePointManager.FindServicePoint (uri2);
sp2 = ServicePointManager.FindServicePoint (uri2);
req2 = (HttpWebRequest) WebRequest.Create (uri2);
async = req2.BeginGetResponse (null, null);
//WriteServicePoint ("Large file: after async BeginGetResponse", sp2);
@ -97,6 +101,7 @@ public class ServicePointTest
// and so it shows
//Console.WriteLine ("ContentLength: " + res2.ContentLength);
res2.Close ();
#endif
// what's the limit of the cache?
@ -148,6 +153,7 @@ public class ServicePointTest
[Test]
[Category ("InetAccess")]
[Category ("AndroidNotWorking")] // #A1 fails
public void EndPointBind ()
{
Uri uri = new Uri ("http://www.go-mono.com/");
@ -163,7 +169,7 @@ public class ServicePointTest
};
req.GetResponse ().Close ();
Assert.IsTrue (called);
Assert.IsTrue (called, "#A1");
req = (HttpWebRequest) WebRequest.Create (uri);
called = false;
@ -174,7 +180,29 @@ public class ServicePointTest
};
req.GetResponse ().Close ();
Assert.IsTrue (called);
Assert.IsTrue (called, "#A2");
}
public static void GetRequestStreamCallback (IAsyncResult asynchronousResult)
{
}
[Test] //Covers #19823
public void CloseConnectionGroupConcurency ()
{
// Try with multiple service points
for (var i = 0; i < 10; i++) {
Uri targetUri = new Uri ("http://" + i + ".mono-project.com");
var req = (HttpWebRequest) HttpWebRequest.Create (targetUri);
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
req.ConnectionGroupName = "" + i;
req.ServicePoint.MaxIdleTime = 1;
req.BeginGetRequestStream (new AsyncCallback (GetRequestStreamCallback), req);
Thread.Sleep (1);
req.ServicePoint.CloseConnectionGroup (req.ConnectionGroupName);
}
}
// Debug code not used now, but could be useful later