1.1 --- a/dew/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java Wed Jan 23 13:56:54 2013 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,63 +0,0 @@
1.4 -/**
1.5 - * Back 2 Browser Bytecode Translator
1.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.7 - *
1.8 - * This program is free software: you can redistribute it and/or modify
1.9 - * it under the terms of the GNU General Public License as published by
1.10 - * the Free Software Foundation, version 2 of the License.
1.11 - *
1.12 - * This program is distributed in the hope that it will be useful,
1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 - * GNU General Public License for more details.
1.16 - *
1.17 - * You should have received a copy of the GNU General Public License
1.18 - * along with this program. Look for COPYING file in the top folder.
1.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
1.20 - */
1.21 -package org.apidesign.bck2brwsr.launcher;
1.22 -
1.23 -import java.io.Closeable;
1.24 -import java.io.IOException;
1.25 -import java.net.URLClassLoader;
1.26 -import org.apidesign.vm4brwsr.Bck2Brwsr;
1.27 -
1.28 -/** An abstraction for executing tests in a Bck2Brwsr virtual machine.
1.29 - * Either in JavaScript engine, or in external browser.
1.30 - *
1.31 - * @author Jaroslav Tulach <jtulach@netbeans.org>
1.32 - */
1.33 -public abstract class Launcher {
1.34 -
1.35 - Launcher() {
1.36 - }
1.37 -
1.38 - abstract MethodInvocation addMethod(Class<?> clazz, String method, String html) throws IOException;
1.39 -
1.40 - public abstract void initialize() throws IOException;
1.41 - public abstract void shutdown() throws IOException;
1.42 - public MethodInvocation invokeMethod(Class<?> clazz, String method, String html) throws IOException {
1.43 - return addMethod(clazz, method, html);
1.44 - }
1.45 -
1.46 -
1.47 -
1.48 - public static Launcher createJavaScript() {
1.49 - final JSLauncher l = new JSLauncher();
1.50 - l.addClassLoader(Bck2Brwsr.class.getClassLoader());
1.51 - return l;
1.52 - }
1.53 -
1.54 - public static Launcher createBrowser(String cmd) {
1.55 - final Bck2BrwsrLauncher l = new Bck2BrwsrLauncher(cmd);
1.56 - l.addClassLoader(Bck2Brwsr.class.getClassLoader());
1.57 - l.setTimeout(180000);
1.58 - return l;
1.59 - }
1.60 - public static Closeable showURL(URLClassLoader classes, String startpage) throws IOException {
1.61 - Bck2BrwsrLauncher l = new Bck2BrwsrLauncher(null);
1.62 - l.addClassLoader(classes);
1.63 - l.showURL(startpage);
1.64 - return l;
1.65 - }
1.66 -}