Sha256: 154fadd39f4cd139e709b6197ffbe73e831267a86791ef93febb1d2bb1b86b05

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

package sh.calaba.instrumentationbackend;

import java.lang.reflect.Method;

import android.app.Activity;
import sh.calaba.instrumentationbackend.actions.HttpServer;
import android.content.Context;
import android.os.Bundle;
import android.test.InstrumentationTestRunner;

public class CalabashInstrumentationTestRunner extends InstrumentationTestRunner {
	@Override
    public void onCreate(Bundle arguments) {
		try {
			Context context = getTargetContext();
			Class<?> c = Class.forName("mono.MonoPackageManager");
			Method  method = c.getDeclaredMethod ("LoadApplication", Context.class, String.class, String[].class);
			method.invoke (null, context, null, new String[]{context.getApplicationInfo ().sourceDir});
			System.out.println("Calabash loaded Mono");
            InstrumentationBackend.mainActivity = Class.forName(arguments.getString("main_activity")).asSubclass(Activity.class);
		} catch (Exception e) {
			System.out.println("Calabash did not load Mono. This is only a problem if you are trying to test a Mono application");
		}

        // Start the HttpServer as soon as possible in a not-ready state
        HttpServer.instantiate(Integer.parseInt(arguments.getString("test_server_port")));

        InstrumentationBackend.testPackage = arguments.getString("target_package");
        InstrumentationBackend.extras = arguments;

        try {
            InstrumentationBackend.mainActivityName = arguments.getString("main_activity");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        super.onCreate(arguments);

	}	
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
calabash-android-0.5.0.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/CalabashInstrumentationTestRunner.java
calabash-android-0.5.0.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/CalabashInstrumentationTestRunner.java