Files
cefsharp/old/CefSharp.Tests/ResourceTests.cs
Chris bef5dd37c4 Maintenance - Fixed formatting, file encoding, and copyright year (#2504)
* Applied formatting

* Fixed file encoding + Updated copyright year

* Updated License

* Fixed more file encoding

* Copyright notice now shows the year the file was created
2018-09-10 10:41:13 +10:00

43 lines
1.3 KiB
C#

namespace CefSharp.Tests
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using System.IO;
[TestFixture]
public class ResourceTests
{
private CefFormsWebBrowser WebBrowser { get { return BrowserApplication.WebBrowser; } }
[Test]
public void StreamClosingWithBeforeResourceLoad()
{
WebBrowser.Load(BrowserApplication.GetTestPagesUrl("TestPage.html"));
WebBrowser.WaitForLoadCompletion();
WebBrowser.Load("about:blank");
WebBrowser.WaitForLoadCompletion();
// Uncomment this to pass test.
// GC.Collect();
// now we will try open TestPage.html file for writing
try
{
var file = File.Open(BrowserApplication.GetTestPagesFilePath("TestPage.html"), FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
file.Close();
}
catch (IOException ioex)
{
Assert.Fail("File couldn't be opened. So underlying stream for file is not closed.\nException: {0}", ioex.ToString());
}
catch
{
throw;
}
}
}
}