Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -626,6 +626,7 @@ namespace MonoTests.System.Net {
Assert.AreEqual (1, coll.Count, "#A2");
}
[Test]
public void Add6_Insecure ()
{
var cc = new CookieContainer ();
@@ -667,7 +668,6 @@ namespace MonoTests.System.Net {
}
[Test]
// [Category ("NotWorking")]
public void TestAddExpired_Cookie ()
{
CookieContainer cc = new CookieContainer ();
@@ -1410,55 +1410,6 @@ namespace MonoTests.System.Net {
Assert.AreEqual (1, cookies.Count, "#A4");
}
#if FIXME
[Test]
public void SetCookies_Domain_Local ()
{
CookieContainer cc;
CookieCollection cookies;
string hostname = Dns.GetHostName ();
cc = new CookieContainer ();
cc.SetCookies (new Uri ("http://localhost/Whatever/Do"),
"Age=26; path=/Whatever; domain=.local");
cookies = cc.GetCookies (new Uri ("http://localhost/Whatever/Do"));
Assert.IsNotNull (cookies, "#A1");
Assert.AreEqual (0, cookies.Count, "#A2");
cookies = cc.GetCookies (new Uri ("http://127.0.0.1/Whatever/Do"));
Assert.IsNotNull (cookies, "#A3");
Assert.AreEqual (0, cookies.Count, "#A4");
cookies = cc.GetCookies (new Uri ("http://" + hostname + "/Whatever/Do"));
Assert.IsNotNull (cookies, "#A5");
Assert.AreEqual (hostname.EndsWith (".local") ? 1 : 0, cookies.Count, "#A6");
cc = new CookieContainer ();
cc.SetCookies (new Uri ("http://127.0.0.1/Whatever/Do"),
"Age=26; path=/Whatever; domain=.local");
cookies = cc.GetCookies (new Uri ("http://localhost/Whatever/Do"));
Assert.IsNotNull (cookies, "#B1");
Assert.AreEqual (0, cookies.Count, "#B2");
cookies = cc.GetCookies (new Uri ("http://127.0.0.1/Whatever/Do"));
Assert.IsNotNull (cookies, "#B3");
Assert.AreEqual (0, cookies.Count, "#B4");
cookies = cc.GetCookies (new Uri ("http://" + hostname + "/Whatever/Do"));
Assert.IsNotNull (cookies, "#B5");
Assert.AreEqual (hostname.EndsWith (".local") ? 1 : 0, cookies.Count, "#B6");
cc = new CookieContainer ();
cc.SetCookies (new Uri ("http://" + hostname + "/Whatever/Do"),
"Age=26; path=/Whatever; domain=.local");
cookies = cc.GetCookies (new Uri ("http://localhost/Whatever/Do"));
Assert.IsNotNull (cookies, "#C1");
Assert.AreEqual (0, cookies.Count, "#C2");
cookies = cc.GetCookies (new Uri ("http://127.0.0.1/Whatever/Do"));
Assert.IsNotNull (cookies, "#C3");
Assert.AreEqual (0, cookies.Count, "#C4");
cookies = cc.GetCookies (new Uri ("http://" + hostname + "/Whatever/Do"));
Assert.IsNotNull (cookies, "#C5");
Assert.AreEqual (hostname.EndsWith (".local") ? 1 : 0, cookies.Count, "#C6");
}
#endif
[Test]
public void bug421827 ()
{
@@ -1529,7 +1480,7 @@ namespace MonoTests.System.Net {
Cookie cookie = new Cookie ("name", "value")
{
Domain = ".example.com",
Expires = new DateTime (2015, 1, 1, 0, 0, 0, DateTimeKind.Utc),
Expires = new DateTime (2100, 1, 1, 0, 0, 0, DateTimeKind.Utc),
HttpOnly = true,
Secure = true,
};
@@ -1562,14 +1513,14 @@ namespace MonoTests.System.Net {
Cookie cookie = new Cookie ("name", "value")
{
Domain = ".example.com",
Expires = new DateTime (2015, 1, 1, 0, 0, 0, DateTimeKind.Utc),
Expires = new DateTime (2100, 1, 1, 0, 0, 0, DateTimeKind.Utc),
HttpOnly = true,
Secure = true,
};
Uri uri = new Uri ("https://www.example.com/path/file");
CookieContainer container = new CookieContainer ();
container.SetCookies (uri, "name=value; domain=.example.com; expires=Thu, 01-Jan-2015 00:00:00 GMT; HttpOnly; secure");
container.SetCookies (uri, "name=value; domain=.example.com; expires=Fri, 01-Jan-2100 00:00:00 GMT; HttpOnly; secure");
CookieCollection collection = container.GetCookies (uri);
Assert.AreEqual (collection.Count, 1, "#A1");
Cookie cloned = collection [0];

View File

@@ -32,9 +32,7 @@ namespace MonoTests.System.Net
Assert.IsFalse (c.Discard, "#A7");
Assert.IsFalse (c.Expired, "#A8");
Assert.AreEqual (DateTime.MinValue, c.Expires, "#A9");
#if NET_2_0
Assert.IsFalse (c.HttpOnly, "#A10");
#endif
Assert.AreEqual (string.Empty, c.Path, "#A11");
Assert.IsFalse (c.Secure, "#A12");
Assert.AreEqual (0, c.Version, "#A13");

View File

@@ -99,7 +99,6 @@ public class CredentialCacheTest
Console.WriteLine (e.Current.GetType () + " : " + e.Current.ToString ());
}
*/
#if NET_2_0
result = c.GetCredential ("www.ximian.com", 80, "Basic");
Assert.IsTrue (result == null, "#18");
@@ -117,7 +116,6 @@ public class CredentialCacheTest
c.Add ("www.contoso.com", 80, "Basic", cred5);
result = c.GetCredential (new Uri("http://www.contoso.com"), "Basic");
Assert.IsTrue (result == null, "#21");
#endif
}
}

View File

@@ -112,13 +112,9 @@ namespace MonoCasTests.System.Net {
[Test]
[DnsPermission (SecurityAction.Deny, Unrestricted = true)]
#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
// so it's not a declarative attribute on the method as the
// null check is done before throwing the SecurityException
#else
[ExpectedException (typeof (SecurityException))]
#endif
public void Deny_GetHostByName_Null ()
{
Dns.GetHostByName (null);
@@ -151,7 +147,6 @@ namespace MonoCasTests.System.Net {
Dns.Resolve (null);
}
#if NET_2_0
// TODO: New 2.0 methods aren't yet implemented in Mono
/*
[Test]
@@ -218,7 +213,6 @@ namespace MonoCasTests.System.Net {
Dns.GetHostAddresses (null);
}
*/
#endif
// ensure that only DnsPermission is required to call the methods
@@ -277,7 +271,6 @@ namespace MonoCasTests.System.Net {
Dns.Resolve (null);
}
#if NET_2_0
// TODO: New 2.0 methods aren't yet implemented in Mono
/*
[Test]
@@ -344,7 +337,6 @@ namespace MonoCasTests.System.Net {
Dns.GetHostAddresses (null);
}
*/
#endif
// async tests (for stack propagation)
@@ -415,7 +407,6 @@ namespace MonoCasTests.System.Net {
Assert.IsNull (message, message);
}
#if NET_2_0
// TODO: New 2.0 methods aren't yet implemented in Mono
/*
[DnsPermission (SecurityAction.Deny, Unrestricted = true)]
@@ -500,7 +491,6 @@ namespace MonoCasTests.System.Net {
Assert.IsNull (message, message);
}
*/
#endif
}
}

View File

@@ -72,7 +72,6 @@ namespace MonoTests.System.Net
SubTestValidIPHostEntry (h);
}
#if NET_2_0
[Test]
public void BeginGetHostAddresses_HostNameOrAddress_Null ()
{
@@ -179,7 +178,6 @@ namespace MonoTests.System.Net
Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#B5");
}
}
#endif
[Test]
public void GetHostName ()

