#include "components/autofill/core/browser/webdata/autocomplete/autocomplete_table.h"
#include <string>
#include <utility>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "components/autofill/core/browser/test_autofill_clock.h"
#include "components/autofill/core/browser/webdata/autocomplete/autocomplete_entry.h"
#include "components/autofill/core/browser/webdata/autofill_change.h"
#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/webdata/common/web_database.h"
#include "sql/statement.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace autofill {
namespace {
AutocompleteEntrySet;
Time;
ElementsAre;
bool CompareAutocompleteEntries(const AutocompleteEntry& a,
const AutocompleteEntry& b) { … }
AutocompleteEntry MakeAutocompleteEntry(const std::u16string& name,
const std::u16string& value,
time_t date_created,
time_t date_last_used) { … }
void CompareAutocompleteEntrySets(const AutocompleteEntrySet& actual,
const AutocompleteEntrySet& expected) { … }
int GetAutocompleteEntryCount(const std::u16string& name,
const std::u16string& value,
WebDatabase* db) { … }
class AutocompleteTableTest : public testing::Test { … };
TEST_F(AutocompleteTableTest, Autocomplete) { … }
TEST_F(AutocompleteTableTest, Autocomplete_GetEntry_Populated) { … }
TEST_F(AutocompleteTableTest, Autocomplete_GetCountOfValuesContainedBetween) { … }
TEST_F(AutocompleteTableTest, Autocomplete_RemoveBetweenChanges) { … }
TEST_F(AutocompleteTableTest, Autocomplete_AddChanges) { … }
TEST_F(AutocompleteTableTest, Autocomplete_UpdateOneWithOneTimestamp) { … }
TEST_F(AutocompleteTableTest, Autocomplete_UpdateOneWithTwoTimestamps) { … }
TEST_F(AutocompleteTableTest, Autocomplete_GetAutofillTimestamps) { … }
TEST_F(AutocompleteTableTest, Autocomplete_UpdateTwo) { … }
TEST_F(AutocompleteTableTest, Autocomplete_UpdateNullTerminated) { … }
TEST_F(AutocompleteTableTest, Autocomplete_UpdateReplace) { … }
TEST_F(AutocompleteTableTest, Autocomplete_UpdateDontReplace) { … }
TEST_F(AutocompleteTableTest, Autocomplete_AddFormFieldValues) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_RemoveFormElementsAddedBetween_UsedOnlyBefore) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_RemoveFormElementsAddedBetween_UsedOnlyAfter) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_RemoveFormElementsAddedBetween_UsedOnlyDuring) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_RemoveFormElementsAddedBetween_UsedBeforeAndDuring) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_RemoveFormElementsAddedBetween_UsedDuringAndAfter) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_RemoveFormElementsAddedBetween_OlderThan30Days) { … }
TEST_F(AutocompleteTableTest, RemoveExpiredFormElements_Expires_DeleteEntry) { … }
TEST_F(AutocompleteTableTest, RemoveExpiredFormElements_NotOldEnough) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_GetAllAutocompleteEntries_NoResults) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_GetAllAutocompleteEntries_OneResult) { … }
TEST_F(AutocompleteTableTest,
Autocomplete_GetAllAutocompleteEntries_TwoDistinct) { … }
TEST_F(AutocompleteTableTest, Autocomplete_GetAllAutocompleteEntries_TwoSame) { … }
TEST_F(AutocompleteTableTest, DontCrashWhenAddingValueToPoisonedDB) { … }
}
}