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

Unified Diff: chrome/test/data/extensions/api_test/clipboard/extension_no_permission/test.js

Issue 501513002: Change these tests to actually trigger the execCommand from the iframe context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add copyright Created 6 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 | « chrome/test/data/extensions/api_test/clipboard/extension_no_permission/iframe.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/clipboard/extension_no_permission/test.js
diff --git a/chrome/test/data/extensions/api_test/clipboard/extension_no_permission/test.js b/chrome/test/data/extensions/api_test/clipboard/extension_no_permission/test.js
index 544c6ed2853333a27d38f2b87b3bb383ded76013..2264f07ad9e82e8df45a24334b758bd5c2dd88ac 100644
--- a/chrome/test/data/extensions/api_test/clipboard/extension_no_permission/test.js
+++ b/chrome/test/data/extensions/api_test/clipboard/extension_no_permission/test.js
@@ -21,17 +21,24 @@ chrome.test.runTests([
function copyInIframe() {
var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
- if (ifr.contentDocument.execCommand('copy'))
- chrome.test.succeed();
- else
- chrome.test.fail('execCommand("copy") failed in iframe');
+ window.command = 'copy';
+ ifr.contentDocument.write('<script src="iframe.js"></script>');
},
function pasteInIframe() {
var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
- if (ifr.contentDocument.execCommand('paste'))
- chrome.test.fail('execCommand("paste") succeeded in iframe');
- else
- chrome.test.succeed();
+ window.command = 'paste';
+ ifr.contentDocument.write('<script src="iframe.js"></script>');
}
]);
+
+function testDone(result) {
+ // 'copy' should always succeed regardless of the clipboardWrite permission,
+ // for backwards compatibility. 'paste' should always fail because the
+ // extension doesn't have clipboardRead.
+ var expected = window.command === 'copy';
+ if (result === expected)
+ chrome.test.succeed();
+ else
+ chrome.test.fail();
+}
« no previous file with comments | « chrome/test/data/extensions/api_test/clipboard/extension_no_permission/iframe.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698