OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 chrome.test.getConfig(function(config) { | 5 chrome.test.getConfig(function(config) { |
6 var LOCAL_URL = 'local-iframe.html'; | 6 var LOCAL_URL = 'local-iframe.html'; |
7 var DATA_URL = 'data:text/plain,This frame should be displayed.'; | 7 var DATA_URL = 'data:text/plain,This frame should be displayed.'; |
8 var REMOTE_URL = 'http://localhost:' + config.testServer.port | 8 var REMOTE_URL = 'http://localhost:' + config.testServer.port |
9 '/extensions/platform_apps/iframes/remote-iframe.html'; | 9 '/extensions/platform_apps/iframes/remote-iframe.html'; |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 {type: 'text/html'}); | 53 {type: 'text/html'}); |
54 fileWriter.write(blob); | 54 fileWriter.write(blob); |
55 }); | 55 }); |
56 }); | 56 }); |
57 }); | 57 }); |
58 }, | 58 }, |
59 | 59 |
60 function blobUrlIframe() { | 60 function blobUrlIframe() { |
61 var blob = new Blob(['This frame should be displayed'], | 61 var blob = new Blob(['This frame should be displayed'], |
62 {type: 'text/html'}); | 62 {type: 'text/html'}); |
63 var blobUrl = window.webkitURL.createObjectURL(blob); | 63 var blobUrl = window.URL.createObjectURL(blob); |
64 var iframe = document.createElement('iframe'); | 64 var iframe = document.createElement('iframe'); |
65 iframe.onload = chrome.test.callbackPass(function() { | 65 iframe.onload = chrome.test.callbackPass(function() { |
66 console.log('blob: URL iframe loaded'); | 66 console.log('blob: URL iframe loaded'); |
67 }); | 67 }); |
68 iframe.src = blobUrl; | 68 iframe.src = blobUrl; |
69 document.body.appendChild(iframe); | 69 document.body.appendChild(iframe); |
70 }, | 70 }, |
71 | 71 |
72 function remoteIframe() { | 72 function remoteIframe() { |
73 var iframe = document.createElement('iframe'); | 73 var iframe = document.createElement('iframe'); |
74 iframe.onload = function() { | 74 iframe.onload = function() { |
75 chrome.test.notifyFail('Remote iframe should not have loaded'); | 75 chrome.test.notifyFail('Remote iframe should not have loaded'); |
76 }; | 76 }; |
77 iframe.src = REMOTE_URL; | 77 iframe.src = REMOTE_URL; |
78 document.body.appendChild(iframe); | 78 document.body.appendChild(iframe); |
79 | 79 |
80 // Load failure should happen synchronously, but wait a bit before | 80 // Load failure should happen synchronously, but wait a bit before |
81 // declaring success. | 81 // declaring success. |
82 setTimeout(chrome.test.succeed, 500); | 82 setTimeout(chrome.test.succeed, 500); |
83 } | 83 } |
84 ]); | 84 ]); |
85 }); | 85 }); |
OLD | NEW |