Commit 9513f52b authored by Eric Roman's avatar Eric Roman Committed by Commit Bot

Update the PAC JavaScript library to match latest Firefox code.

This brings it up to revision 6aa3b57955fed5e137d0306478e1a4b424a6d392, which includes the following two changes:

* Support for reversed dates in timeRange() and dateRange():
  https://hg.mozilla.org/mozilla-central/rev/cd913073f87c
* Additional validation of IP(v4) literals in isInNet:
  https://hg.mozilla.org/mozilla-central/rev/dd66d01e757c

Bug: 827292
Change-Id: I3d6670c7ceed0fc1bc453d6892922ffb047ab2bc
Reviewed-on: https://chromium-review.googlesource.com/986949
Commit-Queue: Eric Roman <eroman@chromium.org>
Reviewed-by: default avatarHelen Li <xunjieli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548253}
parent 1df2f270
......@@ -220,6 +220,7 @@ Tests.testWeekdayRange = function(t) {
t.expectEquals(true, weekdayRange("MON", "FRI"));
t.expectEquals(true, weekdayRange("TUE", "FRI"));
t.expectEquals(true, weekdayRange("TUE", "TUE"));
t.expectEquals(true, weekdayRange("SAT", "WED"));
t.expectEquals(true, weekdayRange("TUE"));
t.expectEquals(false, weekdayRange("WED", "FRI"));
t.expectEquals(false, weekdayRange("SUN", "MON"));
......@@ -270,20 +271,40 @@ Tests.testDateRange = function(t) {
// dateRange(day, month, year)
MockDate.setCurrent("Mar 03 2009");
t.expectEquals(true, dateRange(3, "MAR", 2009));
t.expectEquals(false, dateRange(4, "MAR", 2009));
t.expectEquals(false, dateRange(3, "FEB", 2009));
// Unclear what this is supposed to mean. Behavior changed with
// https://hg.mozilla.org/mozilla-central/rev/cd913073f87c.
// See also https://crbug.com/827292
t.expectEquals(true, dateRange(4, "MAR", 2009));
t.expectEquals(true, dateRange(3, "FEB", 2009));
MockDate.setCurrent("Mar 03 2014");
t.expectEquals(false, dateRange(3, "MAR", 2009));
// Unclear what this is supposed to mean. Behavior changed with
// https://hg.mozilla.org/mozilla-central/rev/cd913073f87c.
// See also https://crbug.com/827292
t.expectEquals(true, dateRange(3, "MAR", 2009));
// dateRange(month1, month2)
MockDate.setCurrent("Mar 03 2009");
t.expectEquals(true, dateRange("JAN", "MAR"));
// The reverse should also work.
t.expectEquals(true, dateRange("MAR", "JAN"));
t.expectEquals(true, dateRange("SEP", "APR"));
t.expectEquals(true, dateRange("FEB", "JAN"));
t.expectEquals(false, dateRange("SEP", "FEB"));
t.expectEquals(true, dateRange("MAR", "APR"));
t.expectEquals(false, dateRange("MAY", "SEP"));
// dateRange(day1, month1, day2, month2)
MockDate.setCurrent("Mar 03 2009");
t.expectEquals(true, dateRange(1, "JAN", 3, "MAR"));
// The reverse should also work.
t.expectEquals(true, dateRange(3, "MAR", 1, "JAN"));
t.expectEquals(true, dateRange(4, "SEP", 3, "APR"));
t.expectEquals(true, dateRange(4, "FEB", 3, "JAN"));
t.expectEquals(false, dateRange(4, "SEP", 3, "FEB"));
t.expectEquals(true, dateRange(3, "MAR", 4, "SEP"));
t.expectEquals(false, dateRange(4, "MAR", 4, "SEP"));
......@@ -319,6 +340,8 @@ Tests.testTimeRange = function(t) {
// timeRange(hour1, min1, hour2, min2)
MockDate.setCurrent("Mar 03, 2009 03:34:01");
t.expectEquals(true, timeRange(1, 0, 3, 34));
// The reverse should also work.
t.expectEquals(true, timeRange(3, 34, 1, 0));
t.expectEquals(true, timeRange(1, 0, 3, 35));
t.expectEquals(true, timeRange(3, 34, 5, 0));
t.expectEquals(false, timeRange(1, 0, 3, 0));
......@@ -351,8 +374,10 @@ TestContext.prototype.failed = function() {
TestContext.prototype.expectEquals = function(expectation, actual) {
if (!(expectation === actual)) {
var callstack = new Error().stack;
this.numFailures_++;
this.log("FAIL: expected: " + expectation + ", actual: " + actual);
this.log("FAIL: expected: " + expectation +
", actual: " + actual + "\n" + callstack);
}
};
......
This diff is collapsed.
......@@ -20,6 +20,7 @@
using net::test::IsError;
using net::test::IsOk;
using ::testing::IsEmpty;
namespace net {
namespace {
......@@ -347,11 +348,11 @@ TEST_F(ProxyResolverV8Test, JavascriptLibrary) {
// If the javascript side of this unit-test fails, it will throw a javascript
// exception. Otherwise it will return "PROXY success:80".
EXPECT_THAT(result, IsOk());
EXPECT_EQ("success:80", proxy_info.proxy_server().ToURI());
EXPECT_THAT(bindings()->alerts, IsEmpty());
EXPECT_THAT(bindings()->errors, IsEmpty());
EXPECT_EQ(0U, bindings()->alerts.size());
EXPECT_EQ(0U, bindings()->errors.size());
ASSERT_THAT(result, IsOk());
EXPECT_EQ("success:80", proxy_info.proxy_server().ToURI());
}
// Test marshalling/un-marshalling of values between C++/V8.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment