Skip to content

Commit

Permalink
VPN: Do not share configured VPNs
Browse files Browse the repository at this point in the history
VPN configurations were never shared in the non Settings based UI.
We should preserve that behavior in the new UI. (The current behavior
is completely wrong and always shares VPN configurations even when
they require certificates).

Bug: 798924
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I4470a77b8f4f36e0f46aba5505eafd96fb0ca799
Reviewed-on: https://chromium-review.googlesource.com/876933
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Kevin Cernekee <cernekee@chromium.org>
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531008}
  • Loading branch information
stevenjb authored and Commit Bot committed Jan 22, 2018
1 parent db0d677 commit b08867e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
31 changes: 22 additions & 9 deletions chrome/test/data/webui/cr_components/network_config_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ suite('network-config', function() {
networkConfig = document.createElement('network-config');
networkConfig.networkingPrivate = api_;
networkConfig.networkProperties = networkProperties;
}

function initNetworkConfig() {
document.body.appendChild(networkConfig);
networkConfig.init();
Polymer.dom.flush();
Expand All @@ -44,6 +47,7 @@ suite('network-config', function() {
setup(function() {
api_.resetForTest();
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
initNetworkConfig();
});

teardown(function() {
Expand All @@ -69,6 +73,7 @@ suite('network-config', function() {
};
api_.addNetworksForTest([network]);
setNetworkConfig({GUID: 'someguid', Name: '', Type: 'WiFi'});
initNetworkConfig();
});

teardown(function() {
Expand Down Expand Up @@ -116,10 +121,11 @@ suite('network-config', function() {
}

test('New Config: Login or guest', function() {
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
setLoginOrGuest();
// Insecure networks are always shared so test a secure config.
networkConfig.security_ = 'WEP-PSK';
setNetworkConfig(
{GUID: '', Name: '', Type: 'WiFi', WiFi: {Security: 'WEP-PSK'}});
setLoginOrGuest();
initNetworkConfig();
return flushAsync().then(() => {
let share = networkConfig.$$('#share');
assertTrue(!!share);
Expand All @@ -129,10 +135,11 @@ suite('network-config', function() {
});

test('New Config: Kiosk', function() {
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
setKiosk();
// Insecure networks are always shared so test a secure config.
networkConfig.security_ = 'WEP-PSK';
setNetworkConfig(
{GUID: '', Name: '', Type: 'WiFi', WiFi: {Security: 'WEP-PSK'}});
setKiosk();
initNetworkConfig();
return flushAsync().then(() => {
let share = networkConfig.$$('#share');
assertTrue(!!share);
Expand All @@ -142,8 +149,10 @@ suite('network-config', function() {
});

test('New Config: Authenticated, Not secure', function() {
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
setNetworkConfig(
{GUID: '', Name: '', Type: 'WiFi', WiFi: {Security: 'None'}});
setAuthenticated();
initNetworkConfig();
return flushAsync().then(() => {
let share = networkConfig.$$('#share');
assertTrue(!!share);
Expand All @@ -153,9 +162,10 @@ suite('network-config', function() {
});

test('New Config: Authenticated, Secure', function() {
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
setNetworkConfig(
{GUID: '', Name: '', Type: 'WiFi', WiFi: {Security: 'WEP-PSK'}});
setAuthenticated();
networkConfig.security_ = 'WEP-PSK';
initNetworkConfig();
return flushAsync().then(() => {
let share = networkConfig.$$('#share');
assertTrue(!!share);
Expand All @@ -176,6 +186,7 @@ suite('network-config', function() {
api_.addNetworksForTest([network]);
setNetworkConfig({GUID: 'someguid', Name: '', Type: 'WiFi'});
setAuthenticated();
initNetworkConfig();
return flushAsync().then(() => {
assertFalse(!!networkConfig.$$('#share'));
});
Expand All @@ -190,6 +201,7 @@ suite('network-config', function() {
};
api_.addNetworksForTest([ethernet]);
setNetworkConfig({GUID: 'ethernetguid', Name: '', Type: 'Ethernet'});
initNetworkConfig();
return flushAsync().then(() => {
assertEquals('ethernetguid', networkConfig.guid);
assertEquals('None', networkConfig.security_);
Expand All @@ -216,6 +228,7 @@ suite('network-config', function() {
};
api_.addNetworksForTest([ethernet, ethernetEap]);
setNetworkConfig({GUID: 'ethernetguid', Name: '', Type: 'Ethernet'});
initNetworkConfig();
return flushAsync().then(() => {
assertEquals('eapguid', networkConfig.guid);
assertEquals('WPA-EAP', networkConfig.security_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ Polymer({
}
this.onCertificateListsChanged_();
this.updateIsConfigured_();
this.setShareNetwork_();
requestAnimationFrame(() => {
var e = this.$$(
'network-config-input:not([disabled]),' +
Expand Down Expand Up @@ -542,6 +543,10 @@ Polymer({
source == CrOnc.Source.DEVICE || source == CrOnc.Source.DEVICE_POLICY;
return;
}
if (!this.shareIsVisible_()) {
this.shareNetwork_ = false;
return;
}
if (this.shareAllowEnable) {
// New insecure WiFi networks are always shared.
if (this.networkProperties.Type == CrOnc.Type.WI_FI &&
Expand Down

0 comments on commit b08867e

Please sign in to comment.