Home
last modified time | relevance | path

Searched refs:cursor (Results 1 – 25 of 86) sorted by relevance

1234

/cts/tests/tests/database/src/android/database/cts/
DMatrixCursor_RowBuilderTest.java34 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 …]
DDatabaseUtils_InsertHelperTest.java100 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 …]
DDatabaseUtilsTest.java118 Cursor cursor = mDatabase.query(TABLE_NAME, TEST_PROJECTION, in testBindObjectToProgram() local
120 assertNotNull(cursor); in testBindObjectToProgram()
121 assertEquals(0, cursor.getCount()); in testBindObjectToProgram()
131 cursor = mDatabase.query(TABLE_NAME, TEST_PROJECTION, null, null, null, null, null); in testBindObjectToProgram()
132 assertNotNull(cursor); in testBindObjectToProgram()
133 assertEquals(1, cursor.getCount()); in testBindObjectToProgram()
134 cursor.moveToFirst(); in testBindObjectToProgram()
135 assertEquals(name, cursor.getString(1)); in testBindObjectToProgram()
136 assertEquals(age, cursor.getInt(2)); in testBindObjectToProgram()
137 assertEquals(address, cursor.getString(3)); in testBindObjectToProgram()
[all …]
/cts/tests/tests/database/src/android/database/sqlite/cts/
DSQLiteDatabaseTest.java346 Cursor cursor = mDatabase.query("test", TEST_PROJECTION, null, null, null, null, null); in testCompileStatement() local
347 assertNotNull(cursor); in testCompileStatement()
348 assertEquals(0, cursor.getCount()); in testCompileStatement()
357 cursor.close(); in testCompileStatement()
359 cursor = mDatabase.query("test", TEST_PROJECTION, null, null, null, null, null); in testCompileStatement()
360 assertNotNull(cursor); in testCompileStatement()
361 assertEquals(1, cursor.getCount()); in testCompileStatement()
362 cursor.moveToNext(); in testCompileStatement()
363 assertEquals(name, cursor.getString(COLUMN_NAME_INDEX)); in testCompileStatement()
364 assertEquals(age, cursor.getInt(COLUMN_AGE_INDEX)); in testCompileStatement()
[all …]
DSQLiteCursorTest.java75 SQLiteCursor cursor = getCursor(); in testConstructor() local
76 assertNotNull(cursor); in testConstructor()
80 SQLiteCursor cursor = getCursor(); in testClose() local
81 assertTrue(cursor.moveToFirst()); in testClose()
82 assertFalse(cursor.isClosed()); in testClose()
83 assertTrue(cursor.requery()); in testClose()
84 cursor.close(); in testClose()
85 assertFalse(cursor.requery()); in testClose()
87 cursor.moveToFirst(); in testClose()
91 assertTrue(cursor.isClosed()); in testClose()
[all …]
DSQLiteProgramTest.java90 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 …]
DSQLiteFtsTest.java64 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 …]
DSQLiteQueryBuilderTest.java135 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/provider/src/android/provider/cts/contacts/
DContacts_PeopleTest.java115 Cursor cursor; in testAddToGroup() local
123 cursor = mProvider.query(mPeopleRowsAdded.get(0), PEOPLE_PROJECTION, in testAddToGroup()
125 cursor.moveToFirst(); in testAddToGroup()
126 int personId = cursor.getInt(PEOPLE_ID_INDEX); in testAddToGroup()
127 cursor.close(); in testAddToGroup()
129 cursor = mProvider.query(Groups.CONTENT_URI, GROUPS_PROJECTION, in testAddToGroup()
131 assertTrue(cursor.moveToFirst()); in testAddToGroup()
132 int groupId = cursor.getInt(GROUPS_ID_INDEX); in testAddToGroup()
133 cursor.close(); in testAddToGroup()
134 cursor = People.queryGroups(mContentResolver, personId); in testAddToGroup()
[all …]
DContactsTest.java100 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 …]
DCommonDatabaseUtils.java35 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 …]
DVoicemailContractTest.java165 Cursor cursor = mVoicemailProvider.query( in testVoicemailsTable() local
169 assertTrue(cursor.moveToNext()); in testVoicemailsTable()
170 assertEquals(insertCallsNumber, cursor.getString(NUMBER_INDEX)); in testVoicemailsTable()
171 assertEquals(insertDate, cursor.getLong(DATE_INDEX)); in testVoicemailsTable()
172 assertEquals(insertCallsDuration, cursor.getLong(DURATION_INDEX)); in testVoicemailsTable()
173 assertEquals(mSourcePackageName, cursor.getString(SOURCE_PACKAGE_INDEX)); in testVoicemailsTable()
174 assertEquals(insertSourceData, cursor.getString(SOURCE_DATA_INDEX)); in testVoicemailsTable()
175 assertEquals(insertMimeType, cursor.getString(MIME_TYPE_INDEX)); in testVoicemailsTable()
176 assertEquals(0, cursor.getInt(NEW_INDEX)); in testVoicemailsTable()
177 assertEquals(0, cursor.getInt(IS_READ_INDEX)); in testVoicemailsTable()
[all …]
DDeletedContactUtil.java40 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 …]
DContactsContract_AggregationSuggestionsTest.java67 Cursor cursor = mResolver.query(uri, TEST_PROJECTION, null, null, null); in testAggregationSuggestionsByNameReversed() local
70 assertEquals(1, cursor.getCount()); in testAggregationSuggestionsByNameReversed()
71 cursor.moveToFirst(); in testAggregationSuggestionsByNameReversed()
75 DatabaseAsserts.assertCursorValuesMatchExactly(cursor, values); in testAggregationSuggestionsByNameReversed()
76 cursor.close(); in testAggregationSuggestionsByNameReversed()
89 Cursor cursor = mResolver.query(uri, TEST_PROJECTION, null, null, null); in testAggregationSuggestionsByName() local
92 assertEquals(1, cursor.getCount()); in testAggregationSuggestionsByName()
93 cursor.moveToFirst(); in testAggregationSuggestionsByName()
97 DatabaseAsserts.assertCursorValuesMatchExactly(cursor, values); in testAggregationSuggestionsByName()
98 cursor.close(); in testAggregationSuggestionsByName()
[all …]
DDatabaseAsserts.java169 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 …]
DContactsContract_ProviderStatus.java68 Cursor cursor = mResolver.query(ProviderStatus.CONTENT_URI, null, null, null, null); in testProviderStatus_addedContacts() local
72 assertEquals(1, cursor.getCount()); in testProviderStatus_addedContacts()
73 cursor.moveToFirst(); in testProviderStatus_addedContacts()
76 DatabaseAsserts.assertCursorValuesMatchExactly(cursor, values); in testProviderStatus_addedContacts()
78 if (cursor != null) { in testProviderStatus_addedContacts()
79 cursor.close(); in testProviderStatus_addedContacts()
/cts/tests/app/src/android/app/cts/
DDownloadManagerTest.java199 Cursor cursor = null; in testMinimumDownload() local
201 cursor = mDownloadManager.query(new Query().setFilterById(id)); in testMinimumDownload()
202 assertTrue(cursor.moveToNext()); in testMinimumDownload()
203 assertEquals(DownloadManager.STATUS_SUCCESSFUL, cursor.getInt( in testMinimumDownload()
204 cursor.getColumnIndex(DownloadManager.COLUMN_STATUS))); in testMinimumDownload()
205 assertEquals(MINIMUM_DOWNLOAD_BYTES, cursor.getInt( in testMinimumDownload()
206 cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES))); in testMinimumDownload()
207 assertFalse(cursor.moveToNext()); in testMinimumDownload()
209 if (cursor != null) { in testMinimumDownload()
210 cursor.close(); in testMinimumDownload()
[all …]
/cts/tests/tests/tv/src/android/media/tv/cts/
DTvContractTest.java269 private static void verifyStringColumn(Cursor cursor, ContentValues expectedValues, in verifyStringColumn() argument
273 cursor.getString(cursor.getColumnIndex(columnName))); in verifyStringColumn()
277 private static void verifyIntegerColumn(Cursor cursor, ContentValues expectedValues, in verifyIntegerColumn() argument
281 cursor.getInt(cursor.getColumnIndex(columnName))); in verifyIntegerColumn()
285 private static void verifyLongColumn(Cursor cursor, ContentValues expectedValues, in verifyLongColumn() argument
289 cursor.getLong(cursor.getColumnIndex(columnName))); in verifyLongColumn()
293 private static void verifyBlobColumn(Cursor cursor, ContentValues expectedValues, in verifyBlobColumn() argument
297 byte[] actual = cursor.getBlob(cursor.getColumnIndex(columnName)); in verifyBlobColumn()
311 try (Cursor cursor = mContentResolver.query( in verifyChannel() argument
313 assertNotNull(cursor); in verifyChannel()
[all …]
/cts/tests/tests/content/src/android/content/cts/
DAsyncQueryHandlerTest.java130 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/tests/tests/provider/src/android/provider/cts/
DSearchRecentSuggestionsTest.java141 Cursor cursor = mTestSRSProvider.query(mTestUri, in testSuggestionsTable() local
145 assertNotNull(cursor); in testSuggestionsTable()
146 assertEquals(1, cursor.getCount()); in testSuggestionsTable()
147 assertTrue(cursor.moveToFirst()); in testSuggestionsTable()
148 assertEquals(insertDisplay2, cursor in testSuggestionsTable()
150 assertEquals(insertQuery, cursor in testSuggestionsTable()
152 assertEquals(1, cursor.getInt(SearchRecentSuggestions.QUERIES_PROJECTION_DATE_INDEX)); in testSuggestionsTable()
153 cursor.close(); in testSuggestionsTable()
176 cursor = mTestSRSProvider.query(mTestUri, in testSuggestionsTable()
179 assertNotNull(cursor); in testSuggestionsTable()
[all …]
DSettingsTest.java57 Cursor cursor = null; in testSystemTable() local
66 cursor = provider.query(Settings.System.CONTENT_URI, SYSTEM_PROJECTION, in testSystemTable()
68 assertNotNull(cursor); in testSystemTable()
69 assertEquals(1, cursor.getCount()); in testSystemTable()
70 assertTrue(cursor.moveToFirst()); in testSystemTable()
71 assertEquals(name, cursor.getString(NAME_INDEX)); in testSystemTable()
72 assertEquals(insertValue, cursor.getString(VALUE_INDEX)); in testSystemTable()
73 cursor.close(); in testSystemTable()
74 cursor = null; in testSystemTable()
83 cursor = provider.query(Settings.System.CONTENT_URI, SYSTEM_PROJECTION, in testSystemTable()
[all …]
/cts/tests/tests/carrierapi/src/android/carrierapi/cts/
DApnDatabaseTest.java138 Cursor cursor = mContentResolver.query( in testValidCase() local
142 assertNotNull("Failed to query the table", cursor); in testValidCase()
144 1, cursor.getCount()); in testValidCase()
145 cursor.moveToFirst(); in testValidCase()
149 cursor.getString(cursor.getColumnIndex(entry.getKey())), entry.getValue()); in testValidCase()
161 cursor = mContentResolver.query(uri, apnProjection, selection, selectionArgs, null); in testValidCase()
162 assertNotNull("Failed to query the table", cursor); in testValidCase()
163 assertEquals("Unexpected number of APNs returned by cursor", 1, cursor.getCount()); in testValidCase()
164 cursor.moveToFirst(); in testValidCase()
166 cursor.getString(cursor.getColumnIndex(Carriers.APN)), newApn); in testValidCase()
[all …]
/cts/tests/tests/widget/src/android/widget/cts/
DResourceCursorTreeAdapterTest.java89 Cursor cursor = createTestCursor(3, 3); in testConstructor() local
90 mResourceCursorTreeAdapter = new MockResourceCursorTreeAdapter(mContext, cursor, in testConstructor()
92 assertEquals(cursor, mResourceCursorTreeAdapter.getCursor()); in testConstructor()
168 MatrixCursor cursor = new MatrixCursor(columns, rowCount); in createTestCursor() local
175 cursor.addRow(row); in createTestCursor()
177 return cursor; in createTestCursor()
181 public MockResourceCursorTreeAdapter(Context context, Cursor cursor, in MockResourceCursorTreeAdapter() argument
184 super(context, cursor, collapsedGroupLayout, expandedGroupLayout, childLayout, in MockResourceCursorTreeAdapter()
188 public MockResourceCursorTreeAdapter(Context context, Cursor cursor, in MockResourceCursorTreeAdapter() argument
190 super(context, cursor, collapsedGroupLayout, expandedGroupLayout, childLayout); in MockResourceCursorTreeAdapter()
[all …]
/cts/tests/tests/provider/src/android/provider/cts/contacts/account/
DContactsContract_Subquery.java56 try (Cursor cursor = mResolver.query(Contacts.CONTENT_URI, null, null, null, null)) { in testProviderStatus_addedContacts() argument
57 allCount = cursor.getCount(); in testProviderStatus_addedContacts()
61 try (Cursor cursor = mResolver.query(Contacts.CONTENT_URI, null, in testProviderStatus_addedContacts() argument
63 assertEquals(allCount, cursor.getCount()); in testProviderStatus_addedContacts()
67 try (Cursor cursor = mResolver.query(Contacts.CONTENT_URI, null, in testProviderStatus_addedContacts() argument
69 assertEquals(0, cursor.getCount()); in testProviderStatus_addedContacts()
/cts/hostsidetests/appsecurity/test-apps/AppWithData/src/com/android/cts/appwithdata/
DCreatePrivateDataTest.java117 Cursor cursor = null; in writeToDatabase() local
124 cursor = db.query(DB_TABLE_NAME, new String[] {DB_COLUMN}, in writeToDatabase()
126 assertEquals(1, cursor.getCount()); in writeToDatabase()
128 if (cursor != null) { in writeToDatabase()
129 cursor.close(); in writeToDatabase()
155 Cursor cursor = null; in assertDatabaseDataDoesNotExist() local
158 cursor = db.query(DB_TABLE_NAME, new String[] {DB_COLUMN}, in assertDatabaseDataDoesNotExist()
160 assertEquals(0, cursor.getCount()); in assertDatabaseDataDoesNotExist()
162 if (cursor != null) { in assertDatabaseDataDoesNotExist()
163 cursor.close(); in assertDatabaseDataDoesNotExist()

1234