| Index: chrome/test/data/extensions/api_test/clipboard/extension_no_permission/content_script.js
|
| diff --git a/chrome/test/data/extensions/api_test/clipboard/extension_no_permission/content_script.js b/chrome/test/data/extensions/api_test/clipboard/extension_no_permission/content_script.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..868e2c24b4bccc69de51c82cf636f85f33d63d08
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/clipboard/extension_no_permission/content_script.js
|
| @@ -0,0 +1,32 @@
|
| +// Copyright 2014 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.
|
| +
|
| +// TODO(kalman): Consolidate this test script with the other clipboard tests.
|
| +
|
| +function appendTextarea() {
|
| + return document.body.appendChild(document.createElement('textarea'));
|
| +}
|
| +
|
| +function run() {
|
| + var textIn = appendTextarea();
|
| +
|
| + textIn.focus();
|
| + textIn.value = 'foobar';
|
| + textIn.selectionStart = 0;
|
| + textIn.selectionEnd = 'foobar'.length;
|
| + if (document.execCommand('copy'))
|
| + return 'Succeeded to copy';
|
| +
|
| + var textOut = appendTextarea();
|
| +
|
| + textOut.focus();
|
| + if (document.execCommand('paste'))
|
| + return 'Succeeded to paste';
|
| + if (textOut.value == 'foobar')
|
| + return 'Successfully copied/pasted despite execCommand failures';
|
| +
|
| + return '';
|
| +}
|
| +
|
| +chrome.runtime.sendMessage(run());
|
|
|