View File

@@ -354,17 +354,9 @@ namespace MonoTests.System.Net
} catch (ArgumentException ex) {
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.Message, "#3");
#if NET_2_0
Assert.IsFalse (ex.Message == "value", "#4");
#else
Assert.AreEqual ("value", ex.Message, "#4");
#endif
#if NET_2_0
Assert.IsNotNull (ex.ParamName, "#5");
Assert.AreEqual ("value", ex.ParamName, "#6");
#else
Assert.IsNull (ex.ParamName, "#5");
#endif
Assert.IsNull (ex.InnerException, "#7");
}
}
@@ -420,7 +412,6 @@ namespace MonoTests.System.Net
try {
fsA = req.GetRequestStream () as FileStream;
Assert.IsNotNull (fsA, "#A1");
#if NET_2_0
try {
req.GetRequestStream ();
Assert.Fail ("#A2");
@@ -435,11 +426,6 @@ namespace MonoTests.System.Net
// Cannot re-call BeginGetRequestStream/BeginGetResponse
// while a previous call is still in progress.
}
#else
fsB = req.GetRequestStream () as FileStream;
Assert.IsNotNull (fsB, "#A2");
Assert.AreSame (fsA, fsB, "#A3");
#endif
} finally {
if (fsA != null)
fsA.Close ();
@@ -454,7 +440,6 @@ namespace MonoTests.System.Net
fsA = req.GetRequestStream () as FileStream;
Assert.IsNotNull (fsA, "#B1");
fsA.Close ();
#if NET_2_0
try {
req.GetRequestStream ();
Assert.Fail ("#B2");
@@ -469,11 +454,6 @@ namespace MonoTests.System.Net
// Cannot re-call BeginGetRequestStream/BeginGetResponse
// while a previous call is still in progress.
}
#else
fsB = req.GetRequestStream () as FileStream;
Assert.IsNotNull (fsB, "#B2");
Assert.AreSame (fsA, fsB, "#B3");
#endif
} finally {
if (fsA != null)
fsA.Close ();
@@ -508,13 +488,10 @@ namespace MonoTests.System.Net
Assert.IsNotNull (s, "#1:" + method);
Assert.IsFalse (s.CanRead, "#2:" + method);
Assert.IsTrue (s.CanSeek, "#3:" + method);
#if NET_2_0
Assert.IsFalse (s.CanTimeout, "#4:" + method);
#endif
Assert.IsTrue (s.CanWrite, "#5:" + method);
Assert.AreEqual (0, s.Length, "#6:" + method);
Assert.AreEqual (0, s.Position, "#7:" + method);
#if NET_2_0
try {
int i = s.ReadTimeout;
Assert.Fail ("#8:" + method + "=>" + i);
@@ -525,7 +502,6 @@ namespace MonoTests.System.Net
Assert.Fail ("#9:" + method + "=>" + i);
} catch (InvalidOperationException) {
}
#endif
}
}
}
@@ -586,16 +562,6 @@ namespace MonoTests.System.Net
Assert.IsNull (ex.Response, "#4");
Assert.IsNotNull (ex.InnerException, "#5");
#if ONLY_1_1
FileNotFoundException fnf = ex.InnerException as FileNotFoundException;
Assert.IsNotNull (fnf, "#6");
Assert.AreEqual (typeof (FileNotFoundException), fnf.GetType (), "#7");
Assert.IsNotNull (fnf.FileName, "#8");
Assert.IsTrue (fnf.FileName.IndexOf ("FileWebRequestTest.tmp") != -1, "#9");
Assert.IsNotNull (fnf.Message, "#10");
Assert.IsTrue (fnf.Message.IndexOf ("FileWebRequestTest.tmp") != -1, "#11");
Assert.IsNull (fnf.InnerException, "#12");
#endif
}
}
@@ -623,11 +589,7 @@ namespace MonoTests.System.Net
} catch (ArgumentException ex) {
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.Message, "#3");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#4");
#else
Assert.IsNull (ex.ParamName, "#4");
#endif
Assert.IsNull (ex.InnerException, "#5");
}
}
@@ -642,11 +604,7 @@ namespace MonoTests.System.Net
} catch (ArgumentException ex) {
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNotNull (ex.Message, "#3");
#if NET_2_0
Assert.AreEqual ("value", ex.ParamName, "#4");
#else
Assert.IsNull (ex.ParamName, "#4");
#endif
Assert.IsNull (ex.InnerException, "#5");
}
}
@@ -702,11 +660,7 @@ namespace MonoTests.System.Net
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
#if NET_2_0
Assert.IsFalse (ex.ParamName == "value", "#6");
#else
Assert.AreEqual ("value", ex.ParamName, "#6");
#endif
Assert.IsNull (ex.InnerException, "#7");
}
}
@@ -776,11 +730,7 @@ namespace MonoTests.System.Net
case 8:
Assert.AreEqual ("preauthenticate", entry.Name, "#B4:" + i);
Assert.AreEqual (typeof (bool), entry.ObjectType, "#B5:" + i);
#if NET_2_0
Assert.AreEqual (false, entry.Value, "#B6:" + i);
#else
Assert.AreEqual (true, entry.Value, "#B6:" + i);
#endif
break;
}
i++;
@@ -828,11 +778,7 @@ namespace MonoTests.System.Net
Assert.AreEqual ("image/png", req.ContentType, "#A3");
Assert.IsNull (req.Credentials, "#A4");
Assert.AreEqual ("PUT", req.Method, "#A5");
#if NET_2_0
Assert.IsFalse (req.PreAuthenticate, "#A6");
#else
Assert.IsTrue (req.PreAuthenticate, "#A6");
#endif
Assert.AreEqual ("file://test.txt/", req.RequestUri.AbsoluteUri, "#A7");
Assert.AreEqual (20, req.Timeout, "#A8");
@@ -877,7 +823,6 @@ namespace MonoTests.System.Net
}
private static readonly byte [] _serialized = new byte [] {
#if NET_2_0
0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
0x49, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x20, 0x56, 0x65,
@@ -949,77 +894,6 @@ namespace MonoTests.System.Net
0x00, 0x00, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x68, 0x74, 0x74,
0x70, 0x3a, 0x2f, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x78,
0x69, 0x6d, 0x69, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x0b
#else
0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
0x4c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x20, 0x56, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e, 0x30, 0x2e, 0x35,
0x30, 0x30, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74,
0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c,
0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x37, 0x37, 0x61, 0x35,
0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39,
0x05, 0x01, 0x00, 0x00, 0x00, 0x19, 0x53, 0x79, 0x73, 0x74, 0x65,
0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x57,
0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x09, 0x00,
0x00, 0x00, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x05,
0x70, 0x72, 0x6f, 0x78, 0x79, 0x03, 0x75, 0x72, 0x69, 0x13, 0x63,
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72,
0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x06, 0x6d, 0x65, 0x74,
0x68, 0x6f, 0x64, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x07, 0x74, 0x69, 0x6d, 0x65,
0x6f, 0x75, 0x74, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x63,
0x65, 0x73, 0x73, 0x0f, 0x70, 0x72, 0x65, 0x61, 0x75, 0x74, 0x68,
0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x04, 0x04, 0x04,
0x01, 0x01, 0x00, 0x00, 0x03, 0x00, 0x1e, 0x53, 0x79, 0x73, 0x74,
0x65, 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x48,
0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x02, 0x00, 0x00, 0x00, 0x13, 0x53, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65,
0x62, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x02, 0x00, 0x00, 0x00, 0x0a,
0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x55, 0x72, 0x69, 0x02,
0x00, 0x00, 0x00, 0x09, 0x08, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65,
0x6d, 0x2e, 0x49, 0x4f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63,
0x63, 0x65, 0x73, 0x73, 0x01, 0x02, 0x00, 0x00, 0x00, 0x09, 0x03,
0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0x09, 0x05, 0x00,
0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x03, 0x43, 0x47, 0x4e,
0x06, 0x07, 0x00, 0x00, 0x00, 0x03, 0x50, 0x55, 0x54, 0x0a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04,
0xf8, 0xff, 0xff, 0xff, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
0x2e, 0x49, 0x4f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x63,
0x65, 0x73, 0x73, 0x01, 0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x5f, 0x5f, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x01,
0x05, 0x03, 0x00, 0x00, 0x00, 0x1e, 0x53, 0x79, 0x73, 0x74, 0x65,
0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x48, 0x65,
0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x05, 0x00, 0x00, 0x00, 0x05, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x01, 0x30, 0x01, 0x32, 0x01, 0x31, 0x01, 0x33, 0x00,
0x01, 0x01, 0x01, 0x01, 0x08, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x06, 0x09, 0x00, 0x00, 0x00, 0x0c, 0x43, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79, 0x70, 0x65, 0x06, 0x0a,
0x00, 0x00, 0x00, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70,
0x6e, 0x67, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x44, 0x69, 0x73,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x06, 0x0c, 0x00,
0x00, 0x00, 0x06, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x05, 0x04,
0x00, 0x00, 0x00, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e,
0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x50, 0x72, 0x6f, 0x78,
0x79, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x5f, 0x42, 0x79, 0x70, 0x61,
0x73, 0x73, 0x4f, 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x0d, 0x5f,
0x50, 0x72, 0x6f, 0x78, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x0b, 0x5f, 0x42, 0x79, 0x70, 0x61, 0x73, 0x73, 0x4c, 0x69,
0x73, 0x74, 0x00, 0x04, 0x02, 0x01, 0x0a, 0x53, 0x79, 0x73, 0x74,
0x65, 0x6d, 0x2e, 0x55, 0x72, 0x69, 0x02, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x09, 0x0d, 0x00, 0x00, 0x00, 0x0a, 0x05,
0x05, 0x00, 0x00, 0x00, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
0x2e, 0x55, 0x72, 0x69, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x41, 0x62,
0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x55, 0x72, 0x69, 0x01, 0x02,
0x00, 0x00, 0x00, 0x06, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x66, 0x69,
0x6c, 0x65, 0x3a, 0x2f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74,
0x78, 0x74, 0x2f, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00,
0x00, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x68, 0x74, 0x74, 0x70,
0x3a, 0x2f, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x78, 0x69,
0x6d, 0x69, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x0b
#endif
};
}
}

