@@ -198,9 +198,9 @@ class NSURLExtensionsTests: XCTestCase {
198
198
]
199
199
let badurls = [
200
200
" http://google.com " ,
201
- " http://localhost:6571 /sessionrestore.html " ,
202
- " http://localhost:6571 /errors/error.html?url=http%3A//mozilla.com " ,
203
- " http://localhost:6571 /errors/error.html?url=http%3A//mozilla.com/about/home/%23panel%3D1 " ,
201
+ " http://localhost: \( AppInfo . webserverPort ) /sessionrestore.html " ,
202
+ " http://localhost: \( AppInfo . webserverPort ) /errors/error.html?url=http%3A//mozilla.com " ,
203
+ " http://localhost: \( AppInfo . webserverPort ) /errors/error.html?url=http%3A//mozilla.com/about/home/%23panel%3D1 " ,
204
204
]
205
205
206
206
checkUrls ( goodurls: goodurls, badurls: badurls, checker: { url in
@@ -215,9 +215,9 @@ class NSURLExtensionsTests: XCTestCase {
215
215
]
216
216
let badurls = [
217
217
" http://google.com " ,
218
- " http://localhost:6571 /sessionrestore.html " ,
219
- " http://localhost:6571 /errors/error.html?url=http%3A//mozilla.com " ,
220
- " http://localhost:6571 /errors/error.html?url=http%3A//mozilla.com/about/home/%23panel%3D1 " ,
218
+ " http://localhost: \( AppInfo . webserverPort ) /sessionrestore.html " ,
219
+ " http://localhost: \( AppInfo . webserverPort ) /errors/error.html?url=http%3A//mozilla.com " ,
220
+ " http://localhost: \( AppInfo . webserverPort ) /errors/error.html?url=http%3A//mozilla.com/about/home/%23panel%3D1 " ,
221
221
]
222
222
223
223
checkUrls ( goodurls: goodurls, badurls: badurls, checker: { url in
@@ -231,7 +231,7 @@ class NSURLExtensionsTests: XCTestCase {
231
231
]
232
232
let badurls = [
233
233
" http://google.com " ,
234
- " http://localhost:6571 /sessionrestore.html " ,
234
+ " http://localhost: \( AppInfo . webserverPort ) /sessionrestore.html " ,
235
235
" http://localhost:1234/about/home/#panel=0 "
236
236
]
237
237
@@ -243,7 +243,7 @@ class NSURLExtensionsTests: XCTestCase {
243
243
func testoriginalURLFromErrorURL( ) {
244
244
let goodurls = [
245
245
( " \( InternalURL . baseUrl) / \( InternalURL . Path. errorpage) ?url=http%3A//mozilla.com " , URL ( string: " http://mozilla.com " ) ) ,
246
- ( " \( InternalURL . baseUrl) / \( InternalURL . Path. errorpage) ?url=http%3A//localhost%3A6571 /about/home/%23panel%3D1 " , URL ( string: " http://localhost:6571 /about/home/#panel=1 " ) ) ,
246
+ ( " \( InternalURL . baseUrl) / \( InternalURL . Path. errorpage) ?url=http%3A//localhost%3A \( AppInfo . webserverPort ) /about/home/%23panel%3D1 " , URL ( string: " http://localhost: \( AppInfo . webserverPort ) /about/home/#panel=1 " ) ) ,
247
247
]
248
248
249
249
goodurls. forEach {
@@ -255,12 +255,12 @@ class NSURLExtensionsTests: XCTestCase {
255
255
256
256
func testisReaderModeURL( ) {
257
257
let goodurls = [
258
- " http://localhost:6571 /reader-mode/page " ,
259
- " http://localhost:6571 /reader-mode/page?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2FMain%5FPage " ,
258
+ " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page " ,
259
+ " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2FMain%5FPage " ,
260
260
]
261
261
let badurls = [
262
262
" http://google.com " ,
263
- " http://localhost:6571 /sessionrestore.html " ,
263
+ " http://localhost: \( AppInfo . webserverPort ) /sessionrestore.html " ,
264
264
" http://localhost:1234/about/home/#panel=0 "
265
265
]
266
266
@@ -277,7 +277,7 @@ class NSURLExtensionsTests: XCTestCase {
277
277
]
278
278
let badurls = [
279
279
" http://google.com " ,
280
- " http://localhost:6571 /sessionrestore.html " ,
280
+ " http://localhost: \( AppInfo . webserverPort ) /sessionrestore.html " ,
281
281
" about:reader " ,
282
282
" http://about:reader?url=http://example.com "
283
283
]
@@ -288,25 +288,25 @@ class NSURLExtensionsTests: XCTestCase {
288
288
289
289
func testdecodeReaderModeURL( ) {
290
290
let goodurls = [
291
- ( " http://localhost:6571 /reader-mode/page?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2FMain%5FPage&uuidkey=AAAAA " , URL ( string: " https://en.m.wikipedia.org/wiki/Main_Page " ) ) ,
291
+ ( " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2FMain%5FPage&uuidkey=AAAAA " , URL ( string: " https://en.m.wikipedia.org/wiki/Main_Page " ) ) ,
292
292
( " about:reader?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2FMain%5FPage&uuidkey=AAAAA " , URL ( string: " https://en.m.wikipedia.org/wiki/Main_Page " ) ) ,
293
293
( " about:reader?url=http%3A%2F%2Fexample%2Ecom%3Furl%3Dparam%26key%3Dvalue&uuidkey=AAAAA " , URL ( string: " http://example.com?url=param&key=value " ) )
294
294
]
295
295
let badurls = [
296
296
" http://google.com " ,
297
- " http://localhost:6571 /sessionrestore.html " ,
297
+ " http://localhost: \( AppInfo . webserverPort ) /sessionrestore.html " ,
298
298
" http://localhost:1234/about/home/#panel=0 " ,
299
- " http://localhost:6571 /reader-mode/page " ,
299
+ " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page " ,
300
300
" about:reader?url= "
301
301
]
302
302
303
303
goodurls. forEach { XCTAssertEqual ( URL ( string: $0. 0 ) !. decodeReaderModeURL, $0. 1 ) }
304
304
badurls. forEach { XCTAssertNil ( URL ( string: $0) !. decodeReaderModeURL, $0) } }
305
305
306
306
func testencodeReaderModeURL( ) {
307
- let ReaderURL = " http://localhost:6571 /reader-mode/page "
307
+ let ReaderURL = " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page "
308
308
let goodurls = [
309
- ( " https://en.m.wikipedia.org/wiki/Main_Page " , URL ( string: " http://localhost:6571 /reader-mode/page?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2FMain%5FPage " ) )
309
+ ( " https://en.m.wikipedia.org/wiki/Main_Page " , URL ( string: " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2FMain%5FPage " ) )
310
310
]
311
311
goodurls. forEach { XCTAssertEqual ( URL ( string: $0. 0 ) !. encodeReaderModeURL ( ReaderURL) , $0. 1 ) }
312
312
}
@@ -322,13 +322,13 @@ class NSURLExtensionsTests: XCTestCase {
322
322
323
323
func testschemeIsValid( ) {
324
324
let goodurls = [
325
- " http://localhost:6571 /reader-mode/page " ,
325
+ " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page " ,
326
326
" https://google.com " ,
327
327
" tel:6044044004 "
328
328
]
329
329
let badurls = [
330
330
" blah://google.com " ,
331
- " hax://localhost:6571 /sessionrestore.html " ,
331
+ " hax://localhost: \( AppInfo . webserverPort ) /sessionrestore.html " ,
332
332
" leet://codes.com "
333
333
]
334
334
@@ -338,15 +338,15 @@ class NSURLExtensionsTests: XCTestCase {
338
338
339
339
func testisWebPage( ) {
340
340
let goodurls = [
341
- " http://localhost:6571 /reader-mode/page " ,
342
- " https://127.0.0.1:6571 /sessionrestore.html " ,
343
- " data://:6571 /sessionrestore.html "
341
+ " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page " ,
342
+ " https://127.0.0.1: \( AppInfo . webserverPort ) /sessionrestore.html " ,
343
+ " data://: \( AppInfo . webserverPort ) /sessionrestore.html "
344
344
345
345
]
346
346
let badurls = [
347
347
" about://google.com " ,
348
348
" tel:6044044004 " ,
349
- " hax://localhost:6571 /about "
349
+ " hax://localhost: \( AppInfo . webserverPort ) /about "
350
350
]
351
351
352
352
goodurls. forEach { XCTAssertTrue ( URL ( string: $0) !. isWebPage ( ) , $0) }
@@ -364,15 +364,15 @@ class NSURLExtensionsTests: XCTestCase {
364
364
365
365
func testdisplayURL( ) {
366
366
let goodurls = [
367
- ( " http://localhost:6571 /reader-mode/page?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2F " , " https://en.m.wikipedia.org/wiki/ " ) ,
367
+ ( " http://localhost: \( AppInfo . webserverPort ) /reader-mode/page?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2F " , " https://en.m.wikipedia.org/wiki/ " ) ,
368
368
( " \( InternalURL . baseUrl) / \( InternalURL . Path. errorpage) ?url=http%3A//mozilla.com " , " http://mozilla.com " ) ,
369
369
( " \( InternalURL . baseUrl) / \( InternalURL . Path. errorpage) ?url=http%3A//mozilla.com " , " http://mozilla.com " ) ,
370
- ( " \( InternalURL . baseUrl) / \( InternalURL . Path. errorpage) ?url=http%3A%2F%2Flocalhost%3A6571 %2Freader-mode%2Fpage%3Furl%3Dhttps%253A%252F%252Fen%252Em%252Ewikipedia%252Eorg%252Fwiki%252F " , " https://en.m.wikipedia.org/wiki/ " ) ,
370
+ ( " \( InternalURL . baseUrl) / \( InternalURL . Path. errorpage) ?url=http%3A%2F%2Flocalhost%3A \( AppInfo . webserverPort ) %2Freader-mode%2Fpage%3Furl%3Dhttps%253A%252F%252Fen%252Em%252Ewikipedia%252Eorg%252Fwiki%252F " , " https://en.m.wikipedia.org/wiki/ " ) ,
371
371
( " https://mail.example.co.uk/index.html " , " https://mail.example.co.uk/index.html " ) ,
372
372
]
373
373
let badurls = [
374
- " http://localhost:6571 /errors/error.html?url=http%3A//localhost%3A6571 /about/home/%23panel%3D1 " ,
375
- " http://localhost:6571 /errors/error.html " ,
374
+ " http://localhost: \( AppInfo . webserverPort ) /errors/error.html?url=http%3A//localhost%3A \( AppInfo . webserverPort ) /about/home/%23panel%3D1 " ,
375
+ " http://localhost: \( AppInfo . webserverPort ) /errors/error.html " ,
376
376
377
377
]
378
378
@@ -389,7 +389,7 @@ class NSURLExtensionsTests: XCTestCase {
389
389
]
390
390
let badurls = [
391
391
" http:///errors/error.html " ,
392
- " http://:6571 /about/home " ,
392
+ " http://: \( AppInfo . webserverPort ) /about/home " ,
393
393
]
394
394
395
395
goodurls. forEach { XCTAssertEqual ( URL ( string: $0. 0 ) !. normalizedHostAndPath, $0. 1 ) }
0 commit comments