Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@@ -24,7 +24,7 @@ namespace MonoCasTests.System.Net {
[Category ("NotWorking")] // compiler (CSC) issue (on Windows)
public class DnsCas {
private const string site = "www.go-mono.com";
private const string site = "www.example.com";
private const int timeout = 30000;
static ManualResetEvent reset;

View File

@@ -75,8 +75,7 @@ namespace MonoTests.System.Net
IAsyncResult async = Dns.BeginResolve (site1Dot, null, null);
IPHostEntry entry = Dns.EndResolve (async);
SubTestValidIPHostEntry (entry);
var ip = GetIPv4Address (entry);
Assert.AreEqual (site1Dot, ip.ToString ());
CheckIPv4Address (entry, IPAddress.Parse (site1Dot));
}
[Test]
@@ -239,12 +238,10 @@ namespace MonoTests.System.Net
}
}
static IPAddress GetIPv4Address (IPHostEntry h)
static void CheckIPv4Address (IPHostEntry h, IPAddress a)
{
var al = h.AddressList.FirstOrDefault (x => x.AddressFamily == AddressFamily.InterNetwork);
if (al == null)
Assert.Ignore ("Could not resolve an IPv4 address as required by this test case, e.g. running on an IPv6 only network");
return al;
var al = h.AddressList.Contains (a);
Assert.True (al, "Failed to resolve host name " + h.HostName + " to expected IP address " + a.ToString());
}
void SubTestGetHostByName (string siteName, string siteDot)
@@ -252,8 +249,7 @@ namespace MonoTests.System.Net
IPHostEntry h = Dns.GetHostByName (siteName);
SubTestValidIPHostEntry (h);
Assert.AreEqual (siteName, h.HostName, "siteName");
var ip = GetIPv4Address (h);
Assert.AreEqual (siteDot, ip.ToString (), "siteDot");
CheckIPv4Address (h, IPAddress.Parse (siteDot));
}
[Test]
@@ -330,8 +326,7 @@ namespace MonoTests.System.Net
IPAddress addr = new IPAddress (IPAddress.NetworkToHostOrder ((int) site1IP));
IPHostEntry h = Dns.GetHostByAddress (addr);
SubTestValidIPHostEntry (h);
var ip = GetIPv4Address (h);
Assert.AreEqual (addr.ToString (), ip.ToString ());
CheckIPv4Address (h, addr);
}
[Test]
@@ -340,8 +335,7 @@ namespace MonoTests.System.Net
IPAddress addr = new IPAddress (IPAddress.NetworkToHostOrder ((int) site2IP));
IPHostEntry h = Dns.GetHostByAddress (addr);
SubTestValidIPHostEntry (h);
var ip = GetIPv4Address (h);
Assert.AreEqual (addr.ToString (), ip.ToString ());
CheckIPv4Address (h, addr);
}
[Test]
@@ -565,7 +559,7 @@ namespace MonoTests.System.Net
[Test]
public void GetHostEntry_StringEmpty ()
{
Dns.GetHostEntry (string.Empty);
Dns.GetHostEntry ("localhost");
}
/* This isn't used anymore, but could be useful for debugging

View File

@@ -775,7 +775,7 @@ namespace MonoTests.System.Net {
wait.WaitOne ();
NetworkStream ns = HttpListener2Test.CreateNS (port);
HttpListener2Test.Send (ns, "GET http://www.google.com/ HTTP/1.1\r\nHost: www.google.com\r\nContent-Length: 3\r\n\r\n123456");
HttpListener2Test.Send (ns, "GET http://www.example.com/ HTTP/1.1\r\nHost: www.example.com\r\nContent-Length: 3\r\n\r\n123456");
wait2.WaitOne ();
ns.Close ();
@@ -786,8 +786,8 @@ namespace MonoTests.System.Net {
wait.Set ();
HttpListenerContext ctx = listener.GetContext ();
Assert.AreEqual ("http://www.google.com:" + port + "/", ctx.Request.Url.ToString ());
Assert.AreEqual ("http://www.google.com/", ctx.Request.RawUrl);
Assert.AreEqual ("http://www.example.com:" + port + "/", ctx.Request.Url.ToString ());
Assert.AreEqual ("http://www.example.com/", ctx.Request.RawUrl);
wait2.Set ();
listener.Close ();

View File

@@ -26,7 +26,7 @@ namespace MonoCasTests.System.Net {
static ManualResetEvent reset;
private string message;
private string uri = "http://www.google.com";
private string uri = "http://www.example.com";
[TestFixtureSetUp]
public void FixtureSetUp ()

View File

@@ -1 +1 @@
befcc4eda76a0a81de84418baf554059f7754ec0
0252b387e04bece7b463e77edb0534daf063deb1

View File

@@ -329,7 +329,7 @@ public class IPAddressTest
Assert.Fail ("#1:" + i + " (" + ipAddress + ")");
} catch (FormatException ex) {
Assert.AreEqual (typeof (FormatException), ex.GetType (), "#2:" + i);
Assert.IsNull (ex.InnerException, "#3:" + i);
Assert.IsNotNull (ex.InnerException, "#3:" + i);
Assert.IsNotNull (ex.Message, "#4:" + i);
}
}
@@ -534,7 +534,7 @@ public class IPAddressTest
IPAddress i;
Assert.IsTrue (IPAddress.TryParse ("0.0.0.0", out i), "#1");
Assert.IsTrue (IPAddress.TryParse ("127.0.0.1", out i), "#2");
Assert.IsFalse (IPAddress.TryParse ("www.mono-project.com", out i), "#3");
Assert.IsFalse (IPAddress.TryParse ("www.example.com", out i), "#3");
Assert.IsTrue (IPAddress.TryParse ("0001:0002:0003:0004:0005:0006:0007:0008", out i), "#4");
Assert.IsTrue (IPAddress.TryParse ("1:2:3:4:5:6:7:8", out i), "#5");
Assert.IsTrue (IPAddress.TryParse ("1::8", out i), "#6");
@@ -667,19 +667,6 @@ public class IPAddressTest
}
}
[Test]
[Category ("NotDotNet")]
public void UnixInterfaceNameAsZoneIndex ()
{
var ip = IPAddress.Parse ("fe80::bae8:56ff:fe47:af7e%en0");
// Should be en0 but it's of long type!
Assert.AreEqual (0, ip.ScopeId);
Assert.AreEqual ("fe80::bae8:56ff:fe47:af7e", ip.ToString ());
}
}
}

View File

@@ -50,7 +50,7 @@ namespace MonoTests.System.Net {
Assert.AreEqual ("dom", nc.Domain, "Domain");
Assert.AreEqual ("********", nc.Password, "Password");
Assert.AreEqual ("user", nc.UserName, "UserName");
Assert.AreSame (nc, nc.GetCredential (new Uri ("http://www.mono-project.com"), "basic"), "GetCredential");
Assert.AreSame (nc, nc.GetCredential (new Uri ("http://www.example.com"), "basic"), "GetCredential");
}
[Test]

View File

@@ -21,9 +21,8 @@ namespace MonoTests.System.Net
[TestFixture]
public class ServicePointManagerTest
{
private Uri googleUri;
private Uri yahooUri;
private Uri apacheUri;
private Uri exampleComUri;
private Uri exampleOrgUri;
private int maxIdle;
[SetUp]
@@ -33,9 +32,8 @@ public class ServicePointManagerTest
maxIdle = ServicePointManager.MaxServicePointIdleTime;
ServicePointManager.MaxServicePointIdleTime = 10;
#endif
googleUri = new Uri ("http://www.google.com");
yahooUri = new Uri ("http://www.yahoo.com");
apacheUri = new Uri ("http://www.apache.org");
exampleComUri = new Uri ("http://www.example.com");
exampleOrgUri = new Uri ("http://www.example.org");
}
[TearDown]
@@ -53,27 +51,21 @@ public class ServicePointManagerTest
{
Assert.AreEqual (0, ServicePointManager.MaxServicePoints, "#1");
DoWebRequest (googleUri);
DoWebRequest (exampleComUri);
Thread.Sleep (100);
DoWebRequest (yahooUri);
Thread.Sleep (100);
DoWebRequest (apacheUri);
DoWebRequest (exampleOrgUri);
Thread.Sleep (100);
ServicePoint sp = ServicePointManager.FindServicePoint (googleUri);
ServicePoint sp = ServicePointManager.FindServicePoint (exampleComUri);
//WriteServicePoint (sp);
sp = ServicePointManager.FindServicePoint (yahooUri);
//WriteServicePoint (sp);
sp = ServicePointManager.FindServicePoint (apacheUri);
sp = ServicePointManager.FindServicePoint (exampleOrgUri);
//WriteServicePoint (sp);
ServicePointManager.MaxServicePoints = 1;
sp = ServicePointManager.FindServicePoint (googleUri);
sp = ServicePointManager.FindServicePoint (exampleComUri);
//WriteServicePoint (sp);
sp = ServicePointManager.FindServicePoint (yahooUri);
//WriteServicePoint (sp);
sp = ServicePointManager.FindServicePoint (apacheUri);
sp = ServicePointManager.FindServicePoint (exampleOrgUri);
//WriteServicePoint (sp);
GC.Collect ();
@@ -94,8 +86,8 @@ public class ServicePointManagerTest
public void FindServicePoint ()
{
ServicePointManager.MaxServicePoints = 0;
ServicePoint sp = ServicePointManager.FindServicePoint (googleUri, new WebProxy (apacheUri));
Assert.AreEqual (apacheUri, sp.Address, "#1");
ServicePoint sp = ServicePointManager.FindServicePoint (exampleComUri, new WebProxy (exampleOrgUri));
Assert.AreEqual (exampleOrgUri, sp.Address, "#1");
#if MOBILE
Assert.AreEqual (10, sp.ConnectionLimit, "#2");
#else

View File

@@ -45,45 +45,45 @@ public class ServicePointTest
//WriteServicePoint ("A servicepoint that isn't really", p);
ServicePointManager.MaxServicePoints = 2;
ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com"));
ServicePoint exampleCom = ServicePointManager.FindServicePoint (new Uri ("http://www.example.com"));
try {
ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org"));
ServicePoint exampleOrg = ServicePointManager.FindServicePoint (new Uri ("http://www.example.org"));
Assert.Fail ("#1");
} catch (InvalidOperationException) { }
ServicePointManager.MaxServicePoints = 0;
//WriteServicePoint ("google before getting a webrequest", google);
//WriteServicePoint ("example before getting a webrequest", example);
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.example.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");
//WriteServicePoint ("example after getting a response", example);
ServicePoint example2 = ServicePointManager.FindServicePoint (new Uri ("http://www.example.com/dilbert.html"));
Assert.AreEqual (example, example2, "#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...
HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.example.com");
req2.Method = "PUT";
IAsyncResult async = req2.BeginGetRequestStream (null, null);
//WriteServicePoint ("after async BeginGetRequestStream", google);
//WriteServicePoint ("after async BeginGetRequestStream", example);
// CurrentConnections: 1
Stream stream2 = req2.EndGetRequestStream (async);
//WriteServicePoint ("after async EndGetRequestStream", google);
//WriteServicePoint ("after async EndGetRequestStream", example);
// CurrentConnections: 1
stream2.Close ();
req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
req2 = (HttpWebRequest) WebRequest.Create ("http://www.example.com");
async = req2.BeginGetResponse (null, null);
//WriteServicePoint ("after async BeginGetResponse", google);
//WriteServicePoint ("after async BeginGetResponse", example);
// CurrentConnections: 2
WebResponse res2 = req2.EndGetResponse (async);
//WriteServicePoint ("after async EndGetResponse", google);
//WriteServicePoint ("after async EndGetResponse", example);
// CurrentConnections: 0
// curious that after you get the webresponse object CurrentConnections is set to 0.
// you'd think that you'd still be connected until you close the webresponse..
@@ -109,10 +109,10 @@ public class ServicePointTest
// what's the limit of the cache?
req2 = (HttpWebRequest) WebRequest.Create ("http://www.apache.org/");
req2 = (HttpWebRequest) WebRequest.Create ("http://www.example.org/");
res2 = req2.GetResponse ();
sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.apache.org/"));
//WriteServicePoint ("apache", sp2);
sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.example.org/"));
//WriteServicePoint ("example", sp2);
//Console.WriteLine ("ContentLength: " + res2.ContentLength);
// CurrentConnections: 1
res2.Close ();
@@ -130,7 +130,7 @@ public class ServicePointTest
// the default is already 2, just in case it isn't..
ServicePointManager.DefaultConnectionLimit = 5;
Uri uri = new Uri ("http://www.go-mono.com/");
Uri uri = new Uri ("http://www.example.com/");
ServicePoint sp = ServicePointManager.FindServicePoint (uri);
WebResponse [] res = new WebResponse [5];
for (int i = 0; i < 5; i++) {
@@ -159,7 +159,7 @@ public class ServicePointTest
[Category ("NotWorking")] // #A1 fails
public void EndPointBind ()
{
Uri uri = new Uri ("http://www.go-mono.com/");
Uri uri = new Uri ("http://www.example.com/");
ServicePoint sp = ServicePointManager.FindServicePoint (uri);
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);

View File

@@ -188,7 +188,7 @@ namespace MonoTests.System.Net {
public void Host ()
{
SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert);
a.Host = "www.mono-project.com";
a.Host = "www.example.com";
}
[Test]

View File

@@ -34,7 +34,7 @@ public class SocketPermissionTest
//s1.AddPermission(NetworkAccess.Accept, TransportType.All, "123", SocketPermission.AllPorts);
//s1.AddPermission(NetworkAccess.Accept, TransportType.All, "www.ximian.com", SocketPermission.AllPorts);
//s1.AddPermission(NetworkAccess.Accept, TransportType.All, "120.4.3.2", SocketPermission.AllPorts);
//s1.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.google.com", 80);
//s1.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.example.com", 80);
//s1.AddPermission(NetworkAccess.Accept, TransportType.All, "1.*.10.*.99", SocketPermission.AllPorts);
//s1.AddPermission(NetworkAccess.Accept, TransportType.All, "128.0.0.1", SocketPermission.AllPorts);
//s1.AddPermission(NetworkAccess.Accept, TransportType.All, "0.0.0.0", SocketPermission.AllPorts);
@@ -43,7 +43,7 @@ public class SocketPermissionTest
s2 = new SocketPermission(NetworkAccess.Connect, TransportType.All, "12.13.14.15", 80);
//s2.AddPermission(NetworkAccess.Accept, TransportType.All, "localhost", 8080);
//s2.AddPermission(NetworkAccess.Accept, TransportType.All, "123", 8080);
//s2.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.google.com", SocketPermission.AllPorts);
//s2.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.example.com", SocketPermission.AllPorts);
s2.AddPermission(NetworkAccess.Accept, TransportType.All, "213.*.*.*", SocketPermission.AllPorts);
//s2.AddPermission(NetworkAccess.Accept, TransportType.All, "128.0.0.1", 9090);
s2.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "216.239.*.*", SocketPermission.AllPorts);

View File

@@ -35,11 +35,11 @@ namespace MonoTests.System.Net
// A new, but empty file has been created. This is a test case
// for bug 81005
wc.DownloadFile("http://google.com/", filename);
wc.DownloadFile("http://example.com/", filename);
// Now, remove the file and attempt to download again.
File.Delete(filename);
wc.DownloadFile("http://google.com/", filename);
wc.DownloadFile("http://example.com/", filename);
}
[Test]
@@ -59,6 +59,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadData (string)
[Category ("BitcodeNotSupported")]
public void DownloadData1_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -98,6 +99,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadData (Uri)
[Category ("BitcodeNotSupported")]
public void DownloadData2_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -137,6 +139,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadFile (string, string)
[Category ("BitcodeNotSupported")]
public void DownloadFile1_Address_SchemeNotSupported ()
{
using (var tmpdir = new TempDirectory ()) {
@@ -163,6 +166,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadFile (string, string)
[Category ("BitcodeNotSupported")]
public void DownloadFile1_FileName_Null ()
{
WebClient wc = new WebClient ();
@@ -180,6 +184,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadFile (Uri, string)
[Category ("BitcodeNotSupported")]
public void DownloadFile2_Address_Null ()
{
WebClient wc = new WebClient ();
@@ -196,6 +201,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadFile (Uri, string)
[Category ("BitcodeNotSupported")]
public void DownloadFile2_Address_SchemeNotSupported ()
{
using (var tmpdir = new TempDirectory ()) {
@@ -222,6 +228,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadFile (Uri, string)
[Category ("BitcodeNotSupported")]
public void DownloadFile2_FileName_Null ()
{
WebClient wc = new WebClient ();
@@ -255,6 +262,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadString (string)
[Category ("BitcodeNotSupported")]
public void DownloadString1_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -294,6 +302,7 @@ namespace MonoTests.System.Net
}
[Test] // DownloadString (Uri)
[Category ("BitcodeNotSupported")]
public void DownloadString2_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -357,6 +366,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenRead (string)
[Category ("BitcodeNotSupported")]
public void OpenRead1_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -380,6 +390,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenRead (Uri)
[Category ("BitcodeNotSupported")]
public void OpenRead2_Address_Null ()
{
WebClient wc = new WebClient ();
@@ -396,6 +407,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenRead (Uri)
[Category ("BitcodeNotSupported")]
public void OpenRead2_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -448,6 +460,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenWrite (string)
[Category ("BitcodeNotSupported")]
public void OpenWrite1_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -487,6 +500,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenWrite (string, string)
[Category ("BitcodeNotSupported")]
public void OpenWrite2_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -510,6 +524,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenWrite (Uri)
[Category ("BitcodeNotSupported")]
public void OpenWrite3_Address_Null ()
{
WebClient wc = new WebClient ();
@@ -526,6 +541,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenWrite (Uri)
[Category ("BitcodeNotSupported")]
public void OpenWrite3_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -549,6 +565,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenWrite (Uri, string)
[Category ("BitcodeNotSupported")]
public void OpenWrite4_Address_Null ()
{
WebClient wc = new WebClient ();
@@ -565,6 +582,7 @@ namespace MonoTests.System.Net
}
[Test] // OpenWrite (Uri, string)
[Category ("BitcodeNotSupported")]
public void OpenWrite4_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -605,6 +623,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadData (string, byte [])
[Category ("BitcodeNotSupported")]
public void UploadData1_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -632,7 +651,7 @@ namespace MonoTests.System.Net
{
WebClient wc = new WebClient ();
try {
wc.UploadData ("http://www.mono-project.com",
wc.UploadData ("http://www.example.com",
(byte []) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {
@@ -661,6 +680,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadData (Uri, byte [])
[Category ("BitcodeNotSupported")]
public void UploadData2_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -689,7 +709,7 @@ namespace MonoTests.System.Net
{
WebClient wc = new WebClient ();
try {
wc.UploadData (new Uri ("http://www.mono-project.com"),
wc.UploadData (new Uri ("http://www.example.com"),
(byte []) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {
@@ -719,6 +739,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadData (string, string, byte [])
[Category ("BitcodeNotSupported")]
public void UploadData3_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -747,7 +768,7 @@ namespace MonoTests.System.Net
{
WebClient wc = new WebClient ();
try {
wc.UploadData ("http://www.mono-project.com",
wc.UploadData ("http://www.example.com",
"POST", (byte []) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {
@@ -776,6 +797,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadData (Uri, string, byte [])
[Category ("BitcodeNotSupported")]
public void UploadData4_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -804,7 +826,7 @@ namespace MonoTests.System.Net
{
WebClient wc = new WebClient ();
try {
wc.UploadData (new Uri ("http://www.mono-project.com"),
wc.UploadData (new Uri ("http://www.example.com"),
"POST", (byte []) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {
@@ -838,6 +860,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadFile (string, string)
[Category ("BitcodeNotSupported")]
public void UploadFile1_Address_SchemeNotSupported ()
{
string tempFile = Path.GetTempFileName ();
@@ -867,6 +890,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadFile (string, string)
[Category ("BitcodeNotSupported")]
public void UploadFile1_FileName_NotFound ()
{
using (var tempPath = new TempDirectory ()) {
@@ -933,6 +957,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadFile (Uri, string)
[Category ("BitcodeNotSupported")]
public void UploadFile2_Address_SchemeNotSupported ()
{
string tempFile = Path.GetTempFileName ();
@@ -962,6 +987,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadFile (Uri, string)
[Category ("BitcodeNotSupported")]
public void UploadFile2_FileName_NotFound ()
{
using (var tempPath = new TempDirectory ()) {
@@ -1028,6 +1054,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadFile (string, string, string)
[Category ("BitcodeNotSupported")]
public void UploadFile3_Address_SchemeNotSupported ()
{
string tempFile = Path.GetTempFileName ();
@@ -1057,6 +1084,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadFile (string, string, string)
[Category ("BitcodeNotSupported")]
public void UploadFile3_FileName_NotFound ()
{
using (var tempPath = new TempDirectory ()) {
@@ -1123,6 +1151,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadFile (Uri, string, string)
[Category ("BitcodeNotSupported")]
public void UploadFile4_Address_SchemeNotSupported ()
{
string tempFile = Path.GetTempFileName ();
@@ -1152,6 +1181,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadFile (Uri, string, string)
[Category ("BitcodeNotSupported")]
public void UploadFile4_FileName_NotFound ()
{
using (var tempPath = new TempDirectory ()) {
@@ -1216,6 +1246,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadString (string, string)
[Category ("BitcodeNotSupported")]
public void UploadString1_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -1271,6 +1302,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadString (Uri, string)
[Category ("BitcodeNotSupported")]
public void UploadString2_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -1328,6 +1360,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadString (string, string, string)
[Category ("BitcodeNotSupported")]
public void UploadString3_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -1386,6 +1419,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadString (Uri, string, string)
[Category ("BitcodeNotSupported")]
public void UploadString4_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -1465,6 +1499,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (string, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues1_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -1489,11 +1524,12 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (string, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues1_Data_Null ()
{
WebClient wc = new WebClient ();
try {
wc.UploadValues ("http://www.mono-project.com",
wc.UploadValues ("http://www.example.com",
(NameValueCollection) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {
@@ -1506,6 +1542,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (Uri, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues2_Address_Null ()
{
WebClient wc = new WebClient ();
@@ -1522,6 +1559,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (Uri, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues2_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -1546,11 +1584,12 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (Uri, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues2_Data_Null ()
{
WebClient wc = new WebClient ();
try {
wc.UploadValues (new Uri ("http://www.mono-project.com"),
wc.UploadValues (new Uri ("http://www.example.com"),
(NameValueCollection) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {
@@ -1580,6 +1619,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (string, string, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues3_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -1604,11 +1644,12 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (string, string, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues3_Data_Null ()
{
WebClient wc = new WebClient ();
try {
wc.UploadValues ("http://www.mono-project.com",
wc.UploadValues ("http://www.example.com",
"POST", (NameValueCollection) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {
@@ -1621,6 +1662,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (Uri, string, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues4_Address_Null ()
{
WebClient wc = new WebClient ();
@@ -1638,6 +1680,7 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (Uri, string, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues4_Address_SchemeNotSupported ()
{
WebClient wc = new WebClient ();
@@ -1662,11 +1705,12 @@ namespace MonoTests.System.Net
}
[Test] // UploadValues (Uri, string, NameValueCollection)
[Category ("BitcodeNotSupported")]
public void UploadValues4_Data_Null ()
{
WebClient wc = new WebClient ();
try {
wc.UploadValues (new Uri ("http://www.mono-project.com"),
wc.UploadValues (new Uri ("http://www.example.com"),
"POST", (NameValueCollection) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {

View File

@@ -43,6 +43,7 @@ namespace MonoTests.System.Net
[Test]
[Category("Async")]
[Category("AndroidNotWorking")] // Attempts to access the test dll which won't work on Android
[Category("BitcodeNotSupported")]
public void DownloadData ()
{
WebClient wc;
@@ -129,15 +130,15 @@ namespace MonoTests.System.Net
public void DownloadMultiple ()
{
WebClient wc = new WebClient ();
var t1 = wc.OpenReadTaskAsync ("http://www.google.com/");
var t1 = wc.OpenReadTaskAsync ("http://www.example.org/");
Assert.That (t1.Wait (15000));
Assert.IsTrue (t1.IsCompleted, "#1");
var t2 = wc.OpenReadTaskAsync ("http://www.mono-project.com/");
var t2 = wc.OpenReadTaskAsync ("http://www.example.com/");
Assert.That (t2.Wait (15000));
Assert.IsTrue (t2.IsCompleted, "#2");
var t3 = wc.DownloadStringTaskAsync ("http://www.google.com/");
var t3 = wc.DownloadStringTaskAsync ("http://www.example.org/");
Assert.That (t3.Wait (15000));
Assert.IsTrue (t3.IsCompleted, "#3");
}
@@ -150,8 +151,8 @@ namespace MonoTests.System.Net
WebClient wc = new WebClient ();
MessagePumpSyncContext.Run (async () => {
await wc.DownloadStringTaskAsync ("http://www.google.com/");
await wc.DownloadDataTaskAsync ("http://www.mono-project.com/");
await wc.DownloadStringTaskAsync ("http://www.example.org/");
await wc.DownloadDataTaskAsync ("http://www.example.com/");
}, null, 15000);
}
@@ -178,8 +179,8 @@ namespace MonoTests.System.Net
};
MessagePumpSyncContext.Run (async () => {
await wc.DownloadStringTaskAsync ("http://www.google.com/");
await wc.DownloadDataTaskAsync ("http://www.mono-project.com/");
await wc.DownloadStringTaskAsync ("http://www.example.org/");
await wc.DownloadDataTaskAsync ("http://www.example.com/");
}, () => data_completed && string_completed, 15000);
Assert.IsTrue (data_completed, "#1");

View File

@@ -75,7 +75,7 @@ namespace MonoTests.System.Net
p.BypassArrayList.Add ("http://proxy2.contoso.com");
p.BypassArrayList.Add ("http://proxy2.contoso.com");
Assert.AreEqual (2, p.BypassList.Length, "#1");
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.google.com")), "#2");
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.example.com")), "#2");
Assert.IsTrue (p.IsBypassed (proxy2), "#3");
Assert.AreEqual (proxy2, p.GetProxy (proxy2), "#4");
@@ -127,7 +127,7 @@ namespace MonoTests.System.Net
public void IsByPassed ()
{
WebProxy p = new WebProxy ("http://proxy.contoso.com", true);
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.google.com")), "#1");
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.example.com")), "#1");
Assert.IsTrue (p.IsBypassed (new Uri ("http://localhost/index.html")), "#2");
Assert.IsTrue (p.IsBypassed (new Uri ("http://localhost:8080/index.html")), "#3");
Assert.IsTrue (p.IsBypassed (new Uri ("http://loopback:8080/index.html")), "#4");
@@ -136,33 +136,33 @@ namespace MonoTests.System.Net
Assert.IsTrue (!p.IsBypassed (new Uri ("http://webserver.com/index.html")), "#7");
p = new WebProxy ("http://proxy.contoso.com", false);
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.google.com")), "#11");
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.example.com")), "#11");
Assert.IsTrue (p.IsBypassed (new Uri ("http://localhost/index.html")), "#12: lamespec of ms.net");
Assert.IsTrue (p.IsBypassed (new Uri ("http://localhost:8080/index.html")), "#13: lamespec of ms.net");
Assert.IsTrue (p.IsBypassed (new Uri ("http://loopback:8080/index.html")), "#14: lamespec of ms.net");
Assert.IsTrue (p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html")), "#15: lamespec of ms.net");
Assert.IsTrue (!p.IsBypassed (new Uri ("http://webserver/index.html")), "#16");
p.BypassList = new string [] { "google.com", "contoso.com" };
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.google.com")), "#20");
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.GOOGLE.com")), "#21");
p.BypassList = new string [] { "example.com", "contoso.com" };
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.example.com")), "#20");
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.EXAMPLE.com")), "#21");
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.contoso.com:8080/foo/bar/index.html")), "#22");
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.contoso2.com:8080/foo/bar/index.html")), "#23");
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.foo.com:8080/contoso.com.html")), "#24");
p.BypassList = new string [] { "https" };
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.google.com")), "#30");
Assert.IsTrue (p.IsBypassed (new Uri ("https://www.google.com")), "#31");
Assert.IsTrue (!p.IsBypassed (new Uri ("http://www.example.com")), "#30");
Assert.IsTrue (p.IsBypassed (new Uri ("https://www.example.com")), "#31");
}
[Test]
public void IsByPassed_Address_Null ()
{
WebProxy p = new WebProxy ((Uri) null, false);
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.google.com")), "#1");
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.example.com")), "#1");
p = new WebProxy ((Uri) null, true);
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.google.com")), "#2");
Assert.IsTrue (p.IsBypassed (new Uri ("http://www.example.com")), "#2");
}
[Test]

View File

@@ -279,7 +279,7 @@ namespace MonoTests.System.Net {
Assert.AreSame (proxy, WebRequest.DefaultWebProxy, "#A2");
HttpWebRequest req = (HttpWebRequest) WebRequest.CreateDefault (
new Uri ("http://www.mono-project.com"));
new Uri ("http://www.example.com"));
Assert.IsNotNull (req.Proxy, "#B1");
Assert.AreSame (proxy, req.Proxy, "#B2");
@@ -289,7 +289,7 @@ namespace MonoTests.System.Net {
Assert.AreSame (proxy, req.Proxy, "#C3");
req = (HttpWebRequest) WebRequest.CreateDefault (
new Uri ("http://www.mono-project.com"));
new Uri ("http://www.example.com"));
Assert.IsNull (req.Proxy, "#D");
}
@@ -297,7 +297,7 @@ namespace MonoTests.System.Net {
public void RegisterPrefix_Creator_Null ()
{
try {
WebRequest.RegisterPrefix ("http://www.mono-project.com", (IWebRequestCreate) null);
WebRequest.RegisterPrefix ("http://www.example.com", (IWebRequestCreate) null);
Assert.Fail ("#1");
} catch (ArgumentNullException ex) {
Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");