View File

@@ -122,13 +122,10 @@ namespace MonoTests.System.Net
Assert.IsNotNull (fsA, "#A1");
Assert.IsTrue (fsA.CanRead, "#A2");
Assert.IsTrue (fsA.CanSeek, "#A3");
#if NET_2_0
Assert.IsFalse (fsA.CanTimeout, "#A4");
#endif
Assert.IsFalse (fsA.CanWrite, "#A5");
Assert.AreEqual (3, fsA.Length, "#A6");
Assert.AreEqual (0, fsA.Position, "#A7");
#if NET_2_0
try {
int i = fsA.ReadTimeout;
Assert.Fail ("#A8:" + i);
@@ -139,20 +136,16 @@ namespace MonoTests.System.Net
Assert.Fail ("#A9:" + i);
} catch (InvalidOperationException) {
}
#endif
respB = (FileWebResponse) req.GetResponse ();
fsB = respB.GetResponseStream () as FileStream;
Assert.IsNotNull (fsB, "#B1");
Assert.IsTrue (fsB.CanRead, "#B2");
Assert.IsTrue (fsB.CanSeek, "#B3");
#if NET_2_0
Assert.IsFalse (fsB.CanTimeout, "#B4");
#endif
Assert.IsFalse (fsB.CanWrite, "#B5");
Assert.AreEqual (3, fsB.Length, "#B6");
Assert.AreEqual (0, fsB.Position, "#B7");
#if NET_2_0
try {
int i = fsB.ReadTimeout;
Assert.Fail ("#B8:" + i);
@@ -163,7 +156,6 @@ namespace MonoTests.System.Net
Assert.Fail ("#B9:" + i);
} catch (InvalidOperationException) {
}
#endif
} finally {
if (respA != null)
respA.Close ();

View File

@@ -7,7 +7,6 @@
//
// Copyright (c) 2006,2007,2008 Novell, Inc. (http://www.novell.com)
//
#if NET_2_0
using NUnit.Framework;
using System;
using System.Collections.Generic;
@@ -687,5 +686,4 @@ namespace MonoTests.System.Net
}
}
#endif

