T3-11/14/15 + M2 잔여: 권한 정책 UI(PermissionGate/PermissionRequested 다이얼로그+SavesInProfile), 추적 방지(TrackerBlocklist/WebResourceRequested 차단+실드 배지·팝업), 주소창 진행 바+파라미터 제거 복사(UrlCleaner/NavProgressTracker), U5 완료 알림(Mobile.Core 감지기+Plugin.LocalNotification), 재생중 ongoing 미디어 알림, 썸네일/해상도 API(Thumbnailer 사이드카 캐시+/thumb)+라이브러리 그리드, 외부망 안내(ConnectionTroubleshoot). 147 tests GREEN
This commit is contained in:
parent
27c91c04dd
commit
46c6c321f2
26 changed files with 1058 additions and 30 deletions
40
VideoDownloader.Tests/Browser/TrackerBlockTests.cs
Normal file
40
VideoDownloader.Tests/Browser/TrackerBlockTests.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using VideoDownloader.Browser;
|
||||
|
||||
namespace VideoDownloader.Tests.Browser;
|
||||
|
||||
/// <summary>T3-14: 추적 방지 — 블랙리스트 도메인 매칭(서브도메인 포함) + 차단 카운터.</summary>
|
||||
public class TrackerBlockTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("https://google-analytics.com/analytics.js", true)] // 정확히 도메인
|
||||
[InlineData("https://www.google-analytics.com/g/collect", true)] // 서브도메인
|
||||
[InlineData("https://x.com/notgoogle-analytics.com/a", false)] // 접미사 함정 제외
|
||||
[InlineData("https://doubleclick.net/instream/ad_status.js", true)]
|
||||
[InlineData("https://safe.example.com/lib.js", false)] // 무관 도메인
|
||||
public void Matches_블랙리스트_도메인_판정(string url, bool expected)
|
||||
=> Assert.Equal(expected, new TrackerBlocklist().Matches(new Uri(url)));
|
||||
|
||||
[Fact]
|
||||
public void 커스텀_도메인_주입_가능()
|
||||
{
|
||||
var bl = new TrackerBlocklist(new[] { "blocked.test" });
|
||||
Assert.True(bl.Matches(new Uri("https://t.blocked.test/x.js")));
|
||||
Assert.False(bl.Matches(new Uri("https://ok.com/x.js")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Counter_차단_누적_도메인별_집계_변경_통지()
|
||||
{
|
||||
var c = new TrackerCounter();
|
||||
var changed = 0;
|
||||
c.Changed += () => changed++;
|
||||
Assert.Equal(0, c.Total);
|
||||
c.Record("https://www.google-analytics.com/a.js");
|
||||
c.Record("https://google-analytics.com/b.js");
|
||||
c.Record("https://scorecardresearch.com/c.js");
|
||||
Assert.Equal(3, c.Total);
|
||||
Assert.Equal(2, c.ByDomain["google-analytics.com"]);
|
||||
Assert.Equal(1, c.ByDomain["scorecardresearch.com"]);
|
||||
Assert.Equal(3, changed);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue