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


Java LargeTest类代码示例

本文整理汇总了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();
}
 
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:23,代码来源:NodeRepositoryTest.java

示例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())));

}
 
开发者ID:Gchorba,项目名称:NickleAndDimed,代码行数:17,代码来源:AddEventTest.java

示例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));
}
 
开发者ID:Gchorba,项目名称:NickleAndDimed,代码行数:18,代码来源:AddEventTest.java

示例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);
}
 
开发者ID:Gchorba,项目名称:NickleAndDimed,代码行数:17,代码来源:AddParticipantsTest.java

示例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)));
}
 
开发者ID:Gchorba,项目名称:NickleAndDimed,代码行数:17,代码来源:LoginTest.java

示例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));
}
 
开发者ID:Gchorba,项目名称:NickleAndDimed,代码行数:17,代码来源:LoginTest.java

示例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);
}
 
开发者ID:Kestutis-Z,项目名称:World-Weather,代码行数:18,代码来源:GeneralDatabaseServiceTest.java

示例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;
}
 
开发者ID:timberdoodle,项目名称:TimberdoodleApp,代码行数:31,代码来源:CipherStressTests.java

示例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());
}
 
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:24,代码来源:UiControllerImplIntegrationTest.java

示例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);
}
 
开发者ID:kodamirmo,项目名称:LostAndFound,代码行数:22,代码来源:AuthorizationClientTests.java

示例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]));
}
 
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:19,代码来源:EventInjectorTest.java

示例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);
}
 
开发者ID:kodamirmo,项目名称:LostAndFound,代码行数:22,代码来源:AuthorizationClientTests.java

示例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());
}
 
开发者ID:b099l3,项目名称:FacebookImageShareIntent,代码行数:21,代码来源:RequestTests.java

示例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) {
    }

}
 
开发者ID:b099l3,项目名称:FacebookImageShareIntent,代码行数:17,代码来源:AsyncRequestTests.java

示例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());
}
 
开发者ID:kodamirmo,项目名称:LostAndFound,代码行数:26,代码来源:AuthorizationClientTests.java


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