Commit 0ebc3990 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

Remove devtools ParsedURL unit tests

These have been ported to frontend unit tests.

Bug: 1148495
Change-Id: I3b5dc67f52a19a099d9c0a5708249812fb4f4699
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536271
Auto-Submit: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: default avatarSimon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827178}
parent cd73a227
http://example.com/map.json === http://example.com/map.json
http://example.com/map.json === http://example.com/map.json
http://example.com/maps/map.json === http://example.com/maps/map.json
Tests from http://tools.ietf.org/html/rfc3986#section-5.4 using baseURL="http://a/b/c/d;p?q"
http://h resolves to http://h===http://h passes: true
g resolves to http://a/b/c/g===http://a/b/c/g passes: true
./g resolves to http://a/b/c/g===http://a/b/c/g passes: true
g/ resolves to http://a/b/c/g/===http://a/b/c/g/ passes: true
/g resolves to http://a/g===http://a/g passes: true
//g resolves to http://g===http://g passes: true
?y resolves to http://a/b/c/d;p?y===http://a/b/c/d;p?y passes: true
g?y resolves to http://a/b/c/g?y===http://a/b/c/g?y passes: true
#s resolves to http://a/b/c/d;p?q#s===http://a/b/c/d;p?q#s passes: true
g#s resolves to http://a/b/c/g#s===http://a/b/c/g#s passes: true
g?y#s resolves to http://a/b/c/g?y#s===http://a/b/c/g?y#s passes: true
;x resolves to http://a/b/c/;x===http://a/b/c/;x passes: true
g;x resolves to http://a/b/c/g;x===http://a/b/c/g;x passes: true
g;x?y#s resolves to http://a/b/c/g;x?y#s===http://a/b/c/g;x?y#s passes: true
resolves to http://a/b/c/d;p?q===http://a/b/c/d;p?q passes: true
. resolves to http://a/b/c/===http://a/b/c/ passes: true
./ resolves to http://a/b/c/===http://a/b/c/ passes: true
.. resolves to http://a/b/===http://a/b/ passes: true
../ resolves to http://a/b/===http://a/b/ passes: true
../g resolves to http://a/b/g===http://a/b/g passes: true
../.. resolves to http://a/===http://a/ passes: true
../../ resolves to http://a/===http://a/ passes: true
../../g resolves to http://a/g===http://a/g passes: true
../../../g resolves to http://a/g===http://a/g passes: true
../../../../g resolves to http://a/g===http://a/g passes: true
/./g resolves to http://a/g===http://a/g passes: true
/../g resolves to http://a/g===http://a/g passes: true
g. resolves to http://a/b/c/g.===http://a/b/c/g. passes: true
.g resolves to http://a/b/c/.g===http://a/b/c/.g passes: true
g.. resolves to http://a/b/c/g..===http://a/b/c/g.. passes: true
..g resolves to http://a/b/c/..g===http://a/b/c/..g passes: true
./../g resolves to http://a/b/g===http://a/b/g passes: true
./g/. resolves to http://a/b/c/g/===http://a/b/c/g/ passes: true
g/./h resolves to http://a/b/c/g/h===http://a/b/c/g/h passes: true
g/../h resolves to http://a/b/c/h===http://a/b/c/h passes: true
g;x=1/./y resolves to http://a/b/c/g;x=1/y===http://a/b/c/g;x=1/y passes: true
g;x=1/../y resolves to http://a/b/c/y===http://a/b/c/y passes: true
g?y/./x resolves to http://a/b/c/g?y/./x===http://a/b/c/g?y/./x passes: true
g?y/../x resolves to http://a/b/c/g?y/../x===http://a/b/c/g?y/../x passes: true
g#s/./x resolves to http://a/b/c/g#s/./x===http://a/b/c/g#s/./x passes: true
g#s/../x resolves to http://a/b/c/g#s/../x===http://a/b/c/g#s/../x passes: true
Custom completeURL tests
//secure.com/moo resolves to http://secure.com/moo===http://secure.com/moo passes: true
cat.jpeg resolves to http://a/b/c/cat.jpeg===http://a/b/c/cat.jpeg passes: true
resolves to http://example.com/path.css?query===http://example.com/path.css?query passes: true
(async function () {
TestRunner.addResult("http://example.com/map.json === " + Common.ParsedURL.completeURL("http://example.com/script.js", "http://example.com/map.json"));
TestRunner.addResult("http://example.com/map.json === " + Common.ParsedURL.completeURL("http://example.com/script.js", "/map.json"));
TestRunner.addResult("http://example.com/maps/map.json === " + Common.ParsedURL.completeURL("http://example.com/scripts/script.js", "../maps/map.json"));
function testCompleteURL(base, lhs, rhs)
{
var actual = Common.ParsedURL.completeURL(base, lhs);
TestRunner.addResult(lhs + " resolves to " + actual + "===" + rhs + " passes: " + (actual === rhs));
}
var rfc3986_5_4_baseURL = "http://a/b/c/d;p?q";
TestRunner.addResult("Tests from http://tools.ietf.org/html/rfc3986#section-5.4 using baseURL=\"" + rfc3986_5_4_baseURL + "\"");
var rfc3986_5_4 = testCompleteURL.bind(null, rfc3986_5_4_baseURL);
rfc3986_5_4("http://h", "http://h"); // modified from RFC3986
rfc3986_5_4("g", "http://a/b/c/g");
rfc3986_5_4("./g", "http://a/b/c/g");
rfc3986_5_4("g/", "http://a/b/c/g/");
rfc3986_5_4("/g", "http://a/g");
rfc3986_5_4("//g", "http://g");
rfc3986_5_4("?y", "http://a/b/c/d;p?y");
rfc3986_5_4("g?y", "http://a/b/c/g?y");
rfc3986_5_4("#s", "http://a/b/c/d;p?q#s");
rfc3986_5_4("g#s", "http://a/b/c/g#s");
rfc3986_5_4("g?y#s", "http://a/b/c/g?y#s");
rfc3986_5_4(";x", "http://a/b/c/;x");
rfc3986_5_4("g;x", "http://a/b/c/g;x");
rfc3986_5_4("g;x?y#s", "http://a/b/c/g;x?y#s");
rfc3986_5_4("", "http://a/b/c/d;p?q");
rfc3986_5_4(".", "http://a/b/c/");
rfc3986_5_4("./", "http://a/b/c/");
rfc3986_5_4("..", "http://a/b/");
rfc3986_5_4("../", "http://a/b/");
rfc3986_5_4("../g", "http://a/b/g");
rfc3986_5_4("../..", "http://a/");
rfc3986_5_4("../../", "http://a/");
rfc3986_5_4("../../g", "http://a/g");
rfc3986_5_4("../../../g", "http://a/g");
rfc3986_5_4("../../../../g", "http://a/g");
rfc3986_5_4("/./g", "http://a/g");
rfc3986_5_4("/../g", "http://a/g");
rfc3986_5_4("g." , "http://a/b/c/g.");
rfc3986_5_4(".g" , "http://a/b/c/.g");
rfc3986_5_4("g..", "http://a/b/c/g..");
rfc3986_5_4("..g", "http://a/b/c/..g");
rfc3986_5_4("./../g", "http://a/b/g");
rfc3986_5_4("./g/.", "http://a/b/c/g/");
rfc3986_5_4("g/./h", "http://a/b/c/g/h");
rfc3986_5_4("g/../h", "http://a/b/c/h");
rfc3986_5_4("g;x=1/./y", "http://a/b/c/g;x=1/y");
rfc3986_5_4("g;x=1/../y", "http://a/b/c/y");
rfc3986_5_4("g?y/./x", "http://a/b/c/g?y/./x");
rfc3986_5_4("g?y/../x", "http://a/b/c/g?y/../x");
rfc3986_5_4("g#s/./x", "http://a/b/c/g#s/./x");
rfc3986_5_4("g#s/../x", "http://a/b/c/g#s/../x");
TestRunner.addResult("Custom completeURL tests");
testCompleteURL("http://a/b/c/d;p?q", "//secure.com/moo", "http://secure.com/moo");
testCompleteURL("http://a/b/c/d;p?q", "cat.jpeg", "http://a/b/c/cat.jpeg");
testCompleteURL("http://example.com/path.css?query#fragment","", "http://example.com/path.css?query");
TestRunner.completeTest();
})();
Verify "trie" functionality.
test: testAddWord
trie.add("hello")
trie.has("he") = false
trie.has("hello") = true
trie.has("helloo") = false
test: testAddWords
trie.add("foo")
trie.add("bar")
trie.add("bazz")
trie.has("f") = false
trie.has("ba") = false
trie.has("baz") = false
trie.has("bar") = true
trie.has("bazz") = true
test: testRemoveWord
trie.add("foo")
trie.remove("f") = false
trie.remove("fo") = false
trie.remove("fooo") = false
trie.has("foo") = true
trie.remove("foo") = true
trie.has("foo") = false
test: testAddAfterRemove
trie.add("foo")
trie.remove("foo") = true
trie.add("bar")
trie.has("foo") = false
trie.has("bar") = true
test: testWordOverwrite
trie.add("foo")
trie.add("foo")
trie.remove("foo") = true
trie.has("foo") = false
test: testRemoveNonExisting
trie.add("foo")
trie.remove("bar") = false
trie.remove("baz") = false
trie.has("foo") = true
test: testEmptyWord
trie.add("")
trie.has("") = true
trie.remove("") = true
trie.has("") = false
test: testAllWords
trie.add("foo")
trie.add("bar")
trie.add("bazzz")
trie.words() = [
foo,
bar,
bazzz
]
trie.words("f") = [
foo
]
trie.words("g") = []
trie.words("b") = [
bar,
bazzz
]
trie.words("ba") = [
bar,
bazzz
]
trie.words("bar") = [
bar
]
trie.words("barz") = []
trie.words("baz") = [
bazzz
]
test: testOneCharWords
trie.add("a")
trie.add("b")
trie.add("c")
trie.words() = [
a,
b,
c
]
test: testChainWords
trie.add("f")
trie.add("fo")
trie.add("foo")
trie.add("foo")
trie.words() = [
f,
fo,
foo
]
test: testClearTrie
trie.add("foo")
trie.add("bar")
trie.words() = [
foo,
bar
]
trie.clear()
trie.words() = []
test: testLongestPrefix
trie.add("fo")
trie.add("food")
trie.longestPrefix("fear", false) = "f"
trie.longestPrefix("fear", true) = ""
trie.longestPrefix("football", false) = "foo"
trie.longestPrefix("football", true) = "fo"
trie.longestPrefix("bar", false) = ""
trie.longestPrefix("bar", true) = ""
trie.longestPrefix("foo", false) = "foo"
trie.longestPrefix("foo", true) = "fo"
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