Fixed
Status Update
Comments
yb...@google.com <yb...@google.com>
da...@google.com <da...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit f570475abb57a6527f861a083ddfccf451b3427b
Author: Sumir Kataria <sumir@google.com>
Date: Wed Aug 29 14:09:32 2018
Add ability to trigger timed work in TestDriver.
Bug: 113360060
Test: Added and ran new tests in TestSchedulerTest.
Change-Id: I681db88e3190b96e90a5d531b7b1fa053eaf8ab9
M work/workmanager-test/src/androidTest/java/androidx/work/test/TestSchedulerTest.java
A work/workmanager-test/src/androidTest/java/androidx/work/test/workers/CountingTestWorker.java
M work/workmanager-test/src/androidTest/java/androidx/work/test/workers/TestWorker.java
M work/workmanager-test/src/main/java/androidx/work/test/TestDriver.java
M work/workmanager-test/src/main/java/androidx/work/test/TestScheduler.java
M work/workmanager-test/src/main/java/androidx/work/test/WorkManagerTestInitHelper.java
https://android-review.googlesource.com/740398
https://goto.google.com/android-sha1/f570475abb57a6527f861a083ddfccf451b3427b
Branch: androidx-master-dev
commit f570475abb57a6527f861a083ddfccf451b3427b
Author: Sumir Kataria <sumir@google.com>
Date: Wed Aug 29 14:09:32 2018
Add ability to trigger timed work in TestDriver.
Bug: 113360060
Test: Added and ran new tests in TestSchedulerTest.
Change-Id: I681db88e3190b96e90a5d531b7b1fa053eaf8ab9
M work/workmanager-test/src/androidTest/java/androidx/work/test/TestSchedulerTest.java
A work/workmanager-test/src/androidTest/java/androidx/work/test/workers/CountingTestWorker.java
M work/workmanager-test/src/androidTest/java/androidx/work/test/workers/TestWorker.java
M work/workmanager-test/src/main/java/androidx/work/test/TestDriver.java
M work/workmanager-test/src/main/java/androidx/work/test/TestScheduler.java
M work/workmanager-test/src/main/java/androidx/work/test/WorkManagerTestInitHelper.java
he...@gmail.com <he...@gmail.com> #3
The testing artifact (work-testing) will have the ability to trigger initial delays and period met signals in alpha09. You should use this to simulate any testing you need.
Description
Version used:1.1.1
Devices/Android versions reproduced on: All
File: FrameworkSQLiteOpenHelper
FrameworkSQLiteDatabase getWrappedDb(SQLiteDatabase sqLiteDatabase) {
FrameworkSQLiteDatabase dbRef = mDbRef[0];
if (dbRef == null) {
dbRef = new FrameworkSQLiteDatabase(sqLiteDatabase);
mDbRef[0] = dbRef;
}
return mDbRef[0];
}
Room always preserve The First Open db, even if it is closed.
Sometimes sqLiteDatabase != mDbRef[0].mDelegate, we get the wrong db from room.
This occurs when opening db, then something wrong and throws exception, but app caught it. The next time we use room, it throws re-open exception.
I thinks mDbRef[0].mDelegate should change when sqLiteDatabase is changed.
Like this:
FrameworkSQLiteDatabase getWrappedDb(SQLiteDatabase sqLiteDatabase) {
FrameworkSQLiteDatabase dbRef = mDbRef[0];
if (dbRef == null || dbRef.isDatabaseChanged(sqLiteDatabase)) {
dbRef = new FrameworkSQLiteDatabase(sqLiteDatabase);
mDbRef[0] = dbRef;
}
return mDbRef[0];
}
File: FrameworkSQLiteDatabase
public boolean isDatabaseChanged(SQLiteDatabase db) {
return mDelegate != db;
}