46 lines
1.7 KiB
C#
46 lines
1.7 KiB
C#
using VideoDownloader.Browser;
|
|
|
|
namespace VideoDownloader.Tests.Browser;
|
|
|
|
/// <summary>T3-11: 사이트별 권한 정책 — 기억된 상태 우선, 미기억은 Ask(프롬프트).</summary>
|
|
public class PermissionGateTests
|
|
{
|
|
[Fact]
|
|
public void 미기억_권한은_Ask()
|
|
=> Assert.Equal(PermissionVerdict.Ask, new PermissionGate().Decide("notifications", "https://x.com"));
|
|
|
|
[Theory]
|
|
[InlineData("allow")]
|
|
[InlineData("deny")]
|
|
public void 기억된_판정은_그대로_반환(string v)
|
|
{
|
|
var g = new PermissionGate();
|
|
g.Remember("notifications", "https://x.com", v == "allow" ? PermissionVerdict.Allow : PermissionVerdict.Deny);
|
|
Assert.Equal(v == "allow" ? PermissionVerdict.Allow : PermissionVerdict.Deny,
|
|
g.Decide("notifications", "https://x.com"));
|
|
}
|
|
|
|
[Fact]
|
|
public void 판정은_출처_단위_격리()
|
|
{
|
|
var g = new PermissionGate();
|
|
g.Remember("geolocation", "https://a.com", PermissionVerdict.Allow);
|
|
Assert.Equal(PermissionVerdict.Ask, g.Decide("geolocation", "https://b.com"));
|
|
}
|
|
|
|
[Fact]
|
|
public void 판정은_종류_단위_격리()
|
|
{
|
|
var g = new PermissionGate();
|
|
g.Remember("notifications", "https://a.com", PermissionVerdict.Allow);
|
|
Assert.Equal(PermissionVerdict.Ask, g.Decide("camera", "https://a.com"));
|
|
}
|
|
|
|
[Fact]
|
|
public void OtherSensors_등_민감_종류는_자동_거절()
|
|
=> Assert.Equal(PermissionVerdict.Deny, new PermissionGate().Decide("OtherSensors", "https://x.com"));
|
|
|
|
[Fact]
|
|
public void MultipleAutomaticDownloads_파일_다운로드는_자동_허용()
|
|
=> Assert.Equal(PermissionVerdict.Allow, new PermissionGate().Decide("MultipleAutomaticDownloads", "https://x.com"));
|
|
}
|