OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 $ = function(id) { return document.getElementById(id); }; | 5 var $ = function(id) { return document.getElementById(id); }; |
6 var LOG = function(msg) { window.console.log(msg); }; | 6 var LOG = function(msg) { window.console.log(msg); }; |
7 | 7 |
8 var embedder = {}; | 8 var embedder = {}; |
9 embedder.baseGuestURL = ''; | 9 embedder.baseGuestURL = ''; |
10 embedder.guestURL = ''; | 10 embedder.guestURL = ''; |
(...skipping 19 matching lines...) Expand all Loading... |
30 chrome.test.fail(opt_msg || ''); | 30 chrome.test.fail(opt_msg || ''); |
31 }; | 31 }; |
32 | 32 |
33 utils.test.assertEq = function(expected, actual) { | 33 utils.test.assertEq = function(expected, actual) { |
34 chrome.test.assertEq.apply(chrome.test.assertEq, arguments); | 34 chrome.test.assertEq.apply(chrome.test.assertEq, arguments); |
35 }; | 35 }; |
36 | 36 |
37 utils.setUp = function(chromeConfig, config) { | 37 utils.setUp = function(chromeConfig, config) { |
38 embedder.baseGuestURL = 'http://localhost:' + chromeConfig.testServer.port; | 38 embedder.baseGuestURL = 'http://localhost:' + chromeConfig.testServer.port; |
39 embedder.guestURL = embedder.baseGuestURL + | 39 embedder.guestURL = embedder.baseGuestURL + |
40 '/files/extensions/platform_apps/web_view/common/' + | 40 '/extensions/platform_apps/web_view/common/' + |
41 config.TEST_DIR + '/guest.html'; | 41 config.TEST_DIR + '/guest.html'; |
42 chrome.test.log('Guest url is: ' + embedder.guestURL); | 42 chrome.test.log('Guest url is: ' + embedder.guestURL); |
43 }; | 43 }; |
44 | 44 |
45 utils.injectCss = function(cssScriptPath) { | 45 utils.injectCss = function(cssScriptPath) { |
46 LOG('BEG utils.injectCss: ' + cssScriptPath); | 46 LOG('BEG utils.injectCss: ' + cssScriptPath); |
47 var style = document.createElement('style'); | 47 var style = document.createElement('style'); |
48 style.type = 'text/css'; | 48 style.type = 'text/css'; |
49 style.src = cssScriptPath; | 49 style.src = cssScriptPath; |
50 document.getElementsByTagName('head')[0].appendChild(style); | 50 document.getElementsByTagName('head')[0].appendChild(style); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 chrome.test.log('Unexpected response from guest'); | 84 chrome.test.log('Unexpected response from guest'); |
85 utils.test.fail(); | 85 utils.test.fail(); |
86 } | 86 } |
87 } | 87 } |
88 }; | 88 }; |
89 | 89 |
90 window.addEventListener('message', onPostMessageReceived); | 90 window.addEventListener('message', onPostMessageReceived); |
91 embedder.webview.setAttribute('src', embedder.guestURL); | 91 embedder.webview.setAttribute('src', embedder.guestURL); |
92 }; | 92 }; |
93 | 93 |
OLD | NEW |