/cts/tests/tests/database/src/android/database/sqlite/cts/ |
D | SQLiteDatabaseTest.java | 334 Cursor cursor = mDatabase.query("test", TEST_PROJECTION, null, null, null, null, null); in testCompileStatement() local 335 assertNotNull(cursor); in testCompileStatement() 336 assertEquals(0, cursor.getCount()); in testCompileStatement() 345 cursor.close(); in testCompileStatement() 347 cursor = mDatabase.query("test", TEST_PROJECTION, null, null, null, null, null); in testCompileStatement() 348 assertNotNull(cursor); in testCompileStatement() 349 assertEquals(1, cursor.getCount()); in testCompileStatement() 350 cursor.moveToNext(); in testCompileStatement() 351 assertEquals(name, cursor.getString(COLUMN_NAME_INDEX)); in testCompileStatement() 352 assertEquals(age, cursor.getInt(COLUMN_AGE_INDEX)); in testCompileStatement() [all …]
|
D | SQLiteCursorTest.java | 72 SQLiteCursor cursor = getCursor(); in testConstructor() local 73 assertNotNull(cursor); in testConstructor() 77 SQLiteCursor cursor = getCursor(); in testClose() local 78 assertTrue(cursor.moveToFirst()); in testClose() 79 assertFalse(cursor.isClosed()); in testClose() 80 assertTrue(cursor.requery()); in testClose() 81 cursor.close(); in testClose() 82 assertFalse(cursor.requery()); in testClose() 84 cursor.moveToFirst(); in testClose() 88 assertTrue(cursor.isClosed()); in testClose() [all …]
|
D | SQLiteProgramTest.java | 90 Cursor cursor = null; in testBind() local 92 cursor = mDatabase.query("test", new String[]{"text1"}, "where text1='a'", in testBind() 98 if (cursor != null) { in testBind() 99 cursor.close(); in testBind() 103 cursor = mDatabase.query("test", new String[]{"text1"}, "where text1='a'", in testBind() 109 if (cursor != null) { in testBind() 110 cursor.close(); in testBind() 140 Cursor cursor = mDatabase.query("test", new String[] { "text1", "text2", "num1", "image" }, in testBindNull() local 142 assertNotNull(cursor); in testBindNull() 143 assertEquals(1, cursor.getCount()); in testBindNull() [all …]
|
D | SQLiteFtsTest.java | 64 final Cursor cursor = queryFtsTable(TEST_TABLE, "technology"); in testFts3Porter() local 66 assertEquals(2, cursor.getCount()); in testFts3Porter() 67 cursor.moveToPosition(0); in testFts3Porter() 68 assertTrue(cursor.getString(0).contains(">TECHnology<")); in testFts3Porter() 69 cursor.moveToPosition(1); in testFts3Porter() 70 assertTrue(cursor.getString(0).contains(">technologies<")); in testFts3Porter() 72 cursor.close(); in testFts3Porter() 80 final Cursor cursor = queryFtsTable(TEST_TABLE, "technology"); in testFts3Simple() local 82 assertEquals(1, cursor.getCount()); in testFts3Simple() 83 cursor.moveToPosition(0); in testFts3Simple() [all …]
|
D | SQLiteQueryBuilderTest.java | 135 Cursor cursor = sqliteQueryBuilder.query(mDatabase, new String[] { "name", "age" }, in testSetCursorFactory() local 137 assertNotNull(cursor); in testSetCursorFactory() 138 assertTrue(cursor instanceof SQLiteCursor); in testSetCursorFactory() 148 cursor = sqliteQueryBuilder.query(mDatabase, new String[] { "name", "age" }, in testSetCursorFactory() 150 assertNotNull(cursor); in testSetCursorFactory() 151 assertTrue(cursor instanceof MockCursor); in testSetCursorFactory() 209 Cursor cursor = sqliteQueryBuilder.query(mDatabase, in testQuery() local 212 assertNotNull(cursor); in testQuery() 213 assertEquals(3, cursor.getCount()); in testQuery() 217 cursor.moveToFirst(); in testQuery() [all …]
|
/cts/tests/tests/database/src/android/database/cts/ |
D | MatrixCursor_RowBuilderTest.java | 34 MatrixCursor cursor = new MatrixCursor(new String[] { "column0", "column1", "column2" }); in testAdd() local 35 assertEquals(0, cursor.getCount()); in testAdd() 36 RowBuilder builder = cursor.newRow(); in testAdd() 38 assertEquals(1, cursor.getCount()); in testAdd() 39 cursor.moveToFirst(); in testAdd() 40 assertTrue(cursor.isNull(COLUMN0_INDEX)); in testAdd() 41 assertTrue(cursor.isNull(COLUMN1_INDEX)); in testAdd() 42 assertTrue(cursor.isNull(COLUMN2_INDEX)); in testAdd() 45 assertFalse(cursor.isNull(COLUMN0_INDEX)); in testAdd() 46 assertEquals(Integer.MIN_VALUE, cursor.getInt(COLUMN0_INDEX)); in testAdd() [all …]
|
D | DatabaseUtils_InsertHelperTest.java | 100 Cursor cursor = mDatabase.query(TEST_TABLE_NAME, projection, null, null, null, null, null); in testInsert() local 101 assertNotNull(cursor); in testInsert() 102 assertEquals(0, cursor.getCount()); in testInsert() 103 cursor.close(); in testInsert() 125 cursor = mDatabase.query(TEST_TABLE_NAME, projection, null, null, null, null, null); in testInsert() 126 assertNotNull(cursor); in testInsert() 127 assertEquals(1, cursor.getCount()); in testInsert() 128 cursor.moveToFirst(); in testInsert() 129 assertEquals(1, cursor.getInt(booleanValueIndex)); in testInsert() 130 assertEquals(10, cursor.getInt(intValueIndex)); in testInsert() [all …]
|
D | DatabaseUtilsTest.java | 116 Cursor cursor = mDatabase.query(TABLE_NAME, TEST_PROJECTION, in testBindObjectToProgram() local 118 assertNotNull(cursor); in testBindObjectToProgram() 119 assertEquals(0, cursor.getCount()); in testBindObjectToProgram() 129 cursor = mDatabase.query(TABLE_NAME, TEST_PROJECTION, null, null, null, null, null); in testBindObjectToProgram() 130 assertNotNull(cursor); in testBindObjectToProgram() 131 assertEquals(1, cursor.getCount()); in testBindObjectToProgram() 132 cursor.moveToFirst(); in testBindObjectToProgram() 133 assertEquals(name, cursor.getString(1)); in testBindObjectToProgram() 134 assertEquals(age, cursor.getInt(2)); in testBindObjectToProgram() 135 assertEquals(address, cursor.getString(3)); in testBindObjectToProgram() [all …]
|
/cts/tests/tests/provider/src/android/provider/cts/ |
D | Contacts_PeopleTest.java | 113 Cursor cursor; in testAddToGroup() local 121 cursor = mProvider.query(mPeopleRowsAdded.get(0), PEOPLE_PROJECTION, in testAddToGroup() 123 cursor.moveToFirst(); in testAddToGroup() 124 int personId = cursor.getInt(PEOPLE_ID_INDEX); in testAddToGroup() 125 cursor.close(); in testAddToGroup() 127 cursor = mProvider.query(Groups.CONTENT_URI, GROUPS_PROJECTION, in testAddToGroup() 129 assertTrue(cursor.moveToFirst()); in testAddToGroup() 130 int groupId = cursor.getInt(GROUPS_ID_INDEX); in testAddToGroup() 131 cursor.close(); in testAddToGroup() 132 cursor = People.queryGroups(mContentResolver, personId); in testAddToGroup() [all …]
|
D | ContactsTest.java | 100 Cursor cursor = mProvider.query(People.CONTENT_URI, in testPeopleTable() local 103 assertTrue(cursor.moveToNext()); in testPeopleTable() 104 assertEquals(insertPeopleName, cursor.getString(NAME_INDEX)); in testPeopleTable() 105 assertEquals(insertPeopleNotes, cursor.getString(NOTES_INDEX)); in testPeopleTable() 106 assertEquals(0, cursor.getInt(LAST_TIME_CONTACTED_INDEX)); in testPeopleTable() 107 assertNull(cursor.getString(CUSTOM_RINGTONE_INDEX)); in testPeopleTable() 108 assertEquals(1, cursor.getInt(SEND_TO_VOICEMAIL_INDEX)); in testPeopleTable() 109 assertEquals(0, cursor.getInt(TIMES_CONTACTED_INDEX)); in testPeopleTable() 110 assertEquals(0, cursor.getInt(STARRED_INDEX)); in testPeopleTable() 112 int id = cursor.getInt(ID_INDEX); in testPeopleTable() [all …]
|
D | VoicemailContractTest.java | 100 Cursor cursor = mVoicemailProvider.query( in testVoicemailsTable() local 104 assertTrue(cursor.moveToNext()); in testVoicemailsTable() 105 assertEquals(insertCallsNumber, cursor.getString(NUMBER_INDEX)); in testVoicemailsTable() 106 assertEquals(insertDate, cursor.getLong(DATE_INDEX)); in testVoicemailsTable() 107 assertEquals(insertCallsDuration, cursor.getLong(DURATION_INDEX)); in testVoicemailsTable() 108 assertEquals(mSourcePackageName, cursor.getString(SOURCE_PACKAGE_INDEX)); in testVoicemailsTable() 109 assertEquals(insertSourceData, cursor.getString(SOURCE_DATA_INDEX)); in testVoicemailsTable() 110 assertEquals(insertMimeType, cursor.getString(MIME_TYPE_INDEX)); in testVoicemailsTable() 111 assertEquals(0, cursor.getInt(IS_READ_INDEX)); in testVoicemailsTable() 112 assertEquals(1, cursor.getInt(HAS_CONTENT_INDEX)); in testVoicemailsTable() [all …]
|
D | SettingsTest.java | 48 Cursor cursor = null; in testSystemTable() local 57 cursor = provider.query(Settings.System.CONTENT_URI, SYSTEM_PROJECTION, in testSystemTable() 59 assertNotNull(cursor); in testSystemTable() 60 assertEquals(1, cursor.getCount()); in testSystemTable() 61 assertTrue(cursor.moveToFirst()); in testSystemTable() 62 assertEquals(name, cursor.getString(NAME_INDEX)); in testSystemTable() 63 assertEquals(insertValue, cursor.getString(VALUE_INDEX)); in testSystemTable() 64 cursor.close(); in testSystemTable() 65 cursor = null; in testSystemTable() 74 cursor = provider.query(Settings.System.CONTENT_URI, SYSTEM_PROJECTION, in testSystemTable() [all …]
|
D | UserDictionary_WordsTest.java | 69 Cursor cursor = mContentResolver.query(UserDictionary.Words.CONTENT_URI, WORDS_PROJECTION, in testAddWord_deprecated() local 71 assertTrue(cursor.moveToFirst()); in testAddWord_deprecated() 73 cursor.getString(ID_INDEX))); in testAddWord_deprecated() 75 assertEquals(1, cursor.getCount()); in testAddWord_deprecated() 76 assertEquals(word, cursor.getString(WORD_INDEX)); in testAddWord_deprecated() 77 assertEquals(frequency, cursor.getInt(FREQUENCY_INDEX)); in testAddWord_deprecated() 78 assertNull(cursor.getString(LOCALE_INDEX)); in testAddWord_deprecated() 79 cursor.close(); in testAddWord_deprecated() 93 Cursor cursor = mContentResolver.query(UserDictionary.Words.CONTENT_URI, WORDS_PROJECTION, in assertWord() local 95 assertTrue(cursor.moveToFirst()); in assertWord() [all …]
|
D | ContactsContract_AggregationSuggestionsTest.java | 68 Cursor cursor = mResolver.query(uri, TEST_PROJECTION, null, null, null); in testAggregationSuggestionsByNameReversed() local 71 assertEquals(1, cursor.getCount()); in testAggregationSuggestionsByNameReversed() 72 cursor.moveToFirst(); in testAggregationSuggestionsByNameReversed() 76 DatabaseAsserts.assertCursorValuesMatchExactly(cursor, values); in testAggregationSuggestionsByNameReversed() 77 cursor.close(); in testAggregationSuggestionsByNameReversed() 90 Cursor cursor = mResolver.query(uri, TEST_PROJECTION, null, null, null); in testAggregationSuggestionsByName() local 93 assertEquals(1, cursor.getCount()); in testAggregationSuggestionsByName() 94 cursor.moveToFirst(); in testAggregationSuggestionsByName() 98 DatabaseAsserts.assertCursorValuesMatchExactly(cursor, values); in testAggregationSuggestionsByName() 99 cursor.close(); in testAggregationSuggestionsByName() [all …]
|
D | SearchRecentSuggestionsTest.java | 140 Cursor cursor = mTestSRSProvider.query(mTestUri, in testSuggestionsTable() local 144 assertNotNull(cursor); in testSuggestionsTable() 145 assertEquals(1, cursor.getCount()); in testSuggestionsTable() 146 assertTrue(cursor.moveToFirst()); in testSuggestionsTable() 147 assertEquals(insertDisplay2, cursor in testSuggestionsTable() 149 assertEquals(insertQuery, cursor in testSuggestionsTable() 151 assertEquals(1, cursor.getInt(SearchRecentSuggestions.QUERIES_PROJECTION_DATE_INDEX)); in testSuggestionsTable() 152 cursor.close(); in testSuggestionsTable() 175 cursor = mTestSRSProvider.query(mTestUri, in testSuggestionsTable() 178 assertNotNull(cursor); in testSuggestionsTable() [all …]
|
D | ContactsContract_ProviderStatus.java | 69 Cursor cursor = mResolver.query(ProviderStatus.CONTENT_URI, null, null, null, null); in testProviderStatus_addedContacts() local 73 assertEquals(1, cursor.getCount()); in testProviderStatus_addedContacts() 74 cursor.moveToFirst(); in testProviderStatus_addedContacts() 77 DatabaseAsserts.assertCursorValuesMatchExactly(cursor, values); in testProviderStatus_addedContacts() 79 if (cursor != null) { in testProviderStatus_addedContacts() 80 cursor.close(); in testProviderStatus_addedContacts()
|
/cts/tests/tests/provider/src/android/provider/cts/contacts/ |
D | CommonDatabaseUtils.java | 35 public static String[] singleRecordToArray(Cursor cursor) { in singleRecordToArray() argument 38 if (cursor.moveToNext()) { in singleRecordToArray() 39 result = new String[cursor.getColumnCount()]; in singleRecordToArray() 40 fillArray(cursor, result); in singleRecordToArray() 43 closeQuietly(cursor); in singleRecordToArray() 48 public static List<String[]> multiRecordToArray(Cursor cursor) { in multiRecordToArray() argument 51 while (cursor.moveToNext()) { in multiRecordToArray() 52 String[] record = new String[cursor.getColumnCount()]; in multiRecordToArray() 53 fillArray(cursor, record); in multiRecordToArray() 57 closeQuietly(cursor); in multiRecordToArray() [all …]
|
D | DeletedContactUtil.java | 40 Cursor cursor = resolver.query(uri, projection, null, null, null); in queryDeletedTimestampForContactId() local 41 if (null != cursor) { in queryDeletedTimestampForContactId() 43 if (cursor.moveToNext()) { in queryDeletedTimestampForContactId() 44 deletedTime = cursor.getLong(0); in queryDeletedTimestampForContactId() 45 cursor.close(); in queryDeletedTimestampForContactId() 56 Cursor cursor = resolver.query(URI, projection, null, null, null); in getCount() local 58 return cursor.getCount(); in getCount() 60 CommonDatabaseUtils.closeQuietly(cursor); in getCount() 70 Cursor cursor = resolver.query(URI, projection, null, null, null); in query() local 71 return CommonDatabaseUtils.multiRecordToArray(cursor); in query() [all …]
|
D | DatabaseAsserts.java | 169 final Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder); in assertStoredValuesInUriMatchExactly() local 172 assertCursorValuesMatchExactlyInOrder(cursor, expectedValues); in assertStoredValuesInUriMatchExactly() 174 assertCursorValuesMatchExactly(cursor, expectedValues); in assertStoredValuesInUriMatchExactly() 177 cursor.close(); in assertStoredValuesInUriMatchExactly() 190 public static void assertCursorValuesMatchExactly(Cursor cursor, in assertCursorValuesMatchExactly() argument 193 expectedValues.length, cursor.getCount()); in assertCursorValuesMatchExactly() 197 final BitSet used = new BitSet(cursor.getCount()); in assertCursorValuesMatchExactly() 201 cursor.moveToPosition(-1); in assertCursorValuesMatchExactly() 202 while (cursor.moveToNext()) { in assertCursorValuesMatchExactly() 203 final int pos = cursor.getPosition(); in assertCursorValuesMatchExactly() [all …]
|
/cts/tests/tests/app/src/android/app/cts/ |
D | DownloadManagerTest.java | 183 Cursor cursor = null; in testMinimumDownload() local 185 cursor = mDownloadManager.query(new Query().setFilterById(id)); in testMinimumDownload() 186 assertTrue(cursor.moveToNext()); in testMinimumDownload() 187 assertEquals(DownloadManager.STATUS_SUCCESSFUL, cursor.getInt( in testMinimumDownload() 188 cursor.getColumnIndex(DownloadManager.COLUMN_STATUS))); in testMinimumDownload() 189 assertEquals(MINIMUM_DOWNLOAD_BYTES, cursor.getInt( in testMinimumDownload() 190 cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES))); in testMinimumDownload() 191 assertFalse(cursor.moveToNext()); in testMinimumDownload() 193 if (cursor != null) { in testMinimumDownload() 194 cursor.close(); in testMinimumDownload() [all …]
|
/cts/tests/tests/tv/src/android/media/tv/cts/ |
D | TvContractTest.java | 118 try (Cursor cursor = mContentResolver.query(mChannelsUri, projection, null, null, null)) { in tearDown() argument 119 while (cursor != null && cursor.moveToNext()) { in tearDown() 120 long channelId = cursor.getLong(0); in tearDown() 154 private static void verifyStringColumn(Cursor cursor, ContentValues expectedValues, in verifyStringColumn() argument 158 cursor.getString(cursor.getColumnIndex(columnName))); in verifyStringColumn() 162 private static void verifyIntegerColumn(Cursor cursor, ContentValues expectedValues, in verifyIntegerColumn() argument 166 cursor.getInt(cursor.getColumnIndex(columnName))); in verifyIntegerColumn() 170 private static void verifyLongColumn(Cursor cursor, ContentValues expectedValues, in verifyLongColumn() argument 174 cursor.getLong(cursor.getColumnIndex(columnName))); in verifyLongColumn() 178 private static void verifyBlobColumn(Cursor cursor, ContentValues expectedValues, in verifyBlobColumn() argument [all …]
|
/cts/tests/tests/content/src/android/content/cts/ |
D | AsyncQueryHandlerTest.java | 130 Cursor cursor = null; in testStartInsert() local 132 cursor = mResolver.query(DummyProvider.CONTENT_URI, PROJECTIONS, null, null, ORDER_BY); in testStartInsert() 133 assertEquals(ORIGINAL_ROW_COUNT + 1, cursor.getCount()); in testStartInsert() 134 cursor.moveToLast(); in testStartInsert() 135 assertEquals(NAME3, cursor.getString(NAME_COLUMN_INDEX)); in testStartInsert() 137 if (cursor != null) { in testStartInsert() 138 cursor.close(); in testStartInsert() 154 Cursor cursor = (Cursor) mAsyncHandler.getResult(); in testStartQuery() local 155 assertNotNull(cursor); in testStartQuery() 157 assertEquals(ORIGINAL_ROW_COUNT, cursor.getCount()); in testStartQuery() [all …]
|
/cts/apps/CtsVerifier/src/com/android/cts/verifier/ |
D | TestResultsBackupHelper.java | 54 Cursor cursor = null; in performBackup() local 56 cursor = resolver.query(TestResultsProvider.RESULTS_CONTENT_URI, in performBackup() 58 int nameIndex = cursor.getColumnIndex(TestResultsProvider.COLUMN_TEST_NAME); in performBackup() 59 int resultIndex = cursor.getColumnIndex(TestResultsProvider.COLUMN_TEST_RESULT); in performBackup() 60 int infoSeenIndex = cursor.getColumnIndex(TestResultsProvider.COLUMN_TEST_INFO_SEEN); in performBackup() 61 int detailsIndex = cursor.getColumnIndex(TestResultsProvider.COLUMN_TEST_DETAILS); in performBackup() 62 int metricsIndex = cursor.getColumnIndex(TestResultsProvider.COLUMN_TEST_METRICS); in performBackup() 67 dataOutput.writeInt(cursor.getCount()); in performBackup() 68 while (cursor.moveToNext()) { in performBackup() 69 String name = cursor.getString(nameIndex); in performBackup() [all …]
|
/cts/tests/tests/calllog/src/android/calllog/cts/ |
D | CallLogBackupTest.java | 235 Cursor cursor = resolver.query(Calls.CONTENT_URI, CALL_LOG_PROJECTION, null, null, null); in getCalls() local 236 if (cursor != null) { in getCalls() 238 while (cursor.moveToNext()) { in getCalls() 240 call.id = cursor.getInt(cursor.getColumnIndex(Calls._ID)); in getCalls() 241 call.number = cursor.getString(cursor.getColumnIndex(Calls.NUMBER)); in getCalls() 242 call.date = cursor.getLong(cursor.getColumnIndex(Calls.DATE)); in getCalls() 243 call.duration = cursor.getLong(cursor.getColumnIndex(Calls.DURATION)); in getCalls() 244 call.type = cursor.getInt(cursor.getColumnIndex(Calls.TYPE)); in getCalls() 245 call.phoneAccountComponent = cursor.getString( in getCalls() 246 cursor.getColumnIndex(Calls.PHONE_ACCOUNT_COMPONENT_NAME)); in getCalls() [all …]
|
/cts/tests/tests/widget/src/android/widget/cts/ |
D | ResourceCursorTreeAdapterTest.java | 81 Cursor cursor = createTestCursor(3, 3); in testConstructor() local 82 mResourceCursorTreeAdapter = new MockResourceCursorTreeAdapter(mContext, cursor, in testConstructor() 84 assertEquals(cursor, mResourceCursorTreeAdapter.getCursor()); in testConstructor() 158 MatrixCursor cursor = new MatrixCursor(columns, rowCount); in createTestCursor() local 165 cursor.addRow(row); in createTestCursor() 167 return cursor; in createTestCursor() 171 public MockResourceCursorTreeAdapter(Context context, Cursor cursor, in MockResourceCursorTreeAdapter() argument 174 super(context, cursor, collapsedGroupLayout, expandedGroupLayout, childLayout, in MockResourceCursorTreeAdapter() 178 public MockResourceCursorTreeAdapter(Context context, Cursor cursor, in MockResourceCursorTreeAdapter() argument 180 super(context, cursor, collapsedGroupLayout, expandedGroupLayout, childLayout); in MockResourceCursorTreeAdapter() [all …]
|