@Override
 protected void setUp() throws Exception {
   super.setUp();
   InstantMessage msg = new InstantMessage(MESSAGE_ID, CONTACT, MESSAGE, true);
   mReceivedChatMessage = new ReceivedChatMessage(msg, false);
   mOneOneWindow = new MockOneOneChatWindow();
 }
Exemplo n.º 2
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   mContentResolver = getInstrumentation().getTargetContext().getContentResolver();
   mProvider = mContentResolver.acquireProvider(Contacts.AUTHORITY);
   mCallLogProvider = mContentResolver.acquireProvider(CallLog.AUTHORITY);
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER)
       .ensureInitialized(getInstrumentation().getTargetContext());
   RecordHistogram.initialize();
 }
Exemplo n.º 4
0
 @Override
 protected void setUp() throws Exception {
   m =
       ProviderMetaData.loadFromXML(
           getInstrumentation().getContext().getResources().getXml(R.xml.metadata));
   super.setUp();
 }
Exemplo n.º 5
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    cacheFile = new File(getInstrumentation().getTargetContext().getCacheDir(), "Foo");
    cacheFile.delete();
    mockWebServer = new MockWebServer();

    spiceManager = new BitmapSpiceManagerUnderTest();
    spiceManager.start(getInstrumentation().getTargetContext());

    data = new ArrayList<DataUnderTest>();

    data1 = new DataUnderTest();
    data1.setFoo("data1");
    data1.setImageUrl("data1.png");

    data2 = new DataUnderTest();
    data2.setFoo("data2");
    data2.setImageUrl("data2.png");

    data.add(data1);
    data.add(data2);
    adapter =
        new SpiceArrayAdapterUnderTest(getInstrumentation().getTargetContext(), spiceManager, data);
  }
Exemplo n.º 6
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   // TODO should be getContext() but it returns a broken context
   final Context context = getInstrumentation().getTargetContext();
   HttpTransportCache.install(ApacheHttpTransport.INSTANCE, context);
   mSearch = new GoogleBookSearch(context);
 }
 public void setUp() throws Exception {
   super.setUp();
   BLASTSearchEngine ncbiBLASTService = new StubbedBLASTSearchEngine();
   Context context = getInstrumentation().getTargetContext();
   OhBLASTItTestHelper helper = new OhBLASTItTestHelper(context);
   helper.cleanDatabase();
   sender = new BLASTQuerySender(context, ncbiBLASTService);
 }
 @Override
 public void tearDown() throws Exception {
   if (eq != null) {
     eq.tearDown();
     eq = null;
   }
   SalesforceSDKManager.getInstance().setAdditionalOauthKeys(null);
   super.tearDown();
 }
Exemplo n.º 9
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   // http://stackoverflow.com/q/6516441/693752
   getInstrumentation().waitForIdleSync();
   mockWebServer = new MockWebServer();
   cacheFile = new File(getInstrumentation().getContext().getCacheDir(), "test");
   cacheFile.delete();
 }
 @Override
 public void tearDown() throws Exception {
   if (eq != null) {
     eq.tearDown();
     eq = null;
   }
   MetadataManager.reset(null);
   CacheManager.hardReset(null);
   super.tearDown();
 }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    mFormatter =
        RelativeDateTimeFormatter.builder()
            .withCasing(RelativeDateTimeFormatter.Casing.LOWER_CASE)
            .build();
    mNow = DateTime.parse("2000-01-01T12:00Z");
  }
  @Override
  protected void tearDown() throws Exception {
    super.tearDown();

    this.mockEntity = null;
    this.mockClient = null;
    this.responseQueue = null;
    this.exceptionQueue = null;
    this.queueingListener = null;
    this.liveConnectClient = null;
  }
Exemplo n.º 13
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    // create new database
    PodDBAdapter.init(getInstrumentation().getTargetContext());
    PodDBAdapter.deleteDatabase();
    PodDBAdapter adapter = PodDBAdapter.getInstance();
    adapter.open();
    adapter.close();
  }
 @Override
 public void tearDown() throws Exception {
   if (loginServerManager != null) {
     loginServerManager.reset();
   }
   if (eq != null) {
     eq.tearDown();
     eq = null;
   }
   super.tearDown();
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   MyLog.i(this, "setUp started");
   TestSuite.initializeWithData(this);
   ma =
       MyContextHolder.get()
           .persistentAccounts()
           .fromAccountName(TestSuite.GNUSOCIAL_TEST_ACCOUNT_NAME);
   assertTrue(TestSuite.GNUSOCIAL_TEST_ACCOUNT_NAME + " exists", ma.isValid());
 }
