コード例 #1
0
        public async Task TestObjectDescriptorCache()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("cachetest3", new object());

                int count = 0;
                browser.CefClient.ProcessMessageReceived += (sender, args) =>
                {
                    if (args.Message.Name == Messages.RpcResponseMessage)
                    {
                        count++;
                    }
                };

                await browser.LoadAsync(url);

                await browser.RunTest("testObjectDescriptorCache");

                await browser.Reload();

                await browser.RunTest("testObjectDescriptorCache");

                Assert.Equal(1, count);
            }
        }
コード例 #2
0
        public async Task RequireReturnsPromise()
        {
            using (var browser = new Util.Browser())
            {
                await browser.LoadAsync(url);

                await browser.RunTest("requireReturnsPromise");
            }
        }
コード例 #3
0
        public async Task MissingDynamicObjectFails()
        {
            using (var browser = new Util.Browser())
            {
                await browser.LoadAsync(url);

                await browser.RunTest("testBoundObjectNotExists");
            }
        }
コード例 #4
0
        public async Task BindingInterfacePresent()
        {
            using (var browser = new Util.Browser())
            {
                await browser.LoadAsync(url);

                await browser.RunTest("testBindingObjectExists");
            }
        }
コード例 #5
0
        public async Task BoundFunctionReturnsPromise()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("test", new TestClass1());

                await browser.LoadAsync(url);

                await browser.RunTest("testBoundObjectFunctionReturnsPromise");
            }
        }
コード例 #6
0
        public async Task ObjectBoundWithFunction()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("test", new TestClass1());

                await browser.LoadAsync(url);

                await browser.RunTest("testBoundObjectFunctionPresent");
            }
        }
コード例 #7
0
        public async Task ObjectBound()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("test", new object());

                await browser.LoadAsync(url);

                await browser.RunTest("testObjectBound");
            }
        }
コード例 #8
0
        public async Task TestPromiseCallback()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("test", new TestClass());

                await browser.LoadAsync(url);

                await browser.RunTest("testCallbackWithPromise");
            }
        }
コード例 #9
0
        public async Task NullableInputConverted()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("test", new TestClass());

                await browser.LoadAsync(url);

                await browser.RunTest("testNullableInput");
            }
        }
コード例 #10
0
        public async Task LoopedV8ObjectGraphNotCausesStackOverflow()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("test", new TestClass());

                await browser.LoadAsync(url);

                await browser.RunTest("testLoopPocoInput");
            }
        }
コード例 #11
0
        public async Task SimpleStringParameterAndResultWorks()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("test", new TestClass1());

                await browser.LoadAsync(url);

                await browser.RunTest("testSimpleStringConcatFunction");
            }
        }
コード例 #12
0
        public async Task TestV8CacheInterFrame()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("cachetest2", new object());

                await browser.LoadAsync(url);

                await browser.RunTest("testBoundObjectNotCacheInterFrame");
            }
        }
コード例 #13
0
        public async Task UInt16ResultConverted()
        {
            using (var browser = new Util.Browser())
            {
                browser.Repository.AddBinding("test", new TestClass());

                await browser.LoadAsync(url);

                await browser.RunTest("testUInt16Result");
            }
        }
コード例 #14
0
        public async Task CallbackValueBound()
        {
            using (var browser = new Util.Browser())
            {
                var obj = new TestClass();
                browser.Repository.AddBinding("bindingTest2", obj);

                await browser.LoadAsync(url);

                await browser.RunTest("callbackValueBound");
            }
        }
コード例 #15
0
        public async Task TestCallbackBoundToJSObject()
        {
            using (var browser = new Util.Browser())
            {
                var obj = new TestClass();
                browser.Repository.AddBinding("test", obj);

                await browser.LoadAsync(url);

                await browser.RunTest("testCallbackBound");
            }
        }
コード例 #16
0
        public async Task ReturnValuePropertiesExtracted()
        {
            using (var browser = new Util.Browser())
            {
                var obj = new TestClass();
                browser.Repository.AddBinding("bindingTest3", obj);

                await browser.LoadAsync(url);

                await browser.RunTest("returnValuePropertiesExtracted");
            }
        }
コード例 #17
0
        public async Task TestCallbackDispose()
        {
            using (var browser = new Util.Browser())
            {
                var obj = new TestClass();
                browser.Repository.AddBinding("test", obj);

                await browser.LoadAsync(url);

                await browser.RunTest("testCallbackDispose");

                await Assert.ThrowsAsync <Exception>(() => new Callback <CefValue>(obj.Id, browser.BindingHost.CallbackExecutor,
                                                                                   contet => { }).ExecuteAsync());
            }
        }
コード例 #18
0
        public async Task TestPopupCache()
        {
            using (var browser = new Util.Browser())
            {
                var popupBrowserTask = new TaskCompletionSource <Util.Browser>();
                browser.NewBrowser += b =>
                {
                    popupBrowserTask.TrySetResult(b);
                    b.Repository.AddBinding("cachetest4", new TestObject(2));
                };

                browser.Repository.AddBinding("cachetest4", new TestObject(1));

                await browser.LoadAsync(url);

                await browser.RunTest("testCachePerBrowser");
            }
        }