Esempio n. 1
0
        public async Task LoadCustomScheme()
        {
            await Run(async() => {
                var embeddedResourceUrl = new ResourceUrl(GetType().Assembly, "Resources", "EmbeddedHtml.html");

                var taskCompletionSource = new TaskCompletionSource <bool>(TaskCreationOptions.RunContinuationsAsynchronously);

                void OnNavigated(string url, string frameName)
                {
                    if (url != UrlHelper.AboutBlankUrl)
                    {
                        TargetView.Navigated -= OnNavigated;
                        taskCompletionSource.SetResult(true);
                    }
                }
                TargetView.Navigated += OnNavigated;
                TargetView.LoadResource(embeddedResourceUrl);
                await taskCompletionSource.Task;

                var content = await TargetView.EvaluateScript <string>("document.documentElement.innerText");
                Assert.AreEqual("test", content);
            });
        }