Commit 3cd9ead2 authored by Matthias Körber's avatar Matthias Körber Committed by Commit Bot

Removed unused methods from |AffiliationDatabase|.

Change-Id: I64596bb4bdd4f32c758db760f81c2f5bee1c8233
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824083Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Matthias Körber <koerber@google.com>
Cr-Commit-Position: refs/heads/master@{#699755}
parent 36119d24
......@@ -174,24 +174,6 @@ void AffiliationDatabase::DeleteAffiliationsAndBrandingForFacetURI(
transaction.Commit();
}
void AffiliationDatabase::DeleteAffiliationsAndBrandingOlderThan(
const base::Time& cutoff_threshold) {
// Children will get deleted due to 'ON DELETE CASCADE'.
sql::Statement statement_parent(sql_connection_->GetCachedStatement(
SQL_FROM_HERE,
"DELETE FROM eq_classes "
"WHERE eq_classes.last_update_time < ?"));
statement_parent.BindInt64(0, cutoff_threshold.ToInternalValue());
statement_parent.Run();
}
void AffiliationDatabase::DeleteAllAffiliationsAndBranding() {
// Children will get deleted due to 'ON DELETE CASCADE'.
sql::Statement statement_parent(
sql_connection_->GetUniqueStatement("DELETE FROM eq_classes"));
statement_parent.Run();
}
bool AffiliationDatabase::Store(
const AffiliatedFacetsWithUpdateTime& affiliated_facets) {
DCHECK(!affiliated_facets.facets.empty());
......
......@@ -57,14 +57,6 @@ class AffiliationDatabase {
// containing |facet_uri|.
void DeleteAffiliationsAndBrandingForFacetURI(const FacetURI& facet_uri);
// Removes stored equivalence classes and branding information that were last
// updated before the |cutoff_threshold|.
void DeleteAffiliationsAndBrandingOlderThan(
const base::Time& cutoff_threshold);
// Removes all records from all tables of the database.
void DeleteAllAffiliationsAndBranding();
// Stores the equivalence class and branding information defined by
// |affiliated_facets| to the DB and returns true unless it has a non-empty
// subset with a preexisting class, in which case no changes are made and the
......
......@@ -243,40 +243,6 @@ TEST_F(AffiliationDatabaseTest, StoreAndRemoveConflicting) {
}
}
TEST_F(AffiliationDatabaseTest, DeleteAllAffiliationsAndBranding) {
db().DeleteAllAffiliationsAndBranding();
ASSERT_NO_FATAL_FAILURE(StoreInitialTestData());
db().DeleteAllAffiliationsAndBranding();
std::vector<AffiliatedFacetsWithUpdateTime> affiliations;
db().GetAllAffiliationsAndBranding(&affiliations);
ASSERT_EQ(0u, affiliations.size());
}
TEST_F(AffiliationDatabaseTest, DeleteAffiliationsAndBrandingOlderThan) {
db().DeleteAffiliationsAndBrandingOlderThan(base::Time::FromInternalValue(0));
ASSERT_NO_FATAL_FAILURE(StoreInitialTestData());
db().DeleteAffiliationsAndBrandingOlderThan(
base::Time::FromInternalValue(kTestTimeUs2));
std::vector<AffiliatedFacetsWithUpdateTime> affiliations;
db().GetAllAffiliationsAndBranding(&affiliations);
ASSERT_EQ(2u, affiliations.size());
ExpectEquivalenceClassesIncludingBrandingInfoAreEqual(TestEquivalenceClass2(),
affiliations[0]);
ExpectEquivalenceClassesIncludingBrandingInfoAreEqual(TestEquivalenceClass3(),
affiliations[1]);
db().DeleteAffiliationsAndBrandingOlderThan(base::Time::Max());
db().GetAllAffiliationsAndBranding(&affiliations);
ASSERT_EQ(0u, affiliations.size());
}
// Verify that an existing DB can be reopened, and data is retained.
TEST_F(AffiliationDatabaseTest, DBRetainsDataAfterReopening) {
ASSERT_NO_FATAL_FAILURE(StoreInitialTestData());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment