Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/trie.html

Issue 2513423003: DevTools: Convert inspector-unit tests to use reusable test harness (Closed)
Patch Set: Moved type definition out of externs Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/inspector-unit/trie.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/trie.html b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/trie.html
deleted file mode 100644
index c6f5582c54c8bf0a01ca4ddcd76903affb0c9323..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/trie.html
+++ /dev/null
@@ -1,183 +0,0 @@
-<html>
-<head>
-<base href="/inspector-debug/"></base>
-<script src="/inspector-debug/Runtime.js"></script>
-<script src="/inspector-unit/inspector-unit-test.js"></script>
-<script>
-function test() {
- var trie;
-
- UnitTest.runTests([
- function testAddWord()
- {
- var trie = new Common.Trie();
- addWord(trie, "hello");
- hasWord(trie, "he");
- hasWord(trie, "hello");
- hasWord(trie, "helloo");
- },
-
- function testAddWords()
- {
- var trie = new Common.Trie();
- addWord(trie, "foo");
- addWord(trie, "bar");
- addWord(trie, "bazz");
- hasWord(trie, "f");
- hasWord(trie, "ba");
- hasWord(trie, "baz");
- hasWord(trie, "bar");
- hasWord(trie, "bazz");
- },
-
- function testRemoveWord()
- {
- var trie = new Common.Trie();
- addWord(trie, "foo");
- removeWord(trie, "f");
- removeWord(trie, "fo");
- removeWord(trie, "fooo");
- hasWord(trie, "foo");
- removeWord(trie, "foo");
- hasWord(trie, "foo");
- },
-
- function testAddAfterRemove()
- {
- var trie = new Common.Trie();
- addWord(trie, "foo");
- removeWord(trie, "foo");
- addWord(trie, "bar");
- hasWord(trie, "foo");
- hasWord(trie, "bar");
- },
-
- function testWordOverwrite()
- {
- var trie = new Common.Trie();
- addWord(trie, "foo");
- addWord(trie, "foo");
- removeWord(trie, "foo");
- hasWord(trie, "foo");
- },
-
- function testRemoveNonExisting()
- {
- var trie = new Common.Trie();
- addWord(trie, "foo");
- removeWord(trie, "bar");
- removeWord(trie, "baz");
- hasWord(trie, "foo");
- },
-
- function testEmptyWord()
- {
- var trie = new Common.Trie();
- addWord(trie, "");
- hasWord(trie, "");
- removeWord(trie, "");
- hasWord(trie, "");
- },
-
- function testAllWords()
- {
- var trie = new Common.Trie();
- addWord(trie, "foo");
- addWord(trie, "bar");
- addWord(trie, "bazzz");
- words(trie);
- words(trie, "f");
- words(trie, "g");
- words(trie, "b");
- words(trie, "ba");
- words(trie, "bar");
- words(trie, "barz");
- words(trie, "baz");
- },
-
- function testOneCharWords()
- {
- var trie = new Common.Trie();
- addWord(trie, "a");
- addWord(trie, "b");
- addWord(trie, "c");
- words(trie);
- },
-
- function testChainWords()
- {
- var trie = new Common.Trie();
- addWord(trie, "f");
- addWord(trie, "fo");
- addWord(trie, "foo");
- addWord(trie, "foo");
- words(trie);
- },
-
- function testClearTrie()
- {
- var trie = new Common.Trie();
- addWord(trie, "foo");
- addWord(trie, "bar");
- words(trie);
- clear(trie);
- words(trie);
- },
-
- function testLongestPrefix()
- {
- var trie = new Common.Trie();
- addWord(trie, "fo");
- addWord(trie, "food");
- longestPrefix(trie, "fear", false);
- longestPrefix(trie, "fear", true);
- longestPrefix(trie, "football", false);
- longestPrefix(trie, "football", true);
- longestPrefix(trie, "bar", false);
- longestPrefix(trie, "bar", true);
- longestPrefix(trie, "foo", false);
- longestPrefix(trie, "foo", true);
- },
- ]);
-
- function hasWord(trie, word)
- {
- UnitTest.addResult(`trie.has("${word}") = ${trie.has(word)}`);
- }
-
- function addWord(trie, word)
- {
- UnitTest.addResult(`trie.add("${word}")`);
- trie.add(word);
- }
-
- function removeWord(trie, word)
- {
- UnitTest.addResult(`trie.remove("${word}") = ${trie.remove(word)}`);
- }
-
- function words(trie, prefix)
- {
- var title = prefix ? `trie.words("${prefix}")` : `trie.words()`;
- var words = trie.words(prefix);
- var text = words.length ? `[\n ${words.join(",\n ")}\n]` : "[]";
- UnitTest.addResult(title + " = " + text);
- }
-
- function clear(trie)
- {
- trie.clear();
- UnitTest.addResult("trie.clear()");
- }
-
- function longestPrefix(trie, word, fullWordOnly)
- {
- UnitTest.addResult(`trie.longestPrefix("${word}", ${fullWordOnly}) = "${trie.longestPrefix(word, fullWordOnly)}"`);
- }
-}
-</script>
-</head>
-<body>
-Verify "trie" functionality.
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698