Exemplo n.º 16
0
 @Override
 protected void tearDown() throws Exception {
   TestUtils.clearProject(currentProjectName);
   if (testImage != null && testImage.exists()) {
     testImage.delete();
   }
   if (testSound != null && testSound.exists()) {
     testSound.delete();
   }
   super.tearDown();
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   Application application =
       (Application) getInstrumentation().getTargetContext().getApplicationContext();
   SimpleSerializerObjectPersisterFactory factory =
       new SimpleSerializerObjectPersisterFactory(application);
   dataPersistenceManager = factory.createObjectPersister(Weather.class);
   TEST_TEMP.setTemp("28");
   TEST_TEMP.setTemp_unit("C");
   TEST_TEMP.setWind(new Wind());
 }
Exemplo n.º 18
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    // Workaround for Android 4.4 Devices
    // https://code.google.com/p/dexmaker/issues/detail?id=2
    System.setProperty(
        "dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath());

    droneControlService = Mockito.mock(DroneControlService.class);
    DroneServiceWrapper.getInstance().setDroneService(droneControlService);
    sprite = new Sprite(getName());
    sequenceAction = new SequenceAction();
  }
Exemplo n.º 19
0
  @Override
  protected void tearDown() throws Exception {
    super.tearDown();

    assertTrue(PodDBAdapter.deleteDatabase());

    final Context context = getInstrumentation().getTargetContext();
    File testDir = context.getExternalFilesDir(TEST_FOLDER);
    assertNotNull(testDir);
    for (File f : testDir.listFiles()) {
      f.delete();
    }
  }
  @Override
  public void setUp() throws Exception {
    super.setUp();
    targetContext = getInstrumentation().getTargetContext();
    eq = new EventsListenerQueue();

    // Wait for app initialization to complete.
    final Application app = Instrumentation.newApplication(TestForceApp.class, targetContext);
    getInstrumentation().callApplicationOnCreate(app);
    if (SalesforceSDKManager.getInstance() == null) {
      eq.waitForEvent(EventType.AppCreateComplete, 5000);
    }
    loginServerManager = SalesforceSDKManager.getInstance().getLoginServerManager();
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    mInstrumentation = getInstrumentation();
    mContext = mInstrumentation.getTargetContext();

    IntentFilter filter = new IntentFilter();
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
    filter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
    filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
    mContext.registerReceiver(mReceiver, filter);
  }
Exemplo n.º 22
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    mTransitionDrawable =
        (TransitionDrawable)
            getInstrumentation()
                .getTargetContext()
                .getResources()
                .getDrawable(R.drawable.transition_test);
    mTransitionDrawable.setBounds(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);

    mBitmap = Bitmap.createBitmap(CANVAS_WIDTH, CANVAS_HEIGHT, Config.ARGB_8888);
    mCanvas = new Canvas(mBitmap);
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    mContext = getInstrumentation().getContext();
    mDevice = UiDevice.getInstance(getInstrumentation());
    mDevicePolicyManager =
        (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
    mPackageManager = mContext.getPackageManager();
    mPackageInstaller = mPackageManager.getPackageInstaller();
    assertNotNull(mPackageInstaller);

    // check that app is not already installed
    assertFalse(isPackageInstalled(TEST_APP_PKG));
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    // Set up the MockClient
    this.mockEntity = new MockHttpEntity();

    StatusLine statusLine = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
    this.mockResponse = new MockHttpResponse(this.mockEntity, statusLine);
    this.mockClient = new MockHttpClient(this.mockResponse);
    this.loadLiveLibraryHeaderChecker();
    this.exceptionQueue = new LinkedBlockingQueue<LiveOperationException>();
    this.liveConnectClient = TestUtils.newLiveConnectClient(this.mockClient);
  }
