Skip to content

Commit 1c471bb

Browse files
committed
Stricter test
1 parent 2d25f26 commit 1c471bb

File tree

2 files changed

+44
-11
lines changed

2 files changed

+44
-11
lines changed

CefSharp.BrowserSubprocess.Core/JavascriptBindingSettings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace CefSharp
2121
JavascriptBindingSettings()
2222
{
2323
LegacyBindingEnabled = false;
24+
JavascriptBindingApiEnabled = true;
2425
JavascriptBindingPropertyName = "CefSharp";
2526
JavascriptBindingPropertyNameCamelCase = "cefSharp";
26-
JavascriptBindingApiEnabled = true;
2727
JavascriptBindingApiHasAllowOrigins = false;
2828
JavascriptBindingApiAllowOrigins = nullptr;
2929
}
@@ -39,11 +39,11 @@ namespace CefSharp
3939
}
4040

4141
property bool LegacyBindingEnabled;
42+
property bool JavascriptBindingApiEnabled;
4243

4344
property String^ JavascriptBindingPropertyName;
4445
property String^ JavascriptBindingPropertyNameCamelCase;
4546

46-
property bool JavascriptBindingApiEnabled;
4747
property bool JavascriptBindingApiHasAllowOrigins;
4848
property CefRefPtr<CefListValue> JavascriptBindingApiAllowOrigins
4949
{

CefSharp.Test/JavascriptBinding/JavascriptBindingTests.cs

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,51 @@ public async Task ShouldWorkWhenUsingCustomGlobalObjectNameInMultipleBrowsers()
107107
await browser2.WaitForInitialLoadAsync();
108108
await browser3.WaitForInitialLoadAsync();
109109

110-
var result1 = await browser1.EvaluateScriptAsync("typeof window.bindingApiObject1 === 'undefined'");
111-
var result2 = await browser2.EvaluateScriptAsync("typeof window.bindingApiObject2 === 'undefined'");
112-
var result3 = await browser3.EvaluateScriptAsync("typeof window.cefSharp === 'undefined'");
110+
// Assert browser1
111+
{
112+
var result1 = await browser1.EvaluateScriptAsync("typeof window.bindingApiObject1 === 'undefined'");
113+
var result2 = await browser1.EvaluateScriptAsync("typeof window.bindingApiObject2 === 'undefined'");
114+
var result3 = await browser1.EvaluateScriptAsync("typeof window.cefSharp === 'undefined'");
115+
116+
Assert.True(result1.Success, result1.Message);
117+
Assert.False((bool)result1.Result);
118+
119+
Assert.True(result2.Success, result2.Message);
120+
Assert.True((bool)result2.Result);
121+
122+
Assert.True(result3.Success, result3.Message);
123+
Assert.True((bool)result3.Result);
124+
}
125+
// Assert browser2
126+
{
127+
var result1 = await browser2.EvaluateScriptAsync("typeof window.bindingApiObject1 === 'undefined'");
128+
var result2 = await browser2.EvaluateScriptAsync("typeof window.bindingApiObject2 === 'undefined'");
129+
var result3 = await browser2.EvaluateScriptAsync("typeof window.cefSharp === 'undefined'");
113130

114-
Assert.True(result1.Success, result1.Message);
115-
Assert.False((bool)result1.Result);
131+
Assert.True(result1.Success, result1.Message);
132+
Assert.True((bool)result1.Result);
116133

117-
Assert.True(result2.Success, result2.Message);
118-
Assert.False((bool)result2.Result);
134+
Assert.True(result2.Success, result2.Message);
135+
Assert.False((bool)result2.Result);
119136

120-
Assert.True(result3.Success, result3.Message);
121-
Assert.False((bool)result3.Result);
137+
Assert.True(result3.Success, result3.Message);
138+
Assert.True((bool)result3.Result);
139+
}
140+
// Assert browser3
141+
{
142+
var result1 = await browser3.EvaluateScriptAsync("typeof window.bindingApiObject1 === 'undefined'");
143+
var result2 = await browser3.EvaluateScriptAsync("typeof window.bindingApiObject2 === 'undefined'");
144+
var result3 = await browser3.EvaluateScriptAsync("typeof window.cefSharp === 'undefined'");
145+
146+
Assert.True(result1.Success, result1.Message);
147+
Assert.True((bool)result1.Result);
148+
149+
Assert.True(result2.Success, result2.Message);
150+
Assert.True((bool)result2.Result);
151+
152+
Assert.True(result3.Success, result3.Message);
153+
Assert.False((bool)result3.Result);
154+
}
122155
}
123156

124157
[Theory]

0 commit comments

Comments
 (0)