Code drop from //branches/cupcake/...@124589

This commit is contained in:
The Android Open Source Project
2008-12-17 18:04:04 -08:00
parent 5c11852110
commit e943f2fd8e
659 changed files with 47382 additions and 9976 deletions

View File

@@ -17,6 +17,8 @@
package com.example.android.apis;
import android.test.ApplicationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* This is a simple framework for a test of an Application. See
@@ -45,12 +47,14 @@ public class ApiDemosApplicationTests extends ApplicationTestCase<ApiDemosApplic
* explain any and all failures in other tests. This is not guaranteed
* to run before other tests, as junit uses reflection to find the tests.
*/
@SmallTest
public void testPreconditions() {
}
/**
* Test basic startup/shutdown of Application
*/
@MediumTest
public void testSimpleCreate() {
createApplication();
}

View File

@@ -22,6 +22,7 @@ import com.example.android.apis.view.Focus2ActivityTest;
import android.content.Context;
import android.content.Intent;
import android.test.ActivityUnitTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.Button;
/**
@@ -68,6 +69,7 @@ public class ForwardingTest extends ActivityUnitTestCase<Forwarding> {
* explain any and all failures in other tests. This is not guaranteed
* to run before other tests, as junit uses reflection to find the tests.
*/
@MediumTest
public void testPreconditions() {
startActivity(mStartIntent, null, null);
mButton = (Button) getActivity().findViewById(R.id.go);
@@ -80,6 +82,7 @@ public class ForwardingTest extends ActivityUnitTestCase<Forwarding> {
* This test demonstrates examining the way that activity calls startActivity() to launch
* other activities.
*/
@MediumTest
public void testSubLaunch() {
Forwarding activity = startActivity(mStartIntent, null, null);
mButton = (Button) activity.findViewById(R.id.go);
@@ -95,6 +98,7 @@ public class ForwardingTest extends ActivityUnitTestCase<Forwarding> {
/**
* This test demonstrates ways to exercise the Activity's life cycle.
*/
@MediumTest
public void testLifeCycleCreate() {
Forwarding activity = startActivity(mStartIntent, null, null);

View File

@@ -24,6 +24,8 @@ import android.os.Handler;
import android.os.IBinder;
import android.test.MoreAsserts;
import android.test.ServiceTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* This is a simple framework for a test of a Service. See {@link android.test.ServiceTestCase
@@ -51,12 +53,14 @@ public class LocalServiceTest extends ServiceTestCase<LocalService> {
* explain any and all failures in other tests. This is not guaranteed
* to run before other tests, as junit uses reflection to find the tests.
*/
@SmallTest
public void testPreconditions() {
}
/**
* Test basic startup/shutdown of Service
*/
@SmallTest
public void testStartable() {
Intent startIntent = new Intent();
startIntent.setClass(getContext(), LocalService.class);
@@ -66,6 +70,7 @@ public class LocalServiceTest extends ServiceTestCase<LocalService> {
/**
* Test binding to service
*/
@MediumTest
public void testBindable() {
Intent startIntent = new Intent();
startIntent.setClass(getContext(), LocalService.class);

View File

@@ -17,6 +17,7 @@
package com.example.android.apis.os;
import junit.framework.TestCase;
import android.test.suitebuilder.annotation.SmallTest;
/**
* An example of a true unit test that tests the utility class {@link MorseCodeConverter}.
@@ -28,6 +29,7 @@ import junit.framework.TestCase;
*/
public class MorseCodeConverterTest extends TestCase {
@SmallTest
public void testCharacterS() throws Exception {
long[] expectedBeeps = {

View File

@@ -19,6 +19,7 @@ package com.example.android.apis.view;
import com.example.android.apis.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
import android.widget.Button;
@@ -67,6 +68,7 @@ public class Focus2ActivityTest extends ActivityInstrumentationTestCase<Focus2>
* explain any and all failures in other tests. This is not guaranteed
* to run before other tests, as junit uses reflection to find the tests.
*/
@MediumTest
public void testPreconditions() {
assertTrue("center button should be right of left button",
mLeftButton.getRight() < mCenterButton.getLeft());
@@ -75,11 +77,13 @@ public class Focus2ActivityTest extends ActivityInstrumentationTestCase<Focus2>
assertTrue("left button should be focused", mLeftButton.isFocused());
}
@MediumTest
public void testGoingRightFromLeftButtonJumpsOverCenterToRight() {
sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);
assertTrue("right button should be focused", mRightButton.isFocused());
}
@MediumTest
public void testGoingLeftFromRightButtonGoesToCenter() {
// Give right button focus by having it request focus. We post it
// to the UI thread because we are not running on the same thread, and

View File

@@ -20,6 +20,7 @@ import com.example.android.apis.R;
import android.content.Context;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import android.view.FocusFinder;
import android.view.LayoutInflater;
import android.view.View;
@@ -87,6 +88,7 @@ public class Focus2AndroidTest extends AndroidTestCase {
* explain any and all failures in other tests. This is not guaranteed
* to run before other tests, as junit uses reflection to find the tests.
*/
@SmallTest
public void testPreconditions() {
assertNotNull(mLeftButton);
assertTrue("center button should be right of left button",
@@ -95,12 +97,14 @@ public class Focus2AndroidTest extends AndroidTestCase {
mCenterButton.getRight() < mRightButton.getLeft());
}
@SmallTest
public void testGoingRightFromLeftButtonJumpsOverCenterToRight() {
assertEquals("right should be next focus from left",
mRightButton,
mFocusFinder.findNextFocus(mRoot, mLeftButton, View.FOCUS_RIGHT));
}
@SmallTest
public void testGoingLeftFromRightButtonGoesToCenter() {
assertEquals("center should be next focus from right",
mCenterButton,