using System; using System.IO; using System.Linq; using System.Windows.Controls; using Paca.App; using Paca.Browser; using Paca.Browser.Tabs; using Paca.Server; using Paca.Server.Gateway; using Paca.Tests.Infrastructure; using Xunit; namespace Paca.Tests.Browser; public class ChromeParityMilestone11Tests { [Fact] public void ServerOptions_TabOpener_속성이_존재하고_호출가능하다() { string? opened = null; var options = new ServerOptions { TabOpener = url => opened = url }; options.TabOpener?.Invoke("https://test.com/from-mobile"); Assert.Equal("https://test.com/from-mobile", opened); } [Fact] public void GatewayEventType_TabSharedFromDesktop_이벤트_타입이_정의되어_있다() { Assert.True(Enum.IsDefined(typeof(GatewayEventType), "TabSharedFromDesktop")); } [Fact] public void BuildTabContextMenu_기기로_전송_메뉴항목_포함() { using var sta = StaDispatcher.Start(); WpfTestApp.Ensure(sta.Dispatcher); sta.Invoke(() => { var dataDir = Path.Combine(Path.GetTempPath(), $"vd_tab_handoff_{Guid.NewGuid():N}"); Environment.SetEnvironmentVariable("VD_DATA_DIR", dataDir); try { var win = new MainWindow(); win.TabsManager.Tabs.Clear(); var t1 = win.TabsManager.NewTab("https://site1.com"); var menu = win.BuildTabContextMenu(t1); var items = menu.Items.OfType().Select(m => m.Header?.ToString()).ToList(); Assert.Contains("기기로 전송", items); } finally { try { if (Directory.Exists(dataDir)) Directory.Delete(dataDir, true); } catch { } } }); } [Fact] public void WebCompanion_PC_탭열기_엔드포인트_연동스크립트_포함() { var html = WebCompanion.Html; Assert.Contains("/api/tabs/open", html); } }