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

Unified Diff: LayoutTests/editing/pasteboard/data-transfer-items-drag-drop-string.html

Issue 22604003: Make DataTransferItem.getAsString() argument mandatory and nullable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months 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
« no previous file with comments | « no previous file | LayoutTests/editing/pasteboard/data-transfer-items-drag-drop-string-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/editing/pasteboard/data-transfer-items-drag-drop-string.html
diff --git a/LayoutTests/editing/pasteboard/data-transfer-items-drag-drop-string.html b/LayoutTests/editing/pasteboard/data-transfer-items-drag-drop-string.html
index 482f0440c450ce71dfe542bd0857aa9d256d9a87..712f7406c4bf2612975fca4ad0e49163f8aa6d73 100644
--- a/LayoutTests/editing/pasteboard/data-transfer-items-drag-drop-string.html
+++ b/LayoutTests/editing/pasteboard/data-transfer-items-drag-drop-string.html
@@ -1,31 +1,22 @@
<!DOCTYPE html>
<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
<body>
-<div>This tests the basic functionality and properties of DataTransferItems for string data with drag and drop. This test requires DRT.</div>
-
<input id="source1" value="Lorem ipsum">Lorem ipsum</input>
<input id="source2" value="http://example.com"></input>
<div id="destination" style="min-height:100px; border: solid 1px black">Drop text here if you test this manually</div>
-<div id="console"></div>
-
<script>
+description('This tests the basic functionality and properties of DataTransferItems for string data with drag and drop. This test requires DRT.')
+
+window.jsTestIsAsync = true;
+
var testSources = [ 'source1', 'source2' ];
var testIndex = 0;
var expectedDroppedText = '';
-function log(text)
-{
- var console = document.getElementById('console');
- console.appendChild(document.createTextNode(text));
- console.appendChild(document.createElement('br'));
-}
-
-function test(expect, actual)
-{
- log((expect == actual ? 'PASS' : 'FAIL') + ': "' + expect + '" == "' + actual + '"');
-}
-
function startTest()
{
var destination = document.getElementById('destination');
@@ -34,8 +25,6 @@ function startTest()
if (!window.testRunner)
return;
- testRunner.waitUntilDone();
- testRunner.dumpAsText();
runNextTest();
}
@@ -43,14 +32,14 @@ function startTest()
function runNextTest()
{
if (testIndex == testSources.length) {
- testRunner.notifyDone();
+ finishJSTest();
return;
}
var sourceId = testSources[testIndex++];
var source = document.getElementById(sourceId);
expectedDroppedText = source.value;
- log('Dragging text in ' + sourceId + ': ' + source.value);
+ debug('Dragging text in ' + sourceId + ': ' + source.value);
// Drag a text in the source element.
source.setSelectionRange(0, source.value.length);
@@ -77,18 +66,22 @@ function handleDrop(e)
e.stopPropagation();
e.preventDefault();
- log('Verifying contents of DataTransferItems...');
+ debug('Verifying contents of DataTransferItems...');
var items = e.dataTransfer.items;
var remaining = items.length;
for (var i = 0; i < items.length; ++i) {
- log('items.length: ' + items.length);
- log('items[' + i + '].kind: ' + items[i].kind);
- log('items[' + i + '].type: ' + items[i].type);
+ debug('items.length: ' + items.length);
+ debug('items[' + i + '].kind: ' + items[i].kind);
+ debug('items[' + i + '].type: ' + items[i].type);
+ window.currentItem = items[i];
arv (Not doing code reviews) 2013/08/07 17:55:24 or var currentItem; function handleDrop() { ..
do-not-use 2013/08/07 18:07:59 Yes, I have seen both ways used in the tests and I
+ shouldThrow('currentItem.getAsString()', '"TypeError: Not enough arguments"');
+ shouldNotThrow('currentItem.getAsString(null)');
items[i].getAsString(function(data) {
- test(expectedDroppedText, data);
+ window.stringData = data;
+ shouldBeEqualToString('stringData', expectedDroppedText);
if (--remaining == 0 && window.testRunner)
runNextTest();
});
@@ -98,5 +91,6 @@ function handleDrop(e)
startTest();
</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
« no previous file with comments | « no previous file | LayoutTests/editing/pasteboard/data-transfer-items-drag-drop-string-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698