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:
parent
a88aafa1e5
commit
0e568f1f0a
975 changed files with 130593 additions and 16783 deletions
120
tests/Paca.Tests/Browser/ChromeWebAppManifestTests.cs
Normal file
120
tests/Paca.Tests/Browser/ChromeWebAppManifestTests.cs
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Paca.Browser;
|
||||
using Paca.Browser.Pwa;
|
||||
using Paca.Browser.Tabs;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Browser;
|
||||
|
||||
public class ChromeWebAppManifestTests
|
||||
{
|
||||
[Fact]
|
||||
public void WebAppManifestParser_Parses_Standard_Manifest_Json()
|
||||
{
|
||||
var json = @"
|
||||
{
|
||||
""name"": ""YouTube Music"",
|
||||
""short_name"": ""Music"",
|
||||
""start_url"": ""/index.html"",
|
||||
""display"": ""standalone"",
|
||||
""theme_color"": ""#ff0000"",
|
||||
""background_color"": ""#ffffff"",
|
||||
""icons"": [
|
||||
{
|
||||
""src"": ""/icons/icon-192.png"",
|
||||
""sizes"": ""192x192"",
|
||||
""type"": ""image/png""
|
||||
},
|
||||
{
|
||||
""src"": ""https://cdn.example.com/icon-512.png"",
|
||||
""sizes"": ""512x512"",
|
||||
""type"": ""image/png""
|
||||
}
|
||||
]
|
||||
}";
|
||||
var baseUri = new Uri("https://music.youtube.com");
|
||||
var manifest = WebAppManifestParser.Parse(json, baseUri);
|
||||
|
||||
Assert.NotNull(manifest);
|
||||
Assert.Equal("YouTube Music", manifest.Name);
|
||||
Assert.Equal("Music", manifest.ShortName);
|
||||
Assert.Equal("https://music.youtube.com/index.html", manifest.StartUrl);
|
||||
Assert.Equal("standalone", manifest.Display);
|
||||
Assert.Equal("#ff0000", manifest.ThemeColor);
|
||||
Assert.Equal("#ffffff", manifest.BackgroundColor);
|
||||
Assert.Equal(2, manifest.Icons.Count);
|
||||
Assert.Equal("https://music.youtube.com/icons/icon-192.png", manifest.Icons[0].Src);
|
||||
Assert.Equal("https://cdn.example.com/icon-512.png", manifest.Icons[1].Src);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WebAppManifestParser_IsInstallable_Validates_PWA_Criteria()
|
||||
{
|
||||
var baseUri = new Uri("https://example.com");
|
||||
|
||||
// Valid standalone PWA
|
||||
var valid = WebAppManifestParser.Parse(@"
|
||||
{
|
||||
""name"": ""Paca App"",
|
||||
""start_url"": ""/"",
|
||||
""display"": ""standalone"",
|
||||
""icons"": [{ ""src"": ""/icon.png"", ""sizes"": ""192x192"" }]
|
||||
}", baseUri);
|
||||
Assert.True(WebAppManifestParser.IsInstallable(valid));
|
||||
|
||||
// Missing name
|
||||
var noName = WebAppManifestParser.Parse(@"
|
||||
{
|
||||
""start_url"": ""/"",
|
||||
""display"": ""standalone"",
|
||||
""icons"": [{ ""src"": ""/icon.png"" }]
|
||||
}", baseUri);
|
||||
Assert.False(WebAppManifestParser.IsInstallable(noName));
|
||||
|
||||
// Display browser (not standalone/minimal-ui/fullscreen)
|
||||
var browserDisplay = WebAppManifestParser.Parse(@"
|
||||
{
|
||||
""name"": ""Web Site"",
|
||||
""start_url"": ""/"",
|
||||
""display"": ""browser"",
|
||||
""icons"": [{ ""src"": ""/icon.png"" }]
|
||||
}", baseUri);
|
||||
Assert.False(WebAppManifestParser.IsInstallable(browserDisplay));
|
||||
|
||||
// Empty icons
|
||||
var noIcons = WebAppManifestParser.Parse(@"
|
||||
{
|
||||
""name"": ""No Icons"",
|
||||
""start_url"": ""/"",
|
||||
""display"": ""standalone"",
|
||||
""icons"": []
|
||||
}", baseUri);
|
||||
Assert.False(WebAppManifestParser.IsInstallable(noIcons));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OmniboxActionEvaluator_Matches_InstallApp()
|
||||
{
|
||||
var actionsKr = OmniboxActionEvaluator.GetMatchingActions("앱 설치");
|
||||
Assert.Contains(actionsKr, a => a.ActionId == "action:install-app");
|
||||
|
||||
var actionsPwa = OmniboxActionEvaluator.GetMatchingActions("pwa");
|
||||
Assert.Contains(actionsPwa, a => a.ActionId == "action:install-app");
|
||||
|
||||
var action = OmniboxActionEvaluator.AllActions.FirstOrDefault(a => a.ActionId == "action:install-app");
|
||||
Assert.NotNull(action);
|
||||
Assert.Contains("PWA", action.DisplayTitle);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChromeInternalUrlRouter_Routes_ChromeApps()
|
||||
{
|
||||
Assert.True(ChromeInternalUrlRouter.IsInternal("chrome://apps"));
|
||||
var action = ChromeInternalUrlRouter.Route("chrome://apps");
|
||||
Assert.Equal(ChromeInternalAction.Apps, action);
|
||||
|
||||
var suggestions = ChromeInternalUrlRouter.GetSuggestions("chrome://app");
|
||||
Assert.Contains(suggestions, s => s.Url == "chrome://apps");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue