OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This should output "PROXY success:80" if all the tests pass. | 5 // This should output "PROXY success:80" if all the tests pass. |
6 // Otherwise it will output "PROXY failure:<num-failures>". | 6 // Otherwise it will output "PROXY failure:<num-failures>". |
7 // | 7 // |
8 // This aims to unit-test the PAC library functions, which are | 8 // This aims to unit-test the PAC library functions, which are |
9 // exposed in the PAC's execution environment. (Namely, dnsDomainLevels, | 9 // exposed in the PAC's execution environment. (Namely, dnsDomainLevels, |
10 // timeRange, etc.) | 10 // timeRange, etc.) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 Tests.testIsPlainHostName = function(t) { | 65 Tests.testIsPlainHostName = function(t) { |
66 t.expectTrue(isPlainHostName("google")); | 66 t.expectTrue(isPlainHostName("google")); |
67 t.expectFalse(isPlainHostName("google.com")); | 67 t.expectFalse(isPlainHostName("google.com")); |
68 t.expectFalse(isPlainHostName("192.168.1.1")); | 68 t.expectFalse(isPlainHostName("192.168.1.1")); |
69 t.expectFalse(isPlainHostName(".")); | 69 t.expectFalse(isPlainHostName(".")); |
70 t.expectFalse(isPlainHostName(".:")); | 70 t.expectFalse(isPlainHostName(".:")); |
71 | 71 |
72 // Valid IPv6 address | 72 // Valid IPv6 address |
73 t.expectFalse(isPlainHostName("::1")); | 73 t.expectFalse(isPlainHostName("::1")); |
74 | 74 |
| 75 // Valid IPv6 address containing periods. |
| 76 t.expectFalse(isPlainHostName("::192.186.1.1")); |
| 77 |
75 // Not a valid IPv6 address | 78 // Not a valid IPv6 address |
76 t.expectTrue(isPlainHostName("foopy::1")); | 79 t.expectTrue(isPlainHostName("foopy::1")); |
77 t.expectTrue(isPlainHostName("foo:112")); | 80 t.expectTrue(isPlainHostName("foo:112")); |
78 t.expectTrue(isPlainHostName(":")); | 81 t.expectTrue(isPlainHostName(":")); |
79 t.expectTrue(isPlainHostName("[:]")); | 82 t.expectTrue(isPlainHostName("[:]")); |
80 | 83 |
81 // Not considered a valid IPv6 address because of surrounding brackets. | 84 // Not considered a valid IPv6 address because of surrounding brackets. |
82 t.expectTrue(isPlainHostName("[::1]")); | 85 t.expectTrue(isPlainHostName("[::1]")); |
83 | 86 |
84 // Calling with more than 1 argument is allowed. | 87 // Calling with more than 1 argument is allowed. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 "toGMTString", "toUTCString", "getYear", "setYear" | 414 "toGMTString", "toUTCString", "getYear", "setYear" |
412 ]; | 415 ]; |
413 | 416 |
414 MockDate.setCurrent = function(currentDateString) { | 417 MockDate.setCurrent = function(currentDateString) { |
415 MockDate.currentDateString_ = currentDateString; | 418 MockDate.currentDateString_ = currentDateString; |
416 } | 419 } |
417 | 420 |
418 // Bind the methods to proxy requests to the wrapped Date(). | 421 // Bind the methods to proxy requests to the wrapped Date(). |
419 MockDate.init(); | 422 MockDate.init(); |
420 | 423 |
OLD | NEW |