use of org.edx.mobile.model.db.DownloadEntry.WatchedState in project edx-app-android by edx.
the class DbTests method testupdateVideoWatchedState.
@Test
public void testupdateVideoWatchedState() throws Exception {
db.clearDataByUser(username);
String videoId = "videoId";
WatchedState state = WatchedState.PARTIALLY_WATCHED;
db.updateVideoWatchedState(videoId, state, new DataCallback<Integer>() {
@Override
public void onResult(Integer result) {
assertNotNull(result);
assertTrue(result == 0);
print("updated VideoWatchedState for 0 is" + result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
String videoid = de.videoId = "videoId-" + System.currentTimeMillis();
WatchedState State = WatchedState.WATCHED;
db.addVideoData(de, null);
db.updateVideoWatchedState(videoid, State, new DataCallback<Integer>() {
@Override
public void onResult(Integer result) {
assertNotNull(result);
assertTrue(result == 1);
print("updated VideoWatchedState for 1 is :" + result.toString());
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
use of org.edx.mobile.model.db.DownloadEntry.WatchedState in project edx-app-android by edx.
the class DbTests method testgetWatchedStateForVideoId.
@Test
public void testgetWatchedStateForVideoId() throws Exception {
db.clearDataByUser(username);
String videoId = "videoId";
db.getWatchedStateForVideoId(videoId, new DataCallback<DownloadEntry.WatchedState>() {
@Override
public void onResult(WatchedState result) {
assertNotNull(result);
assertTrue(result == WatchedState.UNWATCHED);
print("result for getWatchedStateForVideoId :" + result.toString());
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
de.watched = WatchedState.WATCHED;
de.videoId = "videoid";
db.addVideoData(de, null);
db.getWatchedStateForVideoId(de.videoId, new DataCallback<DownloadEntry.WatchedState>() {
@Override
public void onResult(WatchedState result) {
assertNotNull(result);
assertTrue(result == WatchedState.WATCHED);
print("Result for getWatchedStateForVideoId is in 1:" + result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
Aggregations