@@ -28,6 +28,9 @@ suite('network-config', function() {
28
28
networkConfig = document . createElement ( 'network-config' ) ;
29
29
networkConfig . networkingPrivate = api_ ;
30
30
networkConfig . networkProperties = networkProperties ;
31
+ }
32
+
33
+ function initNetworkConfig ( ) {
31
34
document . body . appendChild ( networkConfig ) ;
32
35
networkConfig . init ( ) ;
33
36
Polymer . dom . flush ( ) ;
@@ -44,6 +47,7 @@ suite('network-config', function() {
44
47
setup ( function ( ) {
45
48
api_ . resetForTest ( ) ;
46
49
setNetworkConfig ( { GUID : '' , Name : '' , Type : 'WiFi' } ) ;
50
+ initNetworkConfig ( ) ;
47
51
} ) ;
48
52
49
53
teardown ( function ( ) {
@@ -69,6 +73,7 @@ suite('network-config', function() {
69
73
} ;
70
74
api_ . addNetworksForTest ( [ network ] ) ;
71
75
setNetworkConfig ( { GUID : 'someguid' , Name : '' , Type : 'WiFi' } ) ;
76
+ initNetworkConfig ( ) ;
72
77
} ) ;
73
78
74
79
teardown ( function ( ) {
@@ -116,10 +121,11 @@ suite('network-config', function() {
116
121
}
117
122
118
123
test ( 'New Config: Login or guest' , function ( ) {
119
- setNetworkConfig ( { GUID : '' , Name : '' , Type : 'WiFi' } ) ;
120
- setLoginOrGuest ( ) ;
121
124
// 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 ( ) ;
123
129
return flushAsync ( ) . then ( ( ) => {
124
130
let share = networkConfig . $$ ( '#share' ) ;
125
131
assertTrue ( ! ! share ) ;
@@ -129,10 +135,11 @@ suite('network-config', function() {
129
135
} ) ;
130
136
131
137
test ( 'New Config: Kiosk' , function ( ) {
132
- setNetworkConfig ( { GUID : '' , Name : '' , Type : 'WiFi' } ) ;
133
- setKiosk ( ) ;
134
138
// 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 ( ) ;
136
143
return flushAsync ( ) . then ( ( ) => {
137
144
let share = networkConfig . $$ ( '#share' ) ;
138
145
assertTrue ( ! ! share ) ;
@@ -142,8 +149,10 @@ suite('network-config', function() {
142
149
} ) ;
143
150
144
151
test ( 'New Config: Authenticated, Not secure' , function ( ) {
145
- setNetworkConfig ( { GUID : '' , Name : '' , Type : 'WiFi' } ) ;
152
+ setNetworkConfig (
153
+ { GUID : '' , Name : '' , Type : 'WiFi' , WiFi : { Security : 'None' } } ) ;
146
154
setAuthenticated ( ) ;
155
+ initNetworkConfig ( ) ;
147
156
return flushAsync ( ) . then ( ( ) => {
148
157
let share = networkConfig . $$ ( '#share' ) ;
149
158
assertTrue ( ! ! share ) ;
@@ -153,9 +162,10 @@ suite('network-config', function() {
153
162
} ) ;
154
163
155
164
test ( 'New Config: Authenticated, Secure' , function ( ) {
156
- setNetworkConfig ( { GUID : '' , Name : '' , Type : 'WiFi' } ) ;
165
+ setNetworkConfig (
166
+ { GUID : '' , Name : '' , Type : 'WiFi' , WiFi : { Security : 'WEP-PSK' } } ) ;
157
167
setAuthenticated ( ) ;
158
- networkConfig . security_ = 'WEP-PSK' ;
168
+ initNetworkConfig ( ) ;
159
169
return flushAsync ( ) . then ( ( ) => {
160
170
let share = networkConfig . $$ ( '#share' ) ;
161
171
assertTrue ( ! ! share ) ;
@@ -176,6 +186,7 @@ suite('network-config', function() {
176
186
api_ . addNetworksForTest ( [ network ] ) ;
177
187
setNetworkConfig ( { GUID : 'someguid' , Name : '' , Type : 'WiFi' } ) ;
178
188
setAuthenticated ( ) ;
189
+ initNetworkConfig ( ) ;
179
190
return flushAsync ( ) . then ( ( ) => {
180
191
assertFalse ( ! ! networkConfig . $$ ( '#share' ) ) ;
181
192
} ) ;
@@ -190,6 +201,7 @@ suite('network-config', function() {
190
201
} ;
191
202
api_ . addNetworksForTest ( [ ethernet ] ) ;
192
203
setNetworkConfig ( { GUID : 'ethernetguid' , Name : '' , Type : 'Ethernet' } ) ;
204
+ initNetworkConfig ( ) ;
193
205
return flushAsync ( ) . then ( ( ) => {
194
206
assertEquals ( 'ethernetguid' , networkConfig . guid ) ;
195
207
assertEquals ( 'None' , networkConfig . security_ ) ;
@@ -216,6 +228,7 @@ suite('network-config', function() {
216
228
} ;
217
229
api_ . addNetworksForTest ( [ ethernet , ethernetEap ] ) ;
218
230
setNetworkConfig ( { GUID : 'ethernetguid' , Name : '' , Type : 'Ethernet' } ) ;
231
+ initNetworkConfig ( ) ;
219
232
return flushAsync ( ) . then ( ( ) => {
220
233
assertEquals ( 'eapguid' , networkConfig . guid ) ;
221
234
assertEquals ( 'WPA-EAP' , networkConfig . security_ ) ;
0 commit comments