1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // TODO(kalman): Consolidate this test script with the other clipboard tests.
7 function appendTextarea() {
8 return document
.body
.appendChild(document
.createElement('textarea'));
12 var textIn
= appendTextarea();
15 textIn
.value
= 'foobar';
16 textIn
.selectionStart
= 0;
17 textIn
.selectionEnd
= 'foobar'.length
;
18 if (!document
.execCommand('copy'))
19 return 'Failed to copy';
21 var textOut
= appendTextarea();
24 if (!document
.execCommand('paste'))
25 return 'Failed to paste';
26 if (textOut
.value
!= 'foobar')
27 return 'Expected "foobar", got ' + textOut
.value
;
32 chrome
.runtime
.onMessage
.addListener(function(message
, sender
, sendResponse
) {