View File

@@ -26,7 +26,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Net;
using NUnit.Framework;
@@ -72,5 +71,4 @@ namespace MonoTests.System.Net {
}
}
}
#endif

View File

@@ -26,7 +26,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Net;
using NUnit.Framework;
@@ -248,5 +247,4 @@ namespace MonoTests.System.Net {
}
}
}
#endif

View File

@@ -26,7 +26,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Net;
using System.Net.Sockets;
@@ -474,7 +473,57 @@ namespace MonoTests.System.Net {
Event.Close ();
}
}
[Test]
public void ConnectionReuse ()
{
var uri = "http://localhost:1338/";
HttpListener listener = new HttpListener ();
listener.Prefixes.Add (uri);
listener.Start ();
IPEndPoint expectedIpEndPoint = CreateListenerRequest (listener, uri);
Assert.AreEqual (expectedIpEndPoint, CreateListenerRequest (listener, uri), "reuse1");
Assert.AreEqual (expectedIpEndPoint, CreateListenerRequest (listener, uri), "reuse2");
}
public IPEndPoint CreateListenerRequest (HttpListener listener, string uri)
{
IPEndPoint ipEndPoint = null;
listener.BeginGetContext ((result) => ipEndPoint = ListenerCallback (result), listener);
var request = (HttpWebRequest) WebRequest.Create (uri);
request.Method = "POST";
// We need to write something
request.GetRequestStream ().Write (new byte [] {(byte)'a'}, 0, 1);
request.GetRequestStream ().Dispose ();
// Send request, socket is created or reused.
var response = request.GetResponse ();
// Close response so socket can be reused.
response.Close ();
return ipEndPoint;
}
public static IPEndPoint ListenerCallback (IAsyncResult result)
{
var listener = (HttpListener) result.AsyncState;
var context = listener.EndGetContext (result);
var clientEndPoint = context.Request.RemoteEndPoint;
// Disposing InputStream should not avoid socket reuse
context.Request.InputStream.Dispose ();
// Close OutputStream to send response
context.Response.OutputStream.Close ();
return clientEndPoint;
}
}
}
#endif

