jaroslav@576: /** jaroslav@576: * Back 2 Browser Bytecode Translator jaroslav@576: * Copyright (C) 2012 Jaroslav Tulach jaroslav@576: * jaroslav@576: * This program is free software: you can redistribute it and/or modify jaroslav@576: * it under the terms of the GNU General Public License as published by jaroslav@576: * the Free Software Foundation, version 2 of the License. jaroslav@576: * jaroslav@576: * This program is distributed in the hope that it will be useful, jaroslav@576: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@576: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@576: * GNU General Public License for more details. jaroslav@576: * jaroslav@576: * You should have received a copy of the GNU General Public License jaroslav@576: * along with this program. Look for COPYING file in the top folder. jaroslav@576: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@576: */ jaroslav@576: package org.apidesign.bck2brwsr.compact.tck; jaroslav@576: jaroslav@576: import java.io.IOException; jaroslav@576: import java.util.ServiceLoader; jaroslav@576: import org.apidesign.bck2brwsr.vmtest.Compare; jaroslav@576: import org.apidesign.bck2brwsr.vmtest.VMTest; jaroslav@576: import org.openide.util.lookup.ServiceProvider; jaroslav@576: import org.testng.annotations.Factory; jaroslav@576: jaroslav@576: /** jaroslav@576: * jaroslav@576: * @author Jaroslav Tulach jaroslav@576: */ jaroslav@576: public class ServiceLoaderTest { jaroslav@576: @Compare//(scripting = false) jaroslav@576: public Object findsIOException() { jaroslav@576: // delayStart(); jaroslav@576: for (IOException e : ServiceLoader.load(IOException.class)) { jaroslav@576: return "Found service: " + e.getClass().getName(); jaroslav@576: } jaroslav@576: return null; jaroslav@576: } jaroslav@576: /* jaroslav@576: @org.apidesign.bck2brwsr.core.JavaScriptBody(args = { "a" }, body = "alert(a);") jaroslav@576: private static void alert(String a) { jaroslav@576: } jaroslav@576: private void delayStart() { jaroslav@576: for (int i = 0; i < 10; i++) { jaroslav@576: alert("State: " + i); jaroslav@576: for (int j = 0; j < 493208409; j++) ; jaroslav@576: } jaroslav@576: } jaroslav@576: */ jaroslav@576: jaroslav@576: @Factory jaroslav@576: public static Object[] create() { jaroslav@576: return VMTest.create(ServiceLoaderTest.class); jaroslav@576: } jaroslav@576: jaroslav@576: jaroslav@576: @ServiceProvider(service = IOException.class) jaroslav@576: public static class MyException extends IOException { jaroslav@576: } jaroslav@576: }