Loading core/tests/coretests/src/android/database/DatabaseErrorHandlerTest.java +16 −1 Original line number Diff line number Diff line Loading @@ -18,8 +18,10 @@ package android.database; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDiskIOException; import android.database.sqlite.SQLiteException; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.Suppress; import android.util.Log; import java.io.BufferedWriter; Loading Loading @@ -60,6 +62,7 @@ public class DatabaseErrorHandlerTest extends AndroidTestCase { assertTrue(mDatabaseFile.exists()); } public void testDatabaseIsCorrupt() throws IOException { mDatabase.execSQL("create table t (i int);"); // write junk into the database file Loading @@ -72,9 +75,21 @@ public class DatabaseErrorHandlerTest extends AndroidTestCase { try { mDatabase.execSQL("select * from t;"); fail("expected exception"); } catch (SQLiteException e) { } catch (SQLiteDiskIOException e) { /** * this test used to produce a corrupted db. but with new sqlite it instead reports * Disk I/O error. meh.. * need to figure out how to cause corruption in db */ // expected if (mDatabaseFile.exists()) { mDatabaseFile.delete(); } } catch (SQLiteException e) { } // database file should be gone assertFalse(mDatabaseFile.exists()); // after corruption handler is called, the database file should be free of // database corruption SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(mDatabaseFile.getPath(), null, Loading core/tests/coretests/src/android/database/sqlite/SQLiteCursorTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.database.Cursor; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.Suppress; import android.util.Log; import java.io.File; Loading Loading @@ -54,6 +55,7 @@ public class SQLiteCursorTest extends AndroidTestCase { super.tearDown(); } @Suppress @SmallTest public void testQueryObjReassignment() { mDatabase.enableWriteAheadLogging(); Loading core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { mDatabase.setVersion(CURRENT_DATABASE_VERSION); } @Suppress @SmallTest public void testEnableWriteAheadLogging() { mDatabase.disableWriteAheadLogging(); Loading @@ -86,6 +87,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { assertEquals(pool, mDatabase.mConnectionPool); } @Suppress @SmallTest public void testDisableWriteAheadLogging() { mDatabase.execSQL("create table test (i int);"); Loading @@ -102,6 +104,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { assertFalse(db.isOpen()); } @Suppress @SmallTest public void testCursorsWithClosedDbConnAfterDisableWriteAheadLogging() { mDatabase.disableWriteAheadLogging(); Loading Loading @@ -138,6 +141,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { /** * a transaction should be started before a standalone-update/insert/delete statement */ @Suppress @SmallTest public void testStartXactBeforeUpdateSql() throws InterruptedException { runTestForStartXactBeforeUpdateSql(INSERT); Loading Loading @@ -749,6 +753,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { * * @throws InterruptedException */ @Suppress @SmallTest public void testTransactionAndWalInterplay1() throws InterruptedException { createTableAndClearCache(); Loading Loading @@ -807,6 +812,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { * instead of mDatabase.beginTransactionNonExclusive(), use execSQL("BEGIN transaction") * and instead of mDatabase.endTransaction(), use execSQL("END"); */ @Suppress @SmallTest public void testTransactionAndWalInterplay2() throws InterruptedException { createTableAndClearCache(); Loading Loading @@ -863,6 +869,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { * instead of committing the data, do rollback and make sure the data seen by the query * within the transaction is now gone. */ @Suppress @SmallTest public void testTransactionAndWalInterplay3() { createTableAndClearCache(); Loading Loading
core/tests/coretests/src/android/database/DatabaseErrorHandlerTest.java +16 −1 Original line number Diff line number Diff line Loading @@ -18,8 +18,10 @@ package android.database; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDiskIOException; import android.database.sqlite.SQLiteException; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.Suppress; import android.util.Log; import java.io.BufferedWriter; Loading Loading @@ -60,6 +62,7 @@ public class DatabaseErrorHandlerTest extends AndroidTestCase { assertTrue(mDatabaseFile.exists()); } public void testDatabaseIsCorrupt() throws IOException { mDatabase.execSQL("create table t (i int);"); // write junk into the database file Loading @@ -72,9 +75,21 @@ public class DatabaseErrorHandlerTest extends AndroidTestCase { try { mDatabase.execSQL("select * from t;"); fail("expected exception"); } catch (SQLiteException e) { } catch (SQLiteDiskIOException e) { /** * this test used to produce a corrupted db. but with new sqlite it instead reports * Disk I/O error. meh.. * need to figure out how to cause corruption in db */ // expected if (mDatabaseFile.exists()) { mDatabaseFile.delete(); } } catch (SQLiteException e) { } // database file should be gone assertFalse(mDatabaseFile.exists()); // after corruption handler is called, the database file should be free of // database corruption SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(mDatabaseFile.getPath(), null, Loading
core/tests/coretests/src/android/database/sqlite/SQLiteCursorTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.database.Cursor; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.Suppress; import android.util.Log; import java.io.File; Loading Loading @@ -54,6 +55,7 @@ public class SQLiteCursorTest extends AndroidTestCase { super.tearDown(); } @Suppress @SmallTest public void testQueryObjReassignment() { mDatabase.enableWriteAheadLogging(); Loading
core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { mDatabase.setVersion(CURRENT_DATABASE_VERSION); } @Suppress @SmallTest public void testEnableWriteAheadLogging() { mDatabase.disableWriteAheadLogging(); Loading @@ -86,6 +87,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { assertEquals(pool, mDatabase.mConnectionPool); } @Suppress @SmallTest public void testDisableWriteAheadLogging() { mDatabase.execSQL("create table test (i int);"); Loading @@ -102,6 +104,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { assertFalse(db.isOpen()); } @Suppress @SmallTest public void testCursorsWithClosedDbConnAfterDisableWriteAheadLogging() { mDatabase.disableWriteAheadLogging(); Loading Loading @@ -138,6 +141,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { /** * a transaction should be started before a standalone-update/insert/delete statement */ @Suppress @SmallTest public void testStartXactBeforeUpdateSql() throws InterruptedException { runTestForStartXactBeforeUpdateSql(INSERT); Loading Loading @@ -749,6 +753,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { * * @throws InterruptedException */ @Suppress @SmallTest public void testTransactionAndWalInterplay1() throws InterruptedException { createTableAndClearCache(); Loading Loading @@ -807,6 +812,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { * instead of mDatabase.beginTransactionNonExclusive(), use execSQL("BEGIN transaction") * and instead of mDatabase.endTransaction(), use execSQL("END"); */ @Suppress @SmallTest public void testTransactionAndWalInterplay2() throws InterruptedException { createTableAndClearCache(); Loading Loading @@ -863,6 +869,7 @@ public class SQLiteDatabaseTest extends AndroidTestCase { * instead of committing the data, do rollback and make sure the data seen by the query * within the transaction is now gone. */ @Suppress @SmallTest public void testTransactionAndWalInterplay3() { createTableAndClearCache(); Loading