Exemplo n.º 25
0
  public static void clickOnLinkUsingJs(
      final InstrumentationTestCase testCase,
      final AwContents awContents,
      final OnEvaluateJavaScriptResultHelper onEvaluateJavaScriptResultHelper,
      final String linkId)
      throws Throwable {

    Assert.assertTrue(
        CriteriaHelper.pollForCriteria(
            new Criteria() {
              @Override
              public boolean isSatisfied() {
                try {
                  String linkIsNotNull =
                      executeJavaScriptAndWaitForResult(
                          testCase,
                          awContents,
                          onEvaluateJavaScriptResultHelper,
                          "document.getElementById('" + linkId + "') != null");
                  return linkIsNotNull.equals("true");
                } catch (Throwable t) {
                  t.printStackTrace();
                  Assert.fail("Failed to check if DOM is loaded: " + t.toString());
                  return false;
                }
              }
            },
            WAIT_TIMEOUT_SECONDS * 1000,
            CHECK_INTERVAL));

    testCase
        .getInstrumentation()
        .runOnMainSync(
            new Runnable() {
              @Override
              public void run() {
                awContents
                    .getContentViewCore()
                    .evaluateJavaScript(
                        "var evObj = document.createEvent('Events'); "
                            + "evObj.initEvent('click', true, false); "
                            + "document.getElementById('"
                            + linkId
                            + "').dispatchEvent(evObj);"
                            + "console.log('element with id ["
                            + linkId
                            + "] clicked');");
              }
            });
  }
 @Override
 public void setUp() throws Exception {
   super.setUp();
   final Context targetContext = getInstrumentation().getTargetContext();
   final Application app = Instrumentation.newApplication(TestForceApp.class, targetContext);
   getInstrumentation().callApplicationOnCreate(app);
   eq = new EventsListenerQueue();
   if (!SalesforceSDKManager.hasInstance()) {
     eq.waitForEvent(EventsObservable.EventType.AppCreateComplete, 5000);
   }
   SalesforceSDKManager.getInstance()
       .getPasscodeManager()
       .setPasscodeHash(ClientManagerTest.TEST_PASSCODE_HASH);
   SalesforceSDKManager.getInstance().setAdditionalOauthKeys(createAdditionalOauthKeys());
 }
Exemplo n.º 27
0
  @Override
  protected void setUp() throws Exception {
    mSyncContentResolverDelegate = new CountingMockSyncContentResolverDelegate();
    mContext = getInstrumentation().getTargetContext();
    setupTestAccounts(mContext);

    AndroidSyncSettings.overrideForTests(mContext, mSyncContentResolverDelegate);
    mAuthority = AndroidSyncSettings.getContractAuthority(mContext);
    AndroidSyncSettings.updateAccount(mContext, mAccount);

    mSyncSettingsObserver = new MockSyncSettingsObserver();
    AndroidSyncSettings.registerObserver(mContext, mSyncSettingsObserver);

    super.setUp();
  }
 @Override
 protected void tearDown() throws Exception {
   if (mDevicePolicyManager.isDeviceOwnerApp(PACKAGE_NAME)
       || mDevicePolicyManager.isProfileOwnerApp(PACKAGE_NAME)) {
     mDevicePolicyManager.setUninstallBlocked(getWho(), TEST_APP_PKG, false);
   }
   try {
     mContext.unregisterReceiver(mBroadcastReceiver);
   } catch (IllegalArgumentException e) {
     // ignore
   }
   if (mSession != null) {
     mSession.abandon();
   }
   super.tearDown();
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   MyLog.i(this, "setUp started");
   TestSuite.initializeWithData(this);
   ma =
       MyContextHolder.get()
           .persistentAccounts()
           .fromAccountName(TestSuite.CONVERSATION_ACCOUNT_NAME);
   assertTrue(ma.isValid());
   selectedMessageId =
       MyQuery.oidToId(
           OidEnum.MSG_OID, ma.getOriginId(), TestSuite.CONVERSATION_ENTRY_MESSAGE_OID);
   assertTrue("Selected message exists", selectedMessageId != 0);
   MyLog.i(this, "setUp ended");
 }
Exemplo n.º 30
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    UtilFile.deleteDirectory(new File(CATROID_DIRECTORY + "/testDirectory"));
    TestUtils.deleteTestProjects(projectName);

    testDirectory = new File(CATROID_DIRECTORY + "/testDirectory");
    testDirectory.mkdir();
    file1 = new File(testDirectory.getAbsolutePath() + "/file1");
    file1.createNewFile();
    subDirectory = new File(testDirectory.getAbsolutePath() + "/subDirectory");
    subDirectory.mkdir();
    file2 = new File(subDirectory.getAbsolutePath() + "/file2");
    file2.createNewFile();
  }