Index: chrome/test/data/extensions/platform_apps/iframes/main.js |
diff --git a/chrome/test/data/extensions/platform_apps/iframes/main.js b/chrome/test/data/extensions/platform_apps/iframes/main.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e5b245de4b6de09bfd9be6eb566f2e0ebe945fe2 |
--- /dev/null |
+++ b/chrome/test/data/extensions/platform_apps/iframes/main.js |
@@ -0,0 +1,43 @@ |
+// Copyright (c) 2012 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. |
+ |
+chrome.test.getConfig(function(config) { |
+ var LOCAL_URL = 'local-iframe.html'; |
+ var DATA_URL = 'data:text/plain,This frame should be displayed.'; |
+ var REMOTE_URL = 'http://localhost:' + config.testServer.port |
+ '/files/extensions/platform_apps/iframes/remote-iframe.html'; |
+ |
+ chrome.test.runTests([ |
+ function localIframe() { |
+ var iframe = document.createElement('iframe'); |
+ iframe.onload = chrome.test.callbackPass(function() { |
+ console.log('Local iframe loaded'); |
+ }); |
+ iframe.src = LOCAL_URL; |
+ document.body.appendChild(iframe); |
+ }, |
+ |
+ function dataUrlIframe() { |
+ var iframe = document.createElement('iframe'); |
+ iframe.onload = chrome.test.callbackPass(function() { |
+ console.log('data: URL iframe loaded'); |
+ }); |
+ iframe.src = DATA_URL; |
+ document.body.appendChild(iframe); |
+ }, |
+ |
+ function remoteIframe() { |
+ var iframe = document.createElement('iframe'); |
+ iframe.onload = function() { |
+ chrome.test.notifyFail('Remote iframe should not have loaded'); |
+ }; |
+ iframe.src = REMOTE_URL; |
+ document.body.appendChild(iframe); |
+ |
+ // Load failure should happen synchronously, but wait a bit before |
+ // declaring success. |
+ setTimeout(chrome.test.succeed, 500); |
+ } |
+ ]); |
+}); |