View File

@@ -1 +1 @@
889ad1b0a7c9785aae07b1b882ea1fc00716d176
326ff298024580ff7205d0cafe3cd61ce9165310

View File

@@ -272,7 +272,6 @@ namespace MonoTests.System.Net
HttpWebResponse resp = (HttpWebResponse) req.GetResponse ();
((IDisposable) resp).Dispose ();
#if NET_2_0
WebHeaderCollection headers = resp.Headers;
Assert.AreEqual (6, headers.Count, "#1");
Assert.AreEqual ("9", headers ["Content-Length"], "#2");
@@ -281,17 +280,6 @@ namespace MonoTests.System.Net
Assert.AreEqual ("Wed, 08 Jan 2003 23:11:55 GMT", headers ["Last-Modified"], "#5");
Assert.AreEqual ("UserID=Miguel,StoreProfile=true", headers ["Set-Cookie"], "#6");
Assert.AreEqual ("Mono/Test", headers ["Server"], "#7");
#else
try {
WebHeaderCollection headers = resp.Headers;
Assert.Fail ("#1:" + headers);
} catch (ObjectDisposedException ex) {
Assert.AreEqual (typeof (ObjectDisposedException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.AreEqual (typeof (HttpWebResponse).FullName, ex.ObjectName, "#5");
}
#endif
}
}
@@ -664,7 +652,6 @@ namespace MonoTests.System.Net
}
}
#if NET_2_0
[Test] // bug #324182
public void CanTimeout ()
{
@@ -693,7 +680,6 @@ namespace MonoTests.System.Net
}
}
}
#endif
[Test]
public void CanWrite ()
@@ -1088,7 +1074,6 @@ namespace MonoTests.System.Net
}
}
#if NET_2_0
[Test]
public void ReadTimeout ()
{
@@ -1117,7 +1102,6 @@ namespace MonoTests.System.Net
}
}
}
#endif
[Test]
public void Write ()
@@ -1153,7 +1137,6 @@ namespace MonoTests.System.Net
}
}
#if NET_2_0
[Test]
public void WriteTimeout ()
{
@@ -1182,6 +1165,5 @@ namespace MonoTests.System.Net
}
}
}
#endif
}
}

