diff --git a/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs b/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs index 34b24d44..7d15ace7 100644 --- a/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs +++ b/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs @@ -69,6 +69,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers var quitUrl = "http://www.byebye.com"; var request = new Mock(); + appConfig.ConfigurationFileMimeType = "application/seb"; request.SetupGet(r => r.Url).Returns(quitUrl); settings.QuitUrl = quitUrl; sut.QuitUrlVisited += (url) => eventFired = true; @@ -122,6 +123,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers var request = new Mock(); var url = "https://www.test.org"; + appConfig.ConfigurationFileMimeType = "application/seb"; filter.Setup(f => f.Process(It.Is(r => r.Url.Equals(url)))).Returns(FilterResult.Block); request.SetupGet(r => r.ResourceType).Returns(ResourceType.MainFrame); request.SetupGet(r => r.Url).Returns(url); @@ -155,6 +157,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers var request = new Mock(); var url = "https://www.test.org"; + appConfig.ConfigurationFileMimeType = "application/seb"; filter.Setup(f => f.Process(It.Is(r => r.Url.Equals(url)))).Returns(FilterResult.Block); request.SetupGet(r => r.ResourceType).Returns(ResourceType.SubFrame); request.SetupGet(r => r.Url).Returns(url); @@ -182,13 +185,34 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers } [TestMethod] - public void MustInitiateConfigurationFileDownload() + public void MustInitiateDataUriConfigurationFileDownload() { var browser = new Mock(); var host = new Mock(); var request = new Mock(); appConfig.ConfigurationFileExtension = ".xyz"; + appConfig.ConfigurationFileMimeType = "application/seb"; + appConfig.SebUriScheme = "abc"; + appConfig.SebUriSchemeSecure = "abcd"; + browser.Setup(b => b.GetHost()).Returns(host.Object); + request.SetupGet(r => r.Url).Returns($"{appConfig.SebUriSchemeSecure}://{appConfig.ConfigurationFileMimeType};base64,H4sIAAAAAAAAE41WbXPaRhD..."); + + var handled = sut.OnBeforeBrowse(Mock.Of(), browser.Object, Mock.Of