feat(ads/seo/release): v1.2.0 with live Google Ads, isolated ad profile, ads.txt, and SEO/AEO/GEO optimization

This commit is contained in:
Yun Chan 2026-09-14 00:39:44 +09:00
parent a88aafa1e5
commit 0e568f1f0a
975 changed files with 130593 additions and 16783 deletions

View file

@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Paca.Browser.Tabs;
using Xunit;
namespace Paca.Tests.Browser;
public class ChromeOmniboxAutocompleteTests
{
[Fact]
public void OmniboxAutocompleteScorer_Calculates_Scores_Correctly()
{
var now = DateTime.UtcNow;
// 1. Exact URL match (e.g. typing "github.com")
var scoreExactUrl = OmniboxAutocompleteScorer.CalculateScore("github.com", "GitHub: Where the world builds", "https://github.com", visitCount: 50, lastVisit: now);
// 2. Substring match
var scoreSub = OmniboxAutocompleteScorer.CalculateScore("hub", "GitHub: Where the world builds", "https://github.com", visitCount: 1, lastVisit: now.AddDays(-10));
// 3. No match
var scoreNoMatch = OmniboxAutocompleteScorer.CalculateScore("banana", "GitHub", "https://github.com", visitCount: 50, lastVisit: now);
Assert.True(scoreExactUrl > scoreSub, $"Exact URL score ({scoreExactUrl}) should be higher than substring score ({scoreSub})");
Assert.Equal(0, scoreNoMatch);
}
[Fact]
public void OmniboxSuggestionAggregator_Combines_And_Ranks_Sources()
{
var aggregator = new OmniboxSuggestionAggregator();
var openTabs = new List<OmniboxCandidate>
{
new("Google Search", "https://www.google.com", OmniboxSuggestionType.OpenTab, VisitCount: 10, LastVisited: DateTime.UtcNow)
};
var bookmarks = new List<OmniboxCandidate>
{
new("GitHub Main", "https://github.com", OmniboxSuggestionType.Bookmark, VisitCount: 5, LastVisited: DateTime.UtcNow.AddDays(-1)),
new("Google Drive", "https://drive.google.com", OmniboxSuggestionType.Bookmark, VisitCount: 20, LastVisited: DateTime.UtcNow)
};
var history = new List<OmniboxCandidate>
{
new("Stack Overflow", "https://stackoverflow.com/questions", OmniboxSuggestionType.History, VisitCount: 2, LastVisited: DateTime.UtcNow.AddDays(-2))
};
var suggestions = aggregator.Aggregate("google", openTabs, bookmarks, history, maxCount: 5);
Assert.Equal(2, suggestions.Count);
Assert.All(suggestions, s => Assert.Contains("google", s.Url + s.Title, StringComparison.OrdinalIgnoreCase));
// Top match should have higher score
Assert.True(suggestions[0].Score >= suggestions[1].Score);
}
[Fact]
public void OmniboxSuggestionAggregator_Deduplicates_Url_Across_Sources()
{
var aggregator = new OmniboxSuggestionAggregator();
// Same URL in open tab and bookmark: OpenTab takes priority or higher score wins
var openTabs = new List<OmniboxCandidate>
{
new("Paca Official", "https://paca.app", OmniboxSuggestionType.OpenTab, 1, DateTime.UtcNow)
};
var bookmarks = new List<OmniboxCandidate>
{
new("Paca App", "https://paca.app", OmniboxSuggestionType.Bookmark, 10, DateTime.UtcNow)
};
var results = aggregator.Aggregate("paca", openTabs, bookmarks, new List<OmniboxCandidate>(), maxCount: 5);
Assert.Single(results);
Assert.Equal("https://paca.app", results[0].Url);
}
}