Exemplo n.º 1
0
  private long trackMemoryAllocation() {
    long m1 = TestUtils.getPss();

    downloadFromExtratorrent();
    downloadFromKAT();
    downloadFromMininova();

    long m2 = TestUtils.getPss();

    return m2 - m1;
  }
Exemplo n.º 2
0
  @LargeTest
  public void testDownload1() throws IOException {

    HttpClient c = HttpClientFactory.getInstance(HttpClientFactory.HttpContext.MISC);

    File torrentFile =
        new File(SystemUtils.getTorrentsDirectory(), "create_download_test1.torrent");
    File saveDir = SystemUtils.getTorrentDataDirectory();
    c.save(TorrentUrls.FROSTCLICK_BRANDON_HINES_2010, torrentFile);

    final CountDownLatch signal = new CountDownLatch(1);

    VuzeDownloadManager dm =
        VuzeDownloadFactory.create(
            torrentFile.getAbsolutePath(),
            null,
            saveDir.getAbsolutePath(),
            new VuzeDownloadListener() {

              @Override
              public void stateChanged(VuzeDownloadManager dm, int state) {
                if (state == VuzeDownloadManager.STATE_STOPPED) {
                  signal.countDown();
                }
              }

              @Override
              public void downloadComplete(VuzeDownloadManager dm) {}
            });

    assertNotNull(dm);

    VuzeUtils.remove(dm, true);

    assertTrue("Unable to remove the download", TestUtils.await(signal, 10, TimeUnit.SECONDS));
  }