--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/BrowserContractHelpers.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/BrowserContractHelpers.java
@@ -29,38 +29,38 @@ public class BrowserContractHelpers exte
.build();
}
public static final Uri BOOKMARKS_CONTENT_URI = withSyncAndDeletedAndProfile(Bookmarks.CONTENT_URI);
public static final Uri BOOKMARKS_PARENTS_CONTENT_URI = withSyncAndDeletedAndProfile(Bookmarks.PARENTS_CONTENT_URI);
public static final Uri BOOKMARKS_POSITIONS_CONTENT_URI = withSyncAndDeletedAndProfile(Bookmarks.POSITIONS_CONTENT_URI);
public static final Uri HISTORY_CONTENT_URI = withSyncAndDeletedAndProfile(History.CONTENT_URI);
public static final Uri SCHEMA_CONTENT_URI = withSyncAndDeletedAndProfile(Schema.CONTENT_URI);
- public static final Uri PASSWORDS_CONTENT_URI = withSyncAndDeletedAndProfile(Passwords.CONTENT_URI);
- public static final Uri DELETED_PASSWORDS_CONTENT_URI = withSyncAndDeletedAndProfile(DeletedPasswords.CONTENT_URI);
+ public static final Uri LOGINS_CONTENT_URI = withSyncAndDeletedAndProfile(Logins.CONTENT_URI);
+ public static final Uri DELETED_LOGINS_CONTENT_URI = withSyncAndDeletedAndProfile(DeletedLogins.CONTENT_URI);
public static final Uri FORM_HISTORY_CONTENT_URI = withSyncAndProfile(FormHistory.CONTENT_URI);
public static final Uri DELETED_FORM_HISTORY_CONTENT_URI = withSyncAndProfile(DeletedFormHistory.CONTENT_URI);
public static final Uri TABS_CONTENT_URI = withSyncAndProfile(Tabs.CONTENT_URI);
public static final Uri CLIENTS_CONTENT_URI = withSyncAndProfile(Clients.CONTENT_URI);
public static final String[] PasswordColumns = new String[] {
- Passwords.ID,
- Passwords.HOSTNAME,
- Passwords.HTTP_REALM,
- Passwords.FORM_SUBMIT_URL,
- Passwords.USERNAME_FIELD,
- Passwords.PASSWORD_FIELD,
- Passwords.ENCRYPTED_USERNAME,
- Passwords.ENCRYPTED_PASSWORD,
- Passwords.ENC_TYPE,
- Passwords.TIME_CREATED,
- Passwords.TIME_LAST_USED,
- Passwords.TIME_PASSWORD_CHANGED,
- Passwords.TIMES_USED,
- Passwords.GUID
+ Logins._ID,
+ Logins.HOSTNAME,
+ Logins.HTTP_REALM,
+ Logins.FORM_SUBMIT_URL,
+ Logins.USERNAME_FIELD,
+ Logins.PASSWORD_FIELD,
+ Logins.ENCRYPTED_USERNAME,
+ Logins.ENCRYPTED_PASSWORD,
+ Logins.ENC_TYPE,
+ Logins.TIME_CREATED,
+ Logins.TIME_LAST_USED,
+ Logins.TIME_PASSWORD_CHANGED,
+ Logins.TIMES_USED,
+ Logins.GUID
};
public static final String[] HistoryColumns = new String[] {
CommonColumns._ID,
SyncColumns.GUID,
SyncColumns.DATE_CREATED,
SyncColumns.DATE_MODIFIED,
SyncColumns.IS_DELETED,
@@ -92,19 +92,19 @@ public class BrowserContractHelpers exte
FormHistory.FIELD_NAME,
FormHistory.VALUE,
FormHistory.TIMES_USED,
FormHistory.FIRST_USED,
FormHistory.LAST_USED
};
public static final String[] DeletedColumns = new String[] {
- BrowserContract.DeletedColumns.ID,
- BrowserContract.DeletedColumns.GUID,
- BrowserContract.DeletedColumns.TIME_DELETED
+ BrowserContract.DeletedLogins._ID,
+ BrowserContract.DeletedLogins.GUID,
+ BrowserContract.DeletedLogins.TIME_DELETED
};
// Mapping from Sync types to Fennec types.
public static final String[] BOOKMARK_TYPE_CODE_TO_STRING = {
// Observe omissions: "microsummary", "item".
"folder", "bookmark", "separator", "livemark", "query"
};
private static final int MAX_BOOKMARK_TYPE_CODE = BOOKMARK_TYPE_CODE_TO_STRING.length - 1;
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/PasswordsRepositorySession.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/PasswordsRepositorySession.java
@@ -4,19 +4,18 @@
package org.mozilla.gecko.sync.repositories.android;
import java.util.ArrayList;
import java.util.List;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.db.BrowserContract;
-import org.mozilla.gecko.db.BrowserContract.DeletedColumns;
-import org.mozilla.gecko.db.BrowserContract.DeletedPasswords;
-import org.mozilla.gecko.db.BrowserContract.Passwords;
+import org.mozilla.gecko.db.BrowserContract.DeletedLogins;
+import org.mozilla.gecko.db.BrowserContract.Logins;
import org.mozilla.gecko.sync.repositories.InactiveSessionException;
import org.mozilla.gecko.sync.repositories.NoStoreDelegateException;
import org.mozilla.gecko.sync.repositories.NullCursorException;
import org.mozilla.gecko.sync.repositories.RecordFilter;
import org.mozilla.gecko.sync.repositories.Repository;
import org.mozilla.gecko.sync.repositories.StoreTrackingRepositorySession;
import org.mozilla.gecko.sync.repositories.android.RepoUtils.QueryHelper;
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionCreationDelegate;
@@ -29,16 +28,17 @@ import org.mozilla.gecko.sync.repositori
import android.content.ContentProviderClient;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.RemoteException;
+import android.util.Log;
public class PasswordsRepositorySession extends
StoreTrackingRepositorySession {
public static class PasswordsRepository extends Repository {
@Override
public void createSession(RepositorySessionCreationDelegate delegate,
Context context) {
@@ -55,26 +55,26 @@ public class PasswordsRepositorySession
private final RepoUtils.QueryHelper deletedPasswordsHelper;
private final ContentProviderClient passwordsProvider;
private final Context context;
public PasswordsRepositorySession(Repository repository, Context context) {
super(repository);
this.context = context;
- this.passwordsHelper = new QueryHelper(context, BrowserContractHelpers.PASSWORDS_CONTENT_URI, LOG_TAG);
- this.deletedPasswordsHelper = new QueryHelper(context, BrowserContractHelpers.DELETED_PASSWORDS_CONTENT_URI, LOG_TAG);
- this.passwordsProvider = context.getContentResolver().acquireContentProviderClient(BrowserContract.PASSWORDS_AUTHORITY_URI);
+ this.passwordsHelper = new QueryHelper(context, BrowserContractHelpers.LOGINS_CONTENT_URI, LOG_TAG);
+ this.deletedPasswordsHelper = new QueryHelper(context, BrowserContractHelpers.DELETED_LOGINS_CONTENT_URI, LOG_TAG);
+ this.passwordsProvider = context.getContentResolver().acquireContentProviderClient(BrowserContract.LOGINS_AUTHORITY_URI);
}
- private static final String[] GUID_COLS = new String[] { Passwords.GUID };
- private static final String[] DELETED_GUID_COLS = new String[] { DeletedColumns.GUID };
+ private static final String[] GUID_COLS = new String[] { Logins.GUID };
+ private static final String[] DELETED_GUID_COLS = new String[] { DeletedLogins.GUID };
- private static final String WHERE_GUID_IS = Passwords.GUID + " = ?";
- private static final String WHERE_DELETED_GUID_IS = DeletedPasswords.GUID + " = ?";
+ private static final String WHERE_GUID_IS = Logins.GUID + " = ?";
+ private static final String WHERE_DELETED_GUID_IS = DeletedLogins.GUID + " = ?";
@Override
public void guidsSince(final long timestamp, final RepositorySessionGuidsSinceDelegate delegate) {
final Runnable guidsSinceRunnable = new Runnable() {
@Override
public void run() {
if (!isActive()) {
@@ -85,31 +85,31 @@ public class PasswordsRepositorySession
// Checks succeeded, now get GUIDs.
final List<String> guids = new ArrayList<String>();
try {
Logger.debug(LOG_TAG, "Fetching guidsSince from data table.");
final Cursor data = passwordsHelper.safeQuery(passwordsProvider, ".getGUIDsSince", GUID_COLS, dateModifiedWhere(timestamp), null, null);
try {
if (data.moveToFirst()) {
while (!data.isAfterLast()) {
- guids.add(RepoUtils.getStringFromCursor(data, Passwords.GUID));
+ guids.add(RepoUtils.getStringFromCursor(data, Logins.GUID));
data.moveToNext();
}
}
} finally {
data.close();
}
// Fetch guids from deleted table.
Logger.debug(LOG_TAG, "Fetching guidsSince from deleted table.");
final Cursor deleted = deletedPasswordsHelper.safeQuery(passwordsProvider, ".getGUIDsSince", DELETED_GUID_COLS, dateModifiedWhereDeleted(timestamp), null, null);
try {
if (deleted.moveToFirst()) {
while (!deleted.isAfterLast()) {
- guids.add(RepoUtils.getStringFromCursor(deleted, DeletedColumns.GUID));
+ guids.add(RepoUtils.getStringFromCursor(deleted, DeletedLogins.GUID));
deleted.moveToNext();
}
}
} finally {
deleted.close();
}
} catch (Exception e) {
Logger.error(LOG_TAG, "Exception in fetch.");
@@ -396,30 +396,30 @@ public class PasswordsRepositorySession
return;
}
};
storeWorkQueue.execute(storeRunnable);
}
@Override
public void wipe(final RepositorySessionWipeDelegate delegate) {
- Logger.info(LOG_TAG, "Wiping " + BrowserContractHelpers.PASSWORDS_CONTENT_URI + ", " + BrowserContractHelpers.DELETED_PASSWORDS_CONTENT_URI);
+ Logger.info(LOG_TAG, "Wiping " + BrowserContractHelpers.LOGINS_CONTENT_URI + ", " + BrowserContractHelpers.DELETED_LOGINS_CONTENT_URI);
Runnable wipeRunnable = new Runnable() {
@Override
public void run() {
if (!isActive()) {
delegate.onWipeFailed(new InactiveSessionException(null));
return;
}
// Wipe both data and deleted.
try {
- context.getContentResolver().delete(BrowserContractHelpers.PASSWORDS_CONTENT_URI, null, null);
- context.getContentResolver().delete(BrowserContractHelpers.DELETED_PASSWORDS_CONTENT_URI, null, null);
+ context.getContentResolver().delete(BrowserContractHelpers.LOGINS_CONTENT_URI, null, null);
+ context.getContentResolver().delete(BrowserContractHelpers.DELETED_LOGINS_CONTENT_URI, null, null);
} catch (Exception e) {
delegate.onWipeFailed(e);
return;
}
delegate.onWipeSucceeded();
}
};
storeWorkQueue.execute(wipeRunnable);
@@ -435,18 +435,18 @@ public class PasswordsRepositorySession
public void finish(final RepositorySessionFinishDelegate delegate) throws InactiveSessionException {
passwordsProvider.release();
super.finish(delegate);
}
public void deleteGUID(String guid) throws RemoteException {
final String[] args = new String[] { guid };
- int deleted = passwordsProvider.delete(BrowserContractHelpers.PASSWORDS_CONTENT_URI, WHERE_GUID_IS, args) +
- passwordsProvider.delete(BrowserContractHelpers.DELETED_PASSWORDS_CONTENT_URI, WHERE_DELETED_GUID_IS, args);
+ int deleted = passwordsProvider.delete(BrowserContractHelpers.LOGINS_CONTENT_URI, WHERE_GUID_IS, args) +
+ passwordsProvider.delete(BrowserContractHelpers.DELETED_LOGINS_CONTENT_URI, WHERE_DELETED_GUID_IS, args);
if (deleted == 1) {
return;
}
Logger.warn(LOG_TAG, "Unexpectedly deleted " + deleted + " rows for guid " + guid);
}
/**
* Insert record and return the record with its updated androidId set.
@@ -456,17 +456,17 @@ public class PasswordsRepositorySession
* @throws RemoteException
*/
public PasswordRecord insert(PasswordRecord record) throws RemoteException {
record.timePasswordChanged = now();
// TODO: are these necessary for Fennec autocomplete?
// record.timesUsed = 1;
// record.timeLastUsed = now();
ContentValues cv = getContentValues(record);
- Uri insertedUri = passwordsProvider.insert(BrowserContractHelpers.PASSWORDS_CONTENT_URI, cv);
+ Uri insertedUri = passwordsProvider.insert(BrowserContractHelpers.LOGINS_CONTENT_URI, cv);
if (insertedUri == null) {
throw new RemoteException(); // Not much to be done here, save throw.
}
record.androidID = ContentUris.parseId(insertedUri);
return record;
}
public Record replace(Record origRecord, Record newRecord) throws RemoteException {
@@ -477,17 +477,17 @@ public class PasswordsRepositorySession
final String[] args = new String[] { origRecord.guid };
if (origRecord.deleted) {
// Purge from deleted table.
deleteGUID(origRecord.guid);
insert(newPasswordRecord);
} else {
- int updated = context.getContentResolver().update(BrowserContractHelpers.PASSWORDS_CONTENT_URI, cv, WHERE_GUID_IS, args);
+ int updated = context.getContentResolver().update(BrowserContractHelpers.LOGINS_CONTENT_URI, cv, WHERE_GUID_IS, args);
if (updated != 1) {
Logger.warn(LOG_TAG, "Unexpectedly updated " + updated + " rows for guid " + origPasswordRecord.guid);
}
}
return newRecord;
}
@@ -509,27 +509,27 @@ public class PasswordsRepositorySession
/**
* Constructs the DB query string for entry age for deleted records.
*
* @param timestamp
* @return String DB query string for dates to fetch.
*/
private static String dateModifiedWhereDeleted(long timestamp) {
- return DeletedColumns.TIME_DELETED + " >= " + Long.toString(timestamp);
+ return DeletedLogins.TIME_DELETED + " >= " + Long.toString(timestamp);
}
/**
* Constructs the DB query string for entry age for (undeleted) records.
*
* @param timestamp
* @return String DB query string for dates to fetch.
*/
private static String dateModifiedWhere(long timestamp) {
- return Passwords.TIME_PASSWORD_CHANGED + " >= " + Long.toString(timestamp);
+ return Logins.TIME_PASSWORD_CHANGED + " >= " + Long.toString(timestamp);
}
/**
* Fetch from the cursor with the given parameters, invoking
* delegate callbacks and closing the cursor.
* Returns true on success, false if failure was signaled.
*
@@ -593,21 +593,21 @@ public class PasswordsRepositorySession
} finally {
deleted.close();
}
return null;
}
private static final String WHERE_RECORD_DATA =
- Passwords.HOSTNAME + " = ? AND " +
- Passwords.HTTP_REALM + " = ? AND " +
- Passwords.FORM_SUBMIT_URL + " = ? AND " +
- Passwords.USERNAME_FIELD + " = ? AND " +
- Passwords.PASSWORD_FIELD + " = ?";
+ Logins.HOSTNAME + " = ? AND " +
+ Logins.HTTP_REALM + " = ? AND " +
+ Logins.FORM_SUBMIT_URL + " = ? AND " +
+ Logins.USERNAME_FIELD + " = ? AND " +
+ Logins.PASSWORD_FIELD + " = ?";
private PasswordRecord findExistingRecord(PasswordRecord record) throws NullCursorException, RemoteException {
PasswordRecord foundRecord = null;
Cursor cursor = null;
// Only check the data table.
// We can't encrypt username directly for query, so run a more general query and then filter.
final String[] whereArgs = new String[] {
record.hostname,
@@ -661,65 +661,65 @@ public class PasswordsRepositorySession
* true if creating a deleted Record, false if otherwise.
* @return
* PasswordRecord populated from Cursor.
*/
private static PasswordRecord passwordRecordFromCursor(Cursor cur) {
if (cur.isAfterLast()) {
return null;
}
- String guid = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.GUID);
- long lastModified = RepoUtils.getLongFromCursor(cur, BrowserContract.Passwords.TIME_PASSWORD_CHANGED);
+ String guid = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.GUID);
+ long lastModified = RepoUtils.getLongFromCursor(cur, BrowserContract.Logins.TIME_PASSWORD_CHANGED);
PasswordRecord rec = new PasswordRecord(guid, COLLECTION, lastModified, false);
- rec.id = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.ID);
- rec.hostname = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.HOSTNAME);
- rec.httpRealm = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.HTTP_REALM);
- rec.formSubmitURL = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.FORM_SUBMIT_URL);
- rec.usernameField = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.USERNAME_FIELD);
- rec.passwordField = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.PASSWORD_FIELD);
- rec.encType = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.ENC_TYPE);
+ rec.id = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins._ID);
+ rec.hostname = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.HOSTNAME);
+ rec.httpRealm = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.HTTP_REALM);
+ rec.formSubmitURL = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.FORM_SUBMIT_URL);
+ rec.usernameField = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.USERNAME_FIELD);
+ rec.passwordField = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.PASSWORD_FIELD);
+ rec.encType = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.ENC_TYPE);
// TODO decryption of username/password here (Bug 711636)
- rec.encryptedUsername = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.ENCRYPTED_USERNAME);
- rec.encryptedPassword = RepoUtils.getStringFromCursor(cur, BrowserContract.Passwords.ENCRYPTED_PASSWORD);
+ rec.encryptedUsername = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.ENCRYPTED_USERNAME);
+ rec.encryptedPassword = RepoUtils.getStringFromCursor(cur, BrowserContract.Logins.ENCRYPTED_PASSWORD);
- rec.timeCreated = RepoUtils.getLongFromCursor(cur, BrowserContract.Passwords.TIME_CREATED);
- rec.timeLastUsed = RepoUtils.getLongFromCursor(cur, BrowserContract.Passwords.TIME_LAST_USED);
- rec.timePasswordChanged = RepoUtils.getLongFromCursor(cur, BrowserContract.Passwords.TIME_PASSWORD_CHANGED);
- rec.timesUsed = RepoUtils.getLongFromCursor(cur, BrowserContract.Passwords.TIMES_USED);
+ rec.timeCreated = RepoUtils.getLongFromCursor(cur, BrowserContract.Logins.TIME_CREATED);
+ rec.timeLastUsed = RepoUtils.getLongFromCursor(cur, BrowserContract.Logins.TIME_LAST_USED);
+ rec.timePasswordChanged = RepoUtils.getLongFromCursor(cur, BrowserContract.Logins.TIME_PASSWORD_CHANGED);
+ rec.timesUsed = RepoUtils.getLongFromCursor(cur, BrowserContract.Logins.TIMES_USED);
return rec;
}
private static PasswordRecord deletedPasswordRecordFromCursor(Cursor cur) {
if (cur.isAfterLast()) {
return null;
}
- String guid = RepoUtils.getStringFromCursor(cur, DeletedColumns.GUID);
- long lastModified = RepoUtils.getLongFromCursor(cur, DeletedColumns.TIME_DELETED);
+ String guid = RepoUtils.getStringFromCursor(cur, DeletedLogins.GUID);
+ long lastModified = RepoUtils.getLongFromCursor(cur, DeletedLogins.TIME_DELETED);
PasswordRecord rec = new PasswordRecord(guid, COLLECTION, lastModified, true);
- rec.androidID = RepoUtils.getLongFromCursor(cur, DeletedColumns.ID);
+ rec.androidID = RepoUtils.getLongFromCursor(cur, DeletedLogins._ID);
return rec;
}
private static ContentValues getContentValues(Record record) {
PasswordRecord rec = (PasswordRecord) record;
ContentValues cv = new ContentValues();
- cv.put(BrowserContract.Passwords.GUID, rec.guid);
- cv.put(BrowserContract.Passwords.HOSTNAME, rec.hostname);
- cv.put(BrowserContract.Passwords.HTTP_REALM, rec.httpRealm);
- cv.put(BrowserContract.Passwords.FORM_SUBMIT_URL, rec.formSubmitURL);
- cv.put(BrowserContract.Passwords.USERNAME_FIELD, rec.usernameField);
- cv.put(BrowserContract.Passwords.PASSWORD_FIELD, rec.passwordField);
+ cv.put(BrowserContract.Logins.GUID, rec.guid);
+ cv.put(BrowserContract.Logins.HOSTNAME, rec.hostname);
+ cv.put(BrowserContract.Logins.HTTP_REALM, rec.httpRealm);
+ cv.put(BrowserContract.Logins.FORM_SUBMIT_URL, rec.formSubmitURL);
+ cv.put(BrowserContract.Logins.USERNAME_FIELD, rec.usernameField);
+ cv.put(BrowserContract.Logins.PASSWORD_FIELD, rec.passwordField);
// TODO Do encryption of username/password here. Bug 711636
- cv.put(BrowserContract.Passwords.ENC_TYPE, rec.encType);
- cv.put(BrowserContract.Passwords.ENCRYPTED_USERNAME, rec.encryptedUsername);
- cv.put(BrowserContract.Passwords.ENCRYPTED_PASSWORD, rec.encryptedPassword);
+ cv.put(BrowserContract.Logins.ENC_TYPE, rec.encType);
+ cv.put(BrowserContract.Logins.ENCRYPTED_USERNAME, rec.encryptedUsername);
+ cv.put(BrowserContract.Logins.ENCRYPTED_PASSWORD, rec.encryptedPassword);
- cv.put(BrowserContract.Passwords.TIME_CREATED, rec.timeCreated);
- cv.put(BrowserContract.Passwords.TIME_LAST_USED, rec.timeLastUsed);
- cv.put(BrowserContract.Passwords.TIME_PASSWORD_CHANGED, rec.timePasswordChanged);
- cv.put(BrowserContract.Passwords.TIMES_USED, rec.timesUsed);
+ cv.put(BrowserContract.Logins.TIME_CREATED, rec.timeCreated);
+ cv.put(BrowserContract.Logins.TIME_LAST_USED, rec.timeLastUsed);
+ cv.put(BrowserContract.Logins.TIME_PASSWORD_CHANGED, rec.timePasswordChanged);
+ cv.put(BrowserContract.Logins.TIMES_USED, rec.timesUsed);
return cv;
}
}
--- a/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/db/TestPasswordsRepository.java
+++ b/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/db/TestPasswordsRepository.java
@@ -337,23 +337,23 @@ public class TestPasswordsRepository ext
public void testRawFetch() throws RemoteException {
RepositorySession session = createAndBeginSession();
Record[] expected = new Record[] { PasswordHelpers.createPassword1(),
PasswordHelpers.createPassword2() };
performWait(storeRunnable(session, expected[0]));
performWait(storeRunnable(session, expected[1]));
- ContentProviderClient client = getApplicationContext().getContentResolver().acquireContentProviderClient(BrowserContract.PASSWORDS_AUTHORITY_URI);
- Cursor cursor = client.query(BrowserContractHelpers.PASSWORDS_CONTENT_URI, null, null, null, null);
+ ContentProviderClient client = getApplicationContext().getContentResolver().acquireContentProviderClient(BrowserContract.LOGINS_AUTHORITY_URI);
+ Cursor cursor = client.query(BrowserContractHelpers.LOGINS_CONTENT_URI, null, null, null, null);
assertEquals(2, cursor.getCount());
cursor.moveToFirst();
Set<String> guids = new HashSet<String>();
while (!cursor.isAfterLast()) {
- String guid = RepoUtils.getStringFromCursor(cursor, BrowserContract.Passwords.GUID);
+ String guid = RepoUtils.getStringFromCursor(cursor, BrowserContract.Logins.GUID);
guids.add(guid);
cursor.moveToNext();
}
cursor.close();
assertEquals(2, guids.size());
assertTrue(guids.contains(expected[0].guid));
assertTrue(guids.contains(expected[1].guid));
dispose(session);
@@ -383,29 +383,29 @@ public class TestPasswordsRepository ext
};
delegate.onSessionCreated(session);
}
};
}
private void wipe() {
Context context = getApplicationContext();
- context.getContentResolver().delete(BrowserContractHelpers.PASSWORDS_CONTENT_URI, null, null);
- context.getContentResolver().delete(BrowserContractHelpers.DELETED_PASSWORDS_CONTENT_URI, null, null);
+ context.getContentResolver().delete(BrowserContractHelpers.LOGINS_CONTENT_URI, null, null);
+ context.getContentResolver().delete(BrowserContractHelpers.DELETED_LOGINS_CONTENT_URI, null, null);
}
private void storeLocalDeletedRecord(Record record, long time) {
// Wipe data-store
wipe();
// Store record in deleted table.
ContentValues contentValues = new ContentValues();
contentValues.put(BrowserContract.DeletedColumns.GUID, record.guid);
contentValues.put(BrowserContract.DeletedColumns.TIME_DELETED, time);
contentValues.put(BrowserContract.DeletedColumns.ID, record.androidID);
- getApplicationContext().getContentResolver().insert(BrowserContractHelpers.DELETED_PASSWORDS_CONTENT_URI, contentValues);
+ getApplicationContext().getContentResolver().insert(BrowserContractHelpers.DELETED_LOGINS_CONTENT_URI, contentValues);
}
private static void dispose(RepositorySession session) {
if (session != null) {
session.abort();
}
}