当前位置: 首页>>代码示例>>Java>>正文


Java Debug.waitForDebugger方法代码示例

本文整理汇总了Java中android.os.Debug.waitForDebugger方法的典型用法代码示例。如果您正苦于以下问题:Java Debug.waitForDebugger方法的具体用法?Java Debug.waitForDebugger怎么用?Java Debug.waitForDebugger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Debug的用法示例。


在下文中一共展示了Debug.waitForDebugger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.os.Debug; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle arguments) {

    boolean waitForDebugger = arguments != null && arguments.containsKey("debug") && Boolean.parseBoolean(arguments.getString("debug"));
    if (waitForDebugger) {
        Debug.waitForDebugger();
    }

    arguments.putString("runnerBuilder", FeatureFileExecutorFactory.class.getCanonicalName());

    super.onCreate(arguments);
}
 
开发者ID:andrewjc,项目名称:kheera-testrunner-android,代码行数:13,代码来源:KheeraRunner.java

示例2: onStart

import android.os.Debug; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();

    if (getBooleanArgument(ARGUMENT_DEBUG)) {
        Debug.waitForDebugger();
    }

    setupDexmakerClassloader();

    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    PrintStream writer = new PrintStream(byteArrayOutputStream);
    List<RunListener> listeners = new ArrayList<RunListener>();

    try {
        JUnitCore testRunner = new JUnitCore();
        addListeners(listeners, testRunner, writer);

        TestRequest testRequest = buildRequest(getArguments(), writer);
        Result result = testRunner.run(testRequest.getRequest());
        result.getFailures().addAll(testRequest.getFailures());
    } catch (Throwable t) {
        // catch all exceptions so a more verbose error message can be displayed
        writer.println(String.format(
                "Test run aborted due to unexpected exception: %s",
                t.getMessage()));
        t.printStackTrace(writer);

    } finally {
        Bundle results = new Bundle();
        reportRunEnded(listeners, writer, results);
        writer.close();
        results.putString(Instrumentation.REPORT_KEY_STREAMRESULT,
                String.format("\n%s",
                        byteArrayOutputStream.toString()));
        finish(Activity.RESULT_OK, results);
    }

}
 
开发者ID:mg6maciej,项目名称:android-groovy-dagger-espresso-demo,代码行数:40,代码来源:AndroidSpockRunner.java

示例3: start

import android.os.Debug; //导入方法依赖的package包/类
/**
 * Called after all test classes are in place, ready to test
 */
protected void start() {
	TestCaseCollector collector = getTestCaseCollector(this.getClass().getClassLoader());
	try {
		collector.addTestClasses(mTestClasses);
	} catch (ClassNotFoundException e) {
		// will be caught by uncaught handler
		throw new RuntimeException(e.getMessage(), e);
	}
	if (mDebug) {
		Debug.waitForDebugger();
	}
	mHandlerThread = new HandlerThread(HANDLER_THREAD_NAME);
	mHandlerThread.setDaemon(true);
	mHandlerThread.start();
	UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
	automationWrapper.connect();

	long startTime = SystemClock.uptimeMillis();
	TestResult testRunResult = new TestResult();
	ResultReporter resultPrinter;
	String outputFormat = mParams.getString("outputFormat");
	List<TestCase> testCases = collector.getTestCases();
	Bundle testRunOutput = new Bundle();
	if ("simple".equals(outputFormat)) {
		resultPrinter = new SimpleResultPrinter(System.out, true);
	} else {
		resultPrinter = new WatcherResultPrinter(testCases.size());
	}
	try {
		automationWrapper.setRunAsMonkey(mMonkey);
		mUiDevice = MyUiDevice.getInstance();
		UiAutomation uiAutomation = automationWrapper.getUiAutomation();
		mUiDevice.initialize(new ShellUiAutomatorBridge(uiAutomation));
		mUiDevice.setUiAutomation(uiAutomation);

		String traceType = mParams.getString("traceOutputMode");
		if (traceType != null) {
			Tracer.Mode mode = Tracer.Mode.valueOf(Tracer.Mode.class, traceType);
			if (mode == Tracer.Mode.FILE || mode == Tracer.Mode.ALL) {
				String filename = mParams.getString("traceLogFilename");
				if (filename == null) {
					throw new RuntimeException("Name of log file not specified. " + "Please specify it using traceLogFilename parameter");
				}
				Tracer.getInstance().setOutputFilename(filename);
			}
			Tracer.getInstance().setOutputMode(mode);
		}

		// add test listeners
		testRunResult.addListener(resultPrinter);
		// add all custom listeners
		for (TestListener listener : mTestListeners) {
			testRunResult.addListener(listener);
		}

		// run tests for realz!
		for (TestCase testCase : testCases) {
			prepareTestCase(testCase);
			testCase.run(testRunResult);
		}
	} catch (Throwable t) {
		// catch all exceptions so a more verbose error message can be outputted
		resultPrinter.printUnexpectedError(t);
	} finally {
		long runTime = SystemClock.uptimeMillis() - startTime;
		resultPrinter.print(testRunResult, runTime, testRunOutput);
		automationWrapper.disconnect();
		automationWrapper.setRunAsMonkey(false);
		mHandlerThread.quit();
	}
}
 
开发者ID:MagicHry,项目名称:EnhancedPUMA,代码行数:75,代码来源:MyUiAutomatorTestRunner.java

示例4: DebugMyself

import android.os.Debug; //导入方法依赖的package包/类
private static void DebugMyself() {
    setProcessName("DebuggableTool");
    Debug.waitForDebugger();
}
 
开发者ID:kevinross,项目名称:android_debuggable_tool,代码行数:5,代码来源:DebuggableTool.java

示例5: start

import android.os.Debug; //导入方法依赖的package包/类
public void start() {
    if (willWaitForDebugger) {
        Debug.waitForDebugger();
    }
    run(parsedArgs);
}
 
开发者ID:kevinross,项目名称:android_debuggable_tool,代码行数:7,代码来源:AbstractTool.java


注:本文中的android.os.Debug.waitForDebugger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。