rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/vmtest/impl/CallMeTwiceTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 19 Nov 2014 19:32:00 +0100
changeset 1723 3a1f262311cf
parent 1034 rt/emul/compact/src/test/java/org/apidesign/bck2brwsr/vmtest/impl/CallMeTwiceTest.java@28dc692f3b11
child 1787 ea12a3bb4b33
permissions -rw-r--r--
Separating compact profile tests into own project, so launcher.http can depend on compact profile JAR
jaroslav@939
     1
/**
jaroslav@939
     2
 * Back 2 Browser Bytecode Translator
jaroslav@939
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@939
     4
 *
jaroslav@939
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@939
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@939
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@939
     8
 *
jaroslav@939
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@939
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@939
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@939
    12
 * GNU General Public License for more details.
jaroslav@939
    13
 *
jaroslav@939
    14
 * You should have received a copy of the GNU General Public License
jaroslav@939
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@939
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@939
    17
 */
jaroslav@939
    18
package org.apidesign.bck2brwsr.vmtest.impl;
jaroslav@939
    19
jaroslav@939
    20
import org.apidesign.bck2brwsr.vmtest.BrwsrTest;
jaroslav@939
    21
import org.apidesign.bck2brwsr.vmtest.VMTest;
jaroslav@939
    22
import org.testng.annotations.Factory;
jaroslav@939
    23
jaroslav@939
    24
/**
jaroslav@939
    25
 *
jaroslav@939
    26
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@939
    27
 */
jaroslav@939
    28
public class CallMeTwiceTest {
jaroslav@939
    29
    int cnt;
jaroslav@939
    30
    
jaroslav@939
    31
    @BrwsrTest public void callMeTwice() throws InterruptedException {
jaroslav@939
    32
        if (cnt++ == 0) {
jaroslav@939
    33
            throw new InterruptedException();
jaroslav@939
    34
        }
jaroslav@939
    35
        int prevCnt = cnt;
jaroslav@939
    36
        cnt = 0;
jaroslav@939
    37
        assert prevCnt == 2 : "We need to receive two calls " + prevCnt;
jaroslav@939
    38
    }
jaroslav@939
    39
    
jaroslav@939
    40
    @Factory public static Object[] create() {
jaroslav@939
    41
        return VMTest.create(CallMeTwiceTest.class);
jaroslav@939
    42
    }
jaroslav@939
    43
}