當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。