本文整理匯總了Java中android.test.suitebuilder.annotation.LargeTest類的典型用法代碼示例。如果您正苦於以下問題:Java LargeTest類的具體用法?Java LargeTest怎麽用?Java LargeTest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LargeTest類屬於android.test.suitebuilder.annotation包,在下文中一共展示了LargeTest類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fetchNodeList_FetchesDataFromServer
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@Test
@LargeTest // this is a slow tests, uses network
public void fetchNodeList_FetchesDataFromServer() throws Exception {
// for some reason normal TimingLogger doesnt output anything in androidTest, even if setting correct log level (Log.d returns -1)...
SysOutTimingLogger timing = new SysOutTimingLogger(TAG, "perf");
List<Node> result = NodeRepository.fetchNodeList();
assertTrue(result.size() > 0);
timing.addSplit("fetch");
NodeRepository sut = makeSut();
sut.setNodes(result);
timing.addSplit("set nodes");
sut.save();
timing.addSplit("save");
NodeRepository.load(InstrumentationRegistry.getTargetContext());
timing.addSplit("load");
timing.dumpToSysOut();
}
示例2: testEditEventCurrentEventNameDisplayed
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@LargeTest
public void testEditEventCurrentEventNameDisplayed() {
// Given
Event event = new Event(randomUUID(), "testname", EUR, randomUUID());
Intent intent = new Intent();
intent.putExtra(ARGUMENT_EVENT_ID, event.getId());
setActivityIntent(intent);
when(eventStore.getById(event.getId())).thenReturn(event);
// When
getActivity();
// Then
onView(withId(R.id.event_name)).check(matches(withText(event.getName())));
}
示例3: testEditParticipantsIsNotStartedIfNextButtonIsPressed
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@LargeTest
public void testEditParticipantsIsNotStartedIfNextButtonIsPressed() {
// Given
Event event = new Event(randomUUID(), "testname", EUR, randomUUID());
Intent intent = new Intent();
intent.putExtra(ARGUMENT_EVENT_ID, event.getId());
setActivityIntent(intent);
when(eventStore.getById(event.getId())).thenReturn(event);
// When
getActivity();
onView(withText(R.string.next)).perform(click());
// Then
verify(eventStore, times(1)).persist(eq(event));
verify(activityStarter, times(0)).startAddParticipants(any(Context.class), eq(event));
}
示例4: testWhenNoUsernameIseEnteredAllNonParticipatingUsersAreShown
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@LargeTest
public void testWhenNoUsernameIseEnteredAllNonParticipatingUsersAreShown() {
// Given
User user = new User(randomUUID(), "Joe");
List<User> users = asList(user);
when(userStore.getAll()).thenReturn(users);
when(participantManager.filterOutParticipants(users)).thenReturn(users);
// When
getActivity();
// Then
onData(Matchers.<Object>equalTo(user)).inAdapterView(withId(R.id.user_grid)).check(matches(isDisplayed()));
verify(userStore, times(1)).getAll();
verify(participantManager, times(1)).filterOutParticipants(users);
}
示例5: testUserIsLoggedInWhenPressingStart
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@LargeTest
public void testUserIsLoggedInWhenPressingStart() throws InterruptedException {
// Given
String userName = "Joe";
getActivity();
onView(withId(R.id.user_name)).perform(typeText(userName));
closeSoftKeyboard();
//HACK: Await keyboard closed, since this animation can not be disabled on the phone
Thread.sleep(100);
// When
onView(withId(R.id.action_login_start)).perform(click());
// Then
verify(loginService, times(1)).login(argThat(matchesUser(userName)));
}
示例6: testStartEventIsStartedWhenPressingStart
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@LargeTest
public void testStartEventIsStartedWhenPressingStart() throws InterruptedException {
// Given
String userName = "Joe";
getActivity();
onView(withId(R.id.user_name)).perform(typeText(userName));
closeSoftKeyboard();
//HACK: Await keyboard closed, since this animation can not be disabled on the phone
Thread.sleep(100);
// When
onView(withId(R.id.action_login_start)).perform(click());
// Then
verify(activityStarter, times(1)).startStartEvent(any(Login.class));
}
示例7: testHandleIntent
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@LargeTest
public void testHandleIntent() throws InterruptedException {
Intent insertNewCityIntent = getInsertNewCityIntent();
startService(insertNewCityIntent);
Intent renameCityIntent = getRenameCityIntent();
startService(renameCityIntent);
Intent deleteCityIntent = getDeleteCityIntent();
startService(deleteCityIntent);
boolean wereIntentsHandledInTime = countDownLatch.await(
SECONDS_TO_HANDLE_ALL_TESTED_INTENTS, TimeUnit.SECONDS);
assertTrue("Failed to handle all " + HANDLED_INTENT_COUNT
+ " intents in a reasonable time", wereIntentsHandledInTime);
}
示例8: testPublicMessageCipher
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
/**
* Test if public message cipher can handle high amounts of tasks and still work properly
*
* @throws Exception
*/
@LargeTest
public void testPublicMessageCipher() throws Exception {
ComparisonFailure ex = null;
//initialise and get data and units under test
List<SecretKey> keyList = CipherSuiteTestsUtility.getSpecificKeysFromGroupKeyList(this.keyList, true);
List<byte[]> nonceList = CipherSuiteTestsUtility.generateNonceList(stressTestAmount, CipherSuiteTestsUtility.ivLengthCipher);
byte[] result = new byte[CipherSuiteTestsUtility.PLAINSIZE];
byte[] buffer = new byte[CipherSuiteTestsUtility.PLAINSIZE];
IPublicMessageCipher decryption = CipherSuiteTestsUtility.setUpPublicMessageCipher(Cipher.DECRYPT_MODE);
IPublicMessageCipher encryption= CipherSuiteTestsUtility.setUpPublicMessageCipher(Cipher.ENCRYPT_MODE);
//start the test
for (int i = 0; i < keyList.size(); ++i) {
assert encryption != null;
encryption.doFinalOptimized(nonceList.get(i), keyList.get(i), CipherTestVectors.getByteInput(), 0, buffer, 0);
assert decryption != null;
decryption.doFinalOptimized(nonceList.get(i), keyList.get(i), buffer, 0, result, 0);
try {
Assert.assertEquals(CipherSuiteTestsUtility.PLAINSIZE, result.length);
Assert.assertEquals(CipherTestVectors.testInput, new String(result));
} catch (ComparisonFailure e) {
ex = e;
}
}
if (ex != null) throw ex;
}
示例9: testInjectKeyEvent
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@LargeTest
public void testInjectKeyEvent() throws InterruptedException {
sendActivity = getActivity();
getInstrumentation().waitForIdleSync();
getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
try {
KeyCharacterMap keyCharacterMap = UiControllerImpl.getKeyCharacterMap();
KeyEvent[] events = keyCharacterMap.getEvents("a".toCharArray());
injectEventWorked.set(uiController.injectKeyEvent(events[0]));
latch.countDown();
} catch (InjectEventSecurityException e) {
injectEventThrewSecurityException.set(true);
}
}
});
assertFalse("injectEvent threw a SecurityException", injectEventThrewSecurityException.get());
assertTrue("Timed out!", latch.await(10, TimeUnit.SECONDS));
assertTrue(injectEventWorked.get());
}
示例10: testWebViewChecksInternetPermission
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@SmallTest
@MediumTest
@LargeTest
public void testWebViewChecksInternetPermission() {
MockAuthorizationClient client = new MockAuthorizationClient() {
@Override
int checkPermission(String permission) {
return PackageManager.PERMISSION_DENIED;
}
};
AuthorizationClient.WebViewAuthHandler handler = client.new WebViewAuthHandler();
AuthorizationClient.AuthorizationRequest request = createRequest();
client.setRequest(request);
handler.onWebDialogComplete(request, null, new FacebookException(ERROR_MESSAGE));
assertNotNull(client.result);
assertEquals(AuthorizationClient.Result.Code.ERROR, client.result.code);
assertNull(client.result.token);
assertNotNull(client.result.errorMessage);
}
示例11: testInjectKeyEventUpWithNoDown
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@LargeTest
public void testInjectKeyEventUpWithNoDown() throws Exception {
sendActivity = getActivity();
getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
View view = sendActivity.findViewById(R.id.send_data_edit_text);
assertTrue(view.requestFocus());
latch.countDown();
}
});
assertTrue("Timed out!", latch.await(10, TimeUnit.SECONDS));
KeyCharacterMap keyCharacterMap = UiControllerImpl.getKeyCharacterMap();
KeyEvent[] events = keyCharacterMap.getEvents("a".toCharArray());
assertTrue(injector.injectKeyEvent(events[1]));
}
示例12: testLoginDialogHandlesDisabled
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@SmallTest
@MediumTest
@LargeTest
public void testLoginDialogHandlesDisabled() {
Bundle bundle = new Bundle();
bundle.putInt(NativeProtocol.EXTRA_PROTOCOL_VERSION, NativeProtocol.PROTOCOL_VERSION_20121101);
bundle.putString(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_SERVICE_DISABLED);
Intent intent = new Intent();
intent.putExtras(bundle);
MockAuthorizationClient client = new MockAuthorizationClient();
AuthorizationClient.KatanaLoginDialogAuthHandler handler = client.new KatanaLoginDialogAuthHandler();
AuthorizationClient.AuthorizationRequest request = createRequest();
client.setRequest(request);
handler.onActivityResult(0, Activity.RESULT_OK, intent);
assertNull(client.result);
assertTrue(client.triedNextHandler);
}
示例13: testExecutePlaceRequestWithSearchText
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@MediumTest
@LargeTest
public void testExecutePlaceRequestWithSearchText() {
TestSession session = openTestSessionWithSharedUser();
// Pass a distance without a location to ensure it is correctly ignored.
Request request = Request.newPlacesSearchRequest(session, null, 1000, 5, "Starbucks", null);
Response response = request.executeAndWait();
assertNotNull(response);
assertNull(response.getError());
GraphMultiResult graphResult = response.getGraphObjectAs(GraphMultiResult.class);
assertNotNull(graphResult);
List<GraphObject> results = graphResult.getData();
assertNotNull(results);
assertNotNull(response.getRawResponse());
}
示例14: testExecuteBatchWithNullRequestThrows
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@SmallTest
@MediumTest
@LargeTest
public void testExecuteBatchWithNullRequestThrows() throws Exception {
try {
TestRequestAsyncTask task = new TestRequestAsyncTask(new Request[] { null });
task.executeOnBlockerThread();
waitAndAssertSuccessOrRethrow(1);
fail("expected NullPointerException");
} catch (NullPointerException exception) {
}
}
示例15: testWebViewHandlesSuccess
import android.test.suitebuilder.annotation.LargeTest; //導入依賴的package包/類
@SmallTest
@MediumTest
@LargeTest
public void testWebViewHandlesSuccess() {
Bundle bundle = new Bundle();
bundle.putString("access_token", ACCESS_TOKEN);
bundle.putString("expires_in", String.format("%d", EXPIRES_IN_DELTA));
bundle.putString("code", "Something else");
MockAuthorizationClient client = new MockAuthorizationClient();
AuthorizationClient.WebViewAuthHandler handler = client.new WebViewAuthHandler();
AuthorizationClient.AuthorizationRequest request = createRequest();
client.setRequest(request);
handler.onWebDialogComplete(request, bundle, null);
assertNotNull(client.result);
assertEquals(AuthorizationClient.Result.Code.SUCCESS, client.result.code);
AccessToken token = client.result.token;
assertNotNull(token);
assertEquals(ACCESS_TOKEN, token.getToken());
assertDateDiffersWithinDelta(new Date(), token.getExpires(), EXPIRES_IN_DELTA * 1000, 1000);
assertEquals(PERMISSIONS, token.getPermissions());
}