Fixed pass by reference and added spec
This commit is contained in:
parent
950e3436c2
commit
d5a658bbe4
3 changed files with 20 additions and 4 deletions
|
@ -1067,13 +1067,13 @@ void WebContents::GoToOffset(int offset) {
|
||||||
web_contents()->GetController().GoToOffset(offset);
|
web_contents()->GetController().GoToOffset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& WebContents::GetWebRTCIPHandlingPolicy() const {
|
const std::string WebContents::GetWebRTCIPHandlingPolicy() const {
|
||||||
return web_contents()->
|
return web_contents()->
|
||||||
GetMutableRendererPrefs()->webrtc_ip_handling_policy;
|
GetMutableRendererPrefs()->webrtc_ip_handling_policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::SetWebRTCIPHandlingPolicy(
|
void WebContents::SetWebRTCIPHandlingPolicy(
|
||||||
const std::string webrtc_ip_handling_policy) {
|
const std::string& webrtc_ip_handling_policy) {
|
||||||
if (GetWebRTCIPHandlingPolicy() == webrtc_ip_handling_policy)
|
if (GetWebRTCIPHandlingPolicy() == webrtc_ip_handling_policy)
|
||||||
return;
|
return;
|
||||||
web_contents()->GetMutableRendererPrefs()->webrtc_ip_handling_policy =
|
web_contents()->GetMutableRendererPrefs()->webrtc_ip_handling_policy =
|
||||||
|
|
|
@ -92,8 +92,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void GoBack();
|
void GoBack();
|
||||||
void GoForward();
|
void GoForward();
|
||||||
void GoToOffset(int offset);
|
void GoToOffset(int offset);
|
||||||
const std::string& GetWebRTCIPHandlingPolicy() const;
|
const std::string GetWebRTCIPHandlingPolicy() const;
|
||||||
void SetWebRTCIPHandlingPolicy(const std::string webrtc_ip_handling_policy);
|
void SetWebRTCIPHandlingPolicy(const std::string& webrtc_ip_handling_policy);
|
||||||
bool IsCrashed() const;
|
bool IsCrashed() const;
|
||||||
void SetUserAgent(const std::string& user_agent, mate::Arguments* args);
|
void SetUserAgent(const std::string& user_agent, mate::Arguments* args);
|
||||||
std::string GetUserAgent();
|
std::string GetUserAgent();
|
||||||
|
|
|
@ -527,4 +527,20 @@ describe('webContents module', function () {
|
||||||
w.loadURL(`file://${fixtures}/pages/c.html`)
|
w.loadURL(`file://${fixtures}/pages/c.html`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('webrtc ip policy api', () => {
|
||||||
|
it('can set and get webrtc ip policies', (done) => {
|
||||||
|
const policies = [
|
||||||
|
'default',
|
||||||
|
'default_public_interface_only',
|
||||||
|
'default_public_and_private_interfaces',
|
||||||
|
'disable_non_proxied_udp'
|
||||||
|
]
|
||||||
|
policies.forEach((policy) => {
|
||||||
|
w.webContents.setWebRTCIPHandlingPolicy(policy)
|
||||||
|
assert.equal(w.webContents.getWebRTCIPHandlingPolicy(), policy)
|
||||||
|
})
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue