Split test HTML file into separate ones

This commit is contained in:
Ryohei Ikegami 2017-04-30 18:53:31 +09:00
parent 1d73e84a29
commit edeac2f59e
5 changed files with 35 additions and 33 deletions

View file

@ -0,0 +1,11 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require("electron");
const popup = window.open();
popup.document.write('<h1>Hello</h1>');
const content = popup.document.querySelector('h1').innerText;
ipcRenderer.send('answer', content);
</script>
</body>
</html>

View file

@ -0,0 +1,12 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require("electron");
const popup = window.open('native-window-open-child.html');
popup.onload = () => {
const content = popup.document.querySelector('h1').innerText;
ipcRenderer.send('answer', content);
};
</script>
</body>
</html>

View file

@ -0,0 +1,9 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require("electron");
const runas = require('runas');
ipcRenderer.send('answer', typeof runas);
</script>
</body>
</html>

View file

@ -1,30 +0,0 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require("electron");
const tests = {
'blank': () => {
const popup = window.open();
popup.document.write('<h1>Hello</h1>');
const content = popup.document.querySelector('h1').innerText;
ipcRenderer.send('answer', content);
},
'file': () => {
const popup = window.open('native-window-open-child.html');
popup.onload = () => {
const content = popup.document.querySelector('h1').innerText;
ipcRenderer.send('answer', content);
};
},
'native-addon': () => {
const runas = require('runas');
ipcRenderer.send('answer', typeof runas);
}
}
const test = location.hash.slice(1);
if (tests.hasOwnProperty(test)) {
tests[test]();
}
</script>
</body>
</html>