View File

@@ -146,7 +146,6 @@ public class ServicePointTest
}
}
#if NET_2_0
[Test]
[Category ("InetAccess")]
public void EndPointBind ()
@@ -177,7 +176,6 @@ public class ServicePointTest
Assert.IsTrue (called);
}
#endif
// Debug code not used now, but could be useful later
/*

File diff suppressed because it is too large Load Diff

View File

@@ -95,7 +95,6 @@ namespace MonoTests.System.Net {
Assert.IsFalse (wp.IsUnrestricted (), "!IsUnrestricted");
}
#if NET_2_0
[Test]
public void Accept_Null ()
{
@@ -104,31 +103,6 @@ namespace MonoTests.System.Net {
Assert.IsNull (a.Accept, "Accept");
Assert.IsNull (a.Connect, "Connect");
}
#else
[Test]
// Strangely, although you can set Accept to value of null, you cannot
// then examine the value without throwing a NullRef
[ExpectedException (typeof (NullReferenceException))]
public void Accept_Null ()
{
WebPermissionAttribute a = new WebPermissionAttribute (SecurityAction.Assert);
a.Accept = null; // legal
Assert.IsNull (a.Connect, "Connect");
}
[Test]
// Strangely, although you can set Accept to value of null, you cannot
// then examine the value without throwing a NullRef
[ExpectedException (typeof (NullReferenceException))]
public void Accept_Null2 ()
{
WebPermissionAttribute a = new WebPermissionAttribute (SecurityAction.Assert);
a.Accept = null; // legal
Assert.IsNull (a.Accept, "Accept");
}
#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
@@ -172,7 +146,6 @@ namespace MonoTests.System.Net {
a.AcceptPattern = "\\";
}
#if NET_2_0
[Test]
public void AcceptPattern ()
{
@@ -181,7 +154,6 @@ namespace MonoTests.System.Net {
Assert.AreEqual ("\b(?", a.AcceptPattern, "AcceptPattern");
Assert.IsNull (a.ConnectPattern, "ConnectPattern");
}
#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
@@ -201,7 +173,6 @@ namespace MonoTests.System.Net {
a.Accept = "\\";
}
#if NET_2_0
[Test]
public void Connect_Null ()
{
@@ -210,25 +181,6 @@ namespace MonoTests.System.Net {
Assert.IsNull (a.Accept, "Accept");
Assert.IsNull (a.Connect, "Connect");
}
#else
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void Connect_Null ()
{
WebPermissionAttribute a = new WebPermissionAttribute (SecurityAction.Assert);
a.Connect = null; // legal
Assert.IsNull (a.Accept, "Accept");
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void Connect_Null2 ()
{
WebPermissionAttribute a = new WebPermissionAttribute (SecurityAction.Assert);
a.Connect = null; // legal
Assert.IsNull (a.Connect, "Connect");
}
#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
@@ -248,7 +200,6 @@ namespace MonoTests.System.Net {
a.Connect = null;
}
#if NET_2_0
[Test]
public void Connect ()
{
@@ -257,7 +208,6 @@ namespace MonoTests.System.Net {
Assert.IsNull (a.Accept, "Accept");
Assert.AreEqual ("/", a.Connect, "Connect");
}
#endif
[Test]
[ExpectedException (typeof (ArgumentNullException))]
@@ -276,7 +226,6 @@ namespace MonoTests.System.Net {
a.ConnectPattern = "\\";
}
#if NET_2_0
[Test]
public void ConnectPattern ()
{
@@ -285,7 +234,6 @@ namespace MonoTests.System.Net {
Assert.IsNull (a.AcceptPattern, "AcceptPattern");
Assert.AreEqual ("\b(?", a.ConnectPattern, "ConnectPattern");
}
#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
@@ -305,7 +253,6 @@ namespace MonoTests.System.Net {
a.Connect = "\\";
}
#if NET_2_0
[Test]
public void CreatePermission_InvalidRegex ()
{
@@ -315,7 +262,6 @@ namespace MonoTests.System.Net {
WebPermission wp = (WebPermission) a.CreatePermission ();
Assert.IsNotNull (wp, "CreatePermission");
}
#endif
[Test]
public void Attributes ()

View File

@@ -177,7 +177,6 @@ namespace MonoTests.System.Net
try {
p.IsBypassed (null);
Assert.Fail ("#A1");
#if NET_2_0
} catch (ArgumentNullException ex) {
Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
Assert.IsNotNull (ex.Message, "#A3");
@@ -185,16 +184,11 @@ namespace MonoTests.System.Net
Assert.AreEqual ("host", ex.ParamName, "#A5");
Assert.IsNull (ex.InnerException, "#A6");
}
#else
} catch (NullReferenceException) {
}
#endif
p = new WebProxy ((Uri) null);
try {
p.IsBypassed (null);
Assert.Fail ("#B1");
#if NET_2_0
} catch (ArgumentNullException ex) {
Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
@@ -202,16 +196,11 @@ namespace MonoTests.System.Net
Assert.AreEqual ("host", ex.ParamName, "#B5");
Assert.IsNull (ex.InnerException, "#B6");
}
#else
} catch (NullReferenceException) {
}
#endif
p = new WebProxy ((Uri) null, true);
try {
p.IsBypassed (null);
Assert.Fail ("#C1");
#if NET_2_0
} catch (ArgumentNullException ex) {
Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#C2");
Assert.IsNotNull (ex.Message, "#C3");
@@ -219,10 +208,6 @@ namespace MonoTests.System.Net
Assert.AreEqual ("host", ex.ParamName, "#C5");
Assert.IsNull (ex.InnerException, "#C6");
}
#else
} catch (NullReferenceException) {
}
#endif
}
[Test]
@@ -233,11 +218,7 @@ namespace MonoTests.System.Net
WebProxy proxy = new WebProxy ("proxy.ximian.com");
((ISerializable) proxy).GetObjectData (si, new StreamingContext ());
#if NET_2_0
Assert.AreEqual (4, si.MemberCount, "#A1");
#else
Assert.AreEqual (3, si.MemberCount, "#A1");
#endif
int i = 0;
foreach (SerializationEntry entry in si) {
Assert.IsNotNull (entry.Name, "#A2:" + i);
@@ -260,14 +241,12 @@ namespace MonoTests.System.Net
Assert.AreEqual (typeof (object), entry.ObjectType, "#A5:" + i);
Assert.IsNull (entry.Value, "#A6:" + i);
break;
#if NET_2_0
case 3:
Assert.AreEqual ("_UseDefaultCredentials", entry.Name, "#A4:" + i);
Assert.AreEqual (typeof (bool), entry.ObjectType, "#A5:" + i);
Assert.IsNotNull (entry.Value, "#A6:" + i);
Assert.AreEqual (false, entry.Value, "#A7:" + i);
break;
#endif
}
i++;
}

View File

@@ -46,16 +46,8 @@ namespace MonoTests.System.Net {
[Test]
public void SerializationConstructor ()
{
#if NET_2_0
NonAbstractWebRequest w = new NonAbstractWebRequest (null, new StreamingContext ());
Assert.IsNotNull (w);
#else
try {
new NonAbstractWebRequest (null, new StreamingContext ());
Assert.Fail ("#1");
} catch (NotImplementedException) {
}
#endif
}
// properties (only test 'get'ter)
@@ -207,10 +199,8 @@ namespace MonoTests.System.Net {
Assert.IsTrue (req is HttpWebRequest, "#2");
req = WebRequest.Create ("file://www.contoso.com");
Assert.IsTrue (req is FileWebRequest, "#3");
#if NET_2_0
req = WebRequest.Create ("ftp://www.contoso.com");
Assert.IsTrue (req is FtpWebRequest, "#4");
#endif
WebRequest.RegisterPrefix ("http://www.contoso.com", new TestWebRequestCreator ());
bool ret = WebRequest.RegisterPrefix ("http://WWW.contoso.com", new TestWebRequestCreator ());
Assert.AreEqual (false, ret, "#5a");
@@ -271,7 +261,6 @@ namespace MonoTests.System.Net {
}
}
#if NET_2_0
[Test]
public void DefaultWebProxy ()
{
@@ -295,7 +284,6 @@ namespace MonoTests.System.Net {
new Uri ("http://www.mono-project.com"));
Assert.IsNull (req.Proxy, "#D");
}
#endif
[Test]
public void RegisterPrefix_Creator_Null ()