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

Side by Side Diff: chrome/test/data/extensions/platform_apps/web_view/shim/main.js

Issue 16268017: GTTF: convert some tests in chrome to use EmbeddedTestServer patch nr 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 var util = {}; 5 var util = {};
6 6
7 // Creates a <webview> tag in document.body and returns the reference to it. 7 // Creates a <webview> tag in document.body and returns the reference to it.
8 // It also sets a dummy src. The dummy src is significant because this makes 8 // It also sets a dummy src. The dummy src is significant because this makes
9 // sure that the <object> shim is created (asynchronously at this point) for the 9 // sure that the <object> shim is created (asynchronously at this point) for the
10 // <webview> tag. This makes the <webview> tag ready for add/removeEventListener 10 // <webview> tag. This makes the <webview> tag ready for add/removeEventListener
11 // calls. 11 // calls.
12 util.createWebViewTagInDOM = function(partitionName) { 12 util.createWebViewTagInDOM = function(partitionName) {
13 var webview = document.createElement('webview'); 13 var webview = document.createElement('webview');
14 webview.style.width = '300px'; 14 webview.style.width = '300px';
15 webview.style.height = '200px'; 15 webview.style.height = '200px';
16 var urlDummy = 'data:text/html,<body>Initial dummy guest</body>'; 16 var urlDummy = 'data:text/html,<body>Initial dummy guest</body>';
17 webview.setAttribute('src', urlDummy); 17 webview.setAttribute('src', urlDummy);
18 webview.setAttribute('partition', partitionName); 18 webview.setAttribute('partition', partitionName);
19 document.body.appendChild(webview); 19 document.body.appendChild(webview);
20 return webview; 20 return webview;
21 }; 21 };
22 22
23 chrome.test.getConfig(function(config) { 23 chrome.test.getConfig(function(config) {
24 var windowOpenGuestURL = 'http://localhost:' + config.testServer.port + 24 var windowOpenGuestURL = 'http://localhost:' + config.testServer.port +
25 '/files/extensions/platform_apps/web_view/shim/guest.html'; 25 '/extensions/platform_apps/web_view/shim/guest.html';
26 var noReferrerGuestURL = 'http://localhost:' + config.testServer.port + 26 var noReferrerGuestURL = 'http://localhost:' + config.testServer.port +
27 '/files/extensions/platform_apps/web_view/shim/guest_noreferrer.html'; 27 '/extensions/platform_apps/web_view/shim/guest_noreferrer.html';
28 chrome.test.runTests([ 28 chrome.test.runTests([
29 function webView() { 29 function webView() {
30 var webview = document.querySelector('webview'); 30 var webview = document.querySelector('webview');
31 // Since we can't currently inspect the page loaded inside the <webview>, 31 // Since we can't currently inspect the page loaded inside the <webview>,
32 // the only way we can check that the shim is working is by changing the 32 // the only way we can check that the shim is working is by changing the
33 // size and seeing if the shim updates the size of the DOM. 33 // size and seeing if the shim updates the size of the DOM.
34 chrome.test.assertEq(300, webview.offsetWidth); 34 chrome.test.assertEq(300, webview.offsetWidth);
35 chrome.test.assertEq(200, webview.offsetHeight); 35 chrome.test.assertEq(200, webview.offsetHeight);
36 36
37 webview.style.width = '310px'; 37 webview.style.width = '310px';
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 webview.onBeforeRequest.addListener(function(e) { 435 webview.onBeforeRequest.addListener(function(e) {
436 chrome.test.succeed(); 436 chrome.test.succeed();
437 }, { urls: ['<all_urls>']}, ['blocking']) ; 437 }, { urls: ['<all_urls>']}, ['blocking']) ;
438 webview.src = windowOpenGuestURL; 438 webview.src = windowOpenGuestURL;
439 }; 439 };
440 webview.addEventListener('loadstop', firstLoad); 440 webview.addEventListener('loadstop', firstLoad);
441 document.body.appendChild(webview); 441 document.body.appendChild(webview);
442 } 442 }
443 ]); 443 ]);
444 }); 444 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698