jaroslav@518: /** jaroslav@518: * Back 2 Browser Bytecode Translator jaroslav@518: * Copyright (C) 2012 Jaroslav Tulach jaroslav@518: * jaroslav@518: * This program is free software: you can redistribute it and/or modify jaroslav@518: * it under the terms of the GNU General Public License as published by jaroslav@518: * the Free Software Foundation, version 2 of the License. jaroslav@518: * jaroslav@518: * This program is distributed in the hope that it will be useful, jaroslav@518: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@518: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@518: * GNU General Public License for more details. jaroslav@518: * jaroslav@518: * You should have received a copy of the GNU General Public License jaroslav@518: * along with this program. Look for COPYING file in the top folder. jaroslav@518: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@518: */ jaroslav@518: package org.apidesign.bck2brwsr.tck; jaroslav@518: jaroslav@518: import org.apidesign.bck2brwsr.core.JavaScriptBody; jaroslav@518: import org.apidesign.bck2brwsr.vmtest.BrwsrTest; jaroslav@526: import org.apidesign.bck2brwsr.vmtest.HtmlFragment; jaroslav@518: import org.apidesign.bck2brwsr.vmtest.VMTest; jaroslav@518: import org.testng.annotations.Factory; jaroslav@518: jaroslav@518: /** jaroslav@518: * jaroslav@518: * @author Jaroslav Tulach jaroslav@518: */ jaroslav@518: public class BrwsrCheckTest { jaroslav@526: jaroslav@518: @BrwsrTest public void assertWindowObjectIsDefined() { jaroslav@518: assert window() != null : "No window object found!"; jaroslav@518: } jaroslav@526: jaroslav@526: jaroslav@526: jaroslav@526: jaroslav@526: @HtmlFragment("

\n" jaroslav@526: + "Hello!\n" jaroslav@526: + "

\n") jaroslav@526: @BrwsrTest public void accessProvidedFragment() { jaroslav@526: assert getElementById("hello") != null : "Element with 'hello' ID found"; jaroslav@526: } jaroslav@518: jaroslav@518: @Factory jaroslav@518: public static Object[] create() { jaroslav@518: return VMTest.create(BrwsrCheckTest.class); jaroslav@518: } jaroslav@526: jaroslav@518: jaroslav@518: @JavaScriptBody(args = {}, body = "return window;") jaroslav@518: private static native Object window(); jaroslav@526: jaroslav@526: @JavaScriptBody(args = { "id" }, body = "return window.document.getElementById(id);") jaroslav@526: private static native Object getElementById(String id); jaroslav@518: }