| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| (async function() { |
| TestRunner.addResult(`Tests asynchronous call stacks for DataTransferItem.getAsString.\n`); |
| await TestRunner.loadModule('sources_test_runner'); |
| await TestRunner.showPanel('sources'); |
| await TestRunner.loadHTML(` |
| <input type="text" id="input"> |
| `); |
| await TestRunner.evaluateInPagePromise(` |
| function testFunction() |
| { |
| setTimeout(timeout, 0); |
| } |
| |
| function timeout() |
| { |
| window.addEventListener("paste", onPaste, false); |
| |
| var input = document.getElementById("input"); |
| input.value = "value"; |
| input.focus(); |
| input.select(); |
| document.execCommand("Copy"); |
| |
| input.value = ""; |
| input.focus(); |
| document.execCommand("Paste"); |
| } |
| |
| function onPaste(e) |
| { |
| debugger; |
| window.removeEventListener("paste", onPaste, false); |
| var items = (e.originalEvent || e).clipboardData.items; |
| var item = items[0]; |
| item.getAsString(onGetAsString); |
| } |
| |
| function onGetAsString() |
| { |
| debugger; |
| } |
| `); |
| |
| var totalDebuggerStatements = 2; |
| SourcesTestRunner.runAsyncCallStacksTest(totalDebuggerStatements); |
| })(); |