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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt-hint.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/text-prompt-hint.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt-hint.html b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt-hint.html
deleted file mode 100644
index ac8a2c17c8744b6bcfc07f9c3091939f5d0c62f2..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt-hint.html
+++ /dev/null
@@ -1,124 +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 type="text/javascript">
-
-function test()
-{
- var suggestions = [{title:"testTextPrompt"}];
- var waitingForAutocomplete = null;
- var completionsDone = function () {
- console.error("completionsDone called too early!");
- UnitTest.completeTest();
- }
- var prompt = new UI.TextPrompt();
- prompt.initialize(completions);
- var element = createElement("div");
- UI.inspectorView.element.appendChild(element);
- var proxy = prompt.attachAndStartEditing(element);
- prompt.setText("testT");
- waitForAutocomplete().then(step1);
- prompt.complete();
- dumpTextPrompt();
-
- function step1() {
- dumpTextPrompt();
-
- typeCharacter("e");
- dumpTextPrompt();
-
- waitForAutocomplete().then(step2);
- }
- function step2()
- {
- dumpTextPrompt();
-
- typeCharacter("z");
- waitForAutocomplete().then(step3);
- }
-
- function step3()
- {
- dumpTextPrompt();
- typeCharacter(null);
- waitForAutocomplete().then(step4);
- }
-
- function step4()
- {
- dumpTextPrompt();
- typeCharacter(null);
- waitForAutocomplete().then(step5);
- }
- function step5()
- {
- dumpTextPrompt();
- prompt.setText("something_before test");
- prompt.complete();
- completionsDone().then(()=>{
- dumpTextPrompt();
- typeCharacter("T");
- dumpTextPrompt();
- UnitTest.completeTest();
- });
- }
-
- function completions(expression, query)
- {
- var callback;
- var promise = new Promise(x => callback = x);
- UnitTest.addResult("Requesting completions");
- completionsDone = () => {
- callback(suggestions.filter(s => s.title.startsWith(query.toString())))
- return Promise.resolve();
- };
- var temp = waitingForAutocomplete;
- waitingForAutocomplete = null;
- if (temp)
- temp();
- return promise;
- }
-
- function waitForAutocomplete()
- {
- return new Promise(x => waitingForAutocomplete = x).then(() => completionsDone());
- }
-
- function dumpTextPrompt()
- {
- UnitTest.addResult("Text:" + prompt.text());
- UnitTest.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSuggestion());
- UnitTest.addResult("");
- }
-
- function typeCharacter(character)
- {
- var keyboardEvent = new KeyboardEvent("keydown", {
- key: character || "Backspace",
- charCode: character ? character.charCodeAt(0) : ""
- });
- element.dispatchEvent(keyboardEvent);
-
- var selection = element.getComponentSelection();
- var range = selection.getRangeAt(0);
- var textNode = prompt._ghostTextElement.parentNode ? prompt._ghostTextElement.previousSibling : element.childTextNodes()[element.childTextNodes().length - 1];
- if (!character)
- textNode.textContent = textNode.textContent.substring(0,textNode.textContent.length-1);
- else
- textNode.textContent += character;
- range.setStart(range.startContainer, range.startContainer.textContent.length);
- selection.removeAllRanges();
- selection.addRange(range);
- element.dispatchEvent(new Event("input", {bubbles: true, cancelable: false}));
- }
-}
-
-
-</script>
-</head>
-<body>
-<p>Tests that the hint displays properly on a UI.TextPrompt with autocomplete.</p>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698