Skip to content

Commit f3e1141

Browse files
committed
VPN: Do not share configured VPNs
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). [email protected] (cherry picked from commit b08867e) 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 <[email protected]> Reviewed-by: Kevin Cernekee <[email protected]> Reviewed-by: Toni Barzic <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#531008} Reviewed-on: https://chromium-review.googlesource.com/882551 Reviewed-by: Steven Bennetts <[email protected]> Cr-Commit-Position: refs/branch-heads/3325@{#52} Cr-Branched-From: bc084a8-refs/heads/master@{#530369}
1 parent 4a5646e commit f3e1141

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

chrome/test/data/webui/cr_components/network_config_test.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ suite('network-config', function() {
2828
networkConfig = document.createElement('network-config');
2929
networkConfig.networkingPrivate = api_;
3030
networkConfig.networkProperties = networkProperties;
31+
}
32+
33+
function initNetworkConfig() {
3134
document.body.appendChild(networkConfig);
3235
networkConfig.init();
3336
Polymer.dom.flush();
@@ -44,6 +47,7 @@ suite('network-config', function() {
4447
setup(function() {
4548
api_.resetForTest();
4649
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
50+
initNetworkConfig();
4751
});
4852

4953
teardown(function() {
@@ -69,6 +73,7 @@ suite('network-config', function() {
6973
};
7074
api_.addNetworksForTest([network]);
7175
setNetworkConfig({GUID: 'someguid', Name: '', Type: 'WiFi'});
76+
initNetworkConfig();
7277
});
7378

7479
teardown(function() {
@@ -116,10 +121,11 @@ suite('network-config', function() {
116121
}
117122

118123
test('New Config: Login or guest', function() {
119-
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
120-
setLoginOrGuest();
121124
// Insecure networks are always shared so test a secure config.
122-
networkConfig.security_ = 'WEP-PSK';
125+
setNetworkConfig(
126+
{GUID: '', Name: '', Type: 'WiFi', WiFi: {Security: 'WEP-PSK'}});
127+
setLoginOrGuest();
128+
initNetworkConfig();
123129
return flushAsync().then(() => {
124130
let share = networkConfig.$$('#share');
125131
assertTrue(!!share);
@@ -129,10 +135,11 @@ suite('network-config', function() {
129135
});
130136

131137
test('New Config: Kiosk', function() {
132-
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
133-
setKiosk();
134138
// Insecure networks are always shared so test a secure config.
135-
networkConfig.security_ = 'WEP-PSK';
139+
setNetworkConfig(
140+
{GUID: '', Name: '', Type: 'WiFi', WiFi: {Security: 'WEP-PSK'}});
141+
setKiosk();
142+
initNetworkConfig();
136143
return flushAsync().then(() => {
137144
let share = networkConfig.$$('#share');
138145
assertTrue(!!share);
@@ -142,8 +149,10 @@ suite('network-config', function() {
142149
});
143150

144151
test('New Config: Authenticated, Not secure', function() {
145-
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
152+
setNetworkConfig(
153+
{GUID: '', Name: '', Type: 'WiFi', WiFi: {Security: 'None'}});
146154
setAuthenticated();
155+
initNetworkConfig();
147156
return flushAsync().then(() => {
148157
let share = networkConfig.$$('#share');
149158
assertTrue(!!share);
@@ -153,9 +162,10 @@ suite('network-config', function() {
153162
});
154163

155164
test('New Config: Authenticated, Secure', function() {
156-
setNetworkConfig({GUID: '', Name: '', Type: 'WiFi'});
165+
setNetworkConfig(
166+
{GUID: '', Name: '', Type: 'WiFi', WiFi: {Security: 'WEP-PSK'}});
157167
setAuthenticated();
158-
networkConfig.security_ = 'WEP-PSK';
168+
initNetworkConfig();
159169
return flushAsync().then(() => {
160170
let share = networkConfig.$$('#share');
161171
assertTrue(!!share);
@@ -176,6 +186,7 @@ suite('network-config', function() {
176186
api_.addNetworksForTest([network]);
177187
setNetworkConfig({GUID: 'someguid', Name: '', Type: 'WiFi'});
178188
setAuthenticated();
189+
initNetworkConfig();
179190
return flushAsync().then(() => {
180191
assertFalse(!!networkConfig.$$('#share'));
181192
});
@@ -190,6 +201,7 @@ suite('network-config', function() {
190201
};
191202
api_.addNetworksForTest([ethernet]);
192203
setNetworkConfig({GUID: 'ethernetguid', Name: '', Type: 'Ethernet'});
204+
initNetworkConfig();
193205
return flushAsync().then(() => {
194206
assertEquals('ethernetguid', networkConfig.guid);
195207
assertEquals('None', networkConfig.security_);
@@ -216,6 +228,7 @@ suite('network-config', function() {
216228
};
217229
api_.addNetworksForTest([ethernet, ethernetEap]);
218230
setNetworkConfig({GUID: 'ethernetguid', Name: '', Type: 'Ethernet'});
231+
initNetworkConfig();
219232
return flushAsync().then(() => {
220233
assertEquals('eapguid', networkConfig.guid);
221234
assertEquals('WPA-EAP', networkConfig.security_);

ui/webui/resources/cr_components/chromeos/network/network_config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ Polymer({
348348
}
349349
this.onCertificateListsChanged_();
350350
this.updateIsConfigured_();
351+
this.setShareNetwork_();
351352
requestAnimationFrame(() => {
352353
var e = this.$$(
353354
'network-config-input:not([disabled]),' +
@@ -542,6 +543,10 @@ Polymer({
542543
source == CrOnc.Source.DEVICE || source == CrOnc.Source.DEVICE_POLICY;
543544
return;
544545
}
546+
if (!this.shareIsVisible_()) {
547+
this.shareNetwork_ = false;
548+
return;
549+
}
545550
if (this.shareAllowEnable) {
546551
// New insecure WiFi networks are always shared.
547552
if (this.networkProperties.Type == CrOnc.Type.WI_FI &&

0 commit comments

Comments
 (0)