| Index: chrome/browser/search_engines/template_url_service_unittest.cc
|
| diff --git a/chrome/browser/search_engines/template_url_service_unittest.cc b/chrome/browser/search_engines/template_url_service_unittest.cc
|
| index ff7932f17c3295c3f4fce1b0586d1071efefccb0..dae3dbd057f7b3d0f056b52423a1638529f354a4 100644
|
| --- a/chrome/browser/search_engines/template_url_service_unittest.cc
|
| +++ b/chrome/browser/search_engines/template_url_service_unittest.cc
|
| @@ -78,6 +78,7 @@ std::unique_ptr<TemplateURL> CreateKeywordWithDate(
|
| const std::string& encodings,
|
| Time date_created,
|
| Time last_modified,
|
| + Time last_visited,
|
| TemplateURL::Type type = TemplateURL::NORMAL) {
|
| TemplateURLData data;
|
| data.SetShortName(base::UTF8ToUTF16(short_name));
|
| @@ -93,30 +94,32 @@ std::unique_ptr<TemplateURL> CreateKeywordWithDate(
|
| encodings, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
|
| data.date_created = date_created;
|
| data.last_modified = last_modified;
|
| + data.last_visited = last_visited;
|
| return base::MakeUnique<TemplateURL>(data, type);
|
| }
|
|
|
| -TemplateURL* AddKeywordWithDate(
|
| - TemplateURLService* model,
|
| - const std::string& short_name,
|
| - const std::string& keyword,
|
| - const std::string& url,
|
| - const std::string& suggest_url,
|
| - const std::string& alternate_url,
|
| - const std::string& favicon_url,
|
| - bool safe_for_autoreplace,
|
| - const std::string& encodings,
|
| - Time date_created,
|
| - Time last_modified) {
|
| +TemplateURL* AddKeywordWithDate(TemplateURLService* model,
|
| + const std::string& short_name,
|
| + const std::string& keyword,
|
| + const std::string& url,
|
| + const std::string& suggest_url,
|
| + const std::string& alternate_url,
|
| + const std::string& favicon_url,
|
| + bool safe_for_autoreplace,
|
| + const std::string& encodings,
|
| + Time date_created,
|
| + Time last_modified,
|
| + Time last_visited) {
|
| TemplateURL* t_url = model->Add(CreateKeywordWithDate(
|
| model, short_name, keyword, url, suggest_url, alternate_url, favicon_url,
|
| - safe_for_autoreplace, 0, encodings, date_created, last_modified));
|
| + safe_for_autoreplace, 0, encodings, date_created, last_modified,
|
| + last_visited));
|
| EXPECT_NE(0, t_url->id());
|
| return t_url;
|
| }
|
|
|
| -// Checks that the two TemplateURLs are similar. It does not check the id, the
|
| -// date_created or the last_modified time. Neither pointer should be NULL.
|
| +// Checks that the two TemplateURLs are similar. It does not check the id or
|
| +// any time-related fields. Neither pointer should be NULL.
|
| void ExpectSimilar(const TemplateURL* expected, const TemplateURL* actual) {
|
| ASSERT_TRUE(expected != NULL);
|
| ASSERT_TRUE(actual != NULL);
|
| @@ -167,7 +170,8 @@ class TemplateURLServiceTest : public testing::Test {
|
| bool safe_for_autoreplace,
|
| const std::string& encodings,
|
| Time date_created,
|
| - Time last_modified);
|
| + Time last_modified,
|
| + Time last_visited);
|
|
|
| // Verifies the two TemplateURLs are equal.
|
| void AssertEquals(const TemplateURL& expected, const TemplateURL& actual);
|
| @@ -235,10 +239,12 @@ TemplateURL* TemplateURLServiceTest::AddKeywordWithDate(
|
| bool safe_for_autoreplace,
|
| const std::string& encodings,
|
| Time date_created,
|
| - Time last_modified) {
|
| + Time last_modified,
|
| + Time last_visited) {
|
| return ::AddKeywordWithDate(model(), short_name, keyword, url, suggest_url,
|
| alternate_url, favicon_url, safe_for_autoreplace,
|
| - encodings, date_created, last_modified);
|
| + encodings, date_created, last_modified,
|
| + last_visited);
|
| }
|
|
|
| void TemplateURLServiceTest::AssertEquals(const TemplateURL& expected,
|
| @@ -255,6 +261,7 @@ void TemplateURLServiceTest::AssertEquals(const TemplateURL& expected,
|
| ASSERT_EQ(expected.id(), actual.id());
|
| ASSERT_EQ(expected.date_created(), actual.date_created());
|
| AssertTimesEqual(expected.last_modified(), actual.last_modified());
|
| + ASSERT_EQ(expected.last_visited(), actual.last_visited());
|
| ASSERT_EQ(expected.sync_guid(), actual.sync_guid());
|
| ASSERT_EQ(expected.search_terms_replacement_key(),
|
| actual.search_terms_replacement_key());
|
| @@ -280,6 +287,7 @@ std::unique_ptr<TemplateURL> TemplateURLServiceTest::CreatePreloadedTemplateURL(
|
| data.input_encodings.push_back("UTF-8");
|
| data.date_created = Time::FromTimeT(100);
|
| data.last_modified = Time::FromTimeT(100);
|
| + data.last_visited = Time::FromTimeT(100);
|
| data.prepopulate_id = prepopulate_id;
|
| return base::MakeUnique<TemplateURL>(data);
|
| }
|
| @@ -314,6 +322,7 @@ TEST_F(TemplateURLServiceTest, AddUpdateRemove) {
|
| data.safe_for_autoreplace = true;
|
| data.date_created = Time::FromTimeT(100);
|
| data.last_modified = Time::FromTimeT(100);
|
| + data.last_visited = Time::FromTimeT(100);
|
| data.sync_guid = "00000000-0000-0000-0000-000000000001";
|
| TemplateURL* t_url = model()->Add(base::MakeUnique<TemplateURL>(data));
|
| ASSERT_TRUE(model()->CanAddAutogeneratedKeyword(ASCIIToUTF16("keyword"),
|
| @@ -378,9 +387,9 @@ TEST_F(TemplateURLServiceTest, AddUpdateRemove) {
|
| TEST_F(TemplateURLServiceTest, AddSameKeyword) {
|
| test_util()->VerifyLoad();
|
|
|
| - AddKeywordWithDate(
|
| - "first", "keyword", "http://test1", std::string(), std::string(),
|
| - std::string(), true, "UTF-8", Time(), Time());
|
| + AddKeywordWithDate("first", "keyword", "http://test1", std::string(),
|
| + std::string(), std::string(), true, "UTF-8", Time(),
|
| + Time(), Time());
|
| VerifyObserverCount(1);
|
|
|
| // Test what happens when we try to add a TemplateURL with the same keyword as
|
| @@ -429,12 +438,12 @@ TEST_F(TemplateURLServiceTest, AddSameKeyword) {
|
| TEST_F(TemplateURLServiceTest, AddExtensionKeyword) {
|
| test_util()->VerifyLoad();
|
|
|
| - AddKeywordWithDate(
|
| - "replaceable", "keyword1", "http://test1", std::string(), std::string(),
|
| - std::string(), true, "UTF-8", Time(), Time());
|
| + AddKeywordWithDate("replaceable", "keyword1", "http://test1", std::string(),
|
| + std::string(), std::string(), true, "UTF-8", Time(),
|
| + Time(), Time());
|
| TemplateURL* original2 = AddKeywordWithDate(
|
| "nonreplaceable", "keyword2", "http://test2", std::string(),
|
| - std::string(), std::string(), false, "UTF-8", Time(), Time());
|
| + std::string(), std::string(), false, "UTF-8", Time(), Time(), Time());
|
| model()->RegisterOmniboxKeyword("test3", "extension", "keyword3",
|
| "http://test3");
|
| TemplateURL* original3 =
|
| @@ -478,9 +487,9 @@ TEST_F(TemplateURLServiceTest, AddSameKeywordWithExtensionPresent) {
|
| model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword"));
|
| ASSERT_TRUE(extension);
|
| // Adding a keyword that matches the extension.
|
| - AddKeywordWithDate(
|
| - "replaceable", "keyword", "http://test1", std::string(), std::string(),
|
| - std::string(), true, "UTF-8", Time(), Time());
|
| + AddKeywordWithDate("replaceable", "keyword", "http://test1", std::string(),
|
| + std::string(), std::string(), true, "UTF-8", Time(),
|
| + Time(), Time());
|
|
|
| // Adding another replaceable keyword should remove the existing one, but
|
| // leave the extension as is.
|
| @@ -531,24 +540,24 @@ TEST_F(TemplateURLServiceTest, ClearBrowsingData_Keywords) {
|
| // Create one with a 0 time.
|
| AddKeywordWithDate("name1", "key1", "http://foo1", "http://suggest1",
|
| std::string(), "http://icon1", true, "UTF-8;UTF-16",
|
| - Time(), Time());
|
| + Time(), Time(), Time());
|
| // Create one for now and +/- 1 day.
|
| AddKeywordWithDate("name2", "key2", "http://foo2", "http://suggest2",
|
| - std::string(), "http://icon2", true, "UTF-8;UTF-16",
|
| - now - one_day, Time());
|
| + std::string(), "http://icon2", true, "UTF-8;UTF-16",
|
| + now - one_day, Time(), Time());
|
| AddKeywordWithDate("name3", "key3", "http://foo3", std::string(),
|
| std::string(), std::string(), true, std::string(), now,
|
| - Time());
|
| + Time(), Time());
|
| AddKeywordWithDate("name4", "key4", "http://foo4", std::string(),
|
| std::string(), std::string(), true, std::string(),
|
| - now + one_day, Time());
|
| + now + one_day, Time(), Time());
|
| // Try the other three states.
|
| AddKeywordWithDate("name5", "key5", "http://foo5", "http://suggest5",
|
| std::string(), "http://icon5", false, "UTF-8;UTF-16", now,
|
| - Time());
|
| + Time(), Time());
|
| AddKeywordWithDate("name6", "key6", "http://foo6", "http://suggest6",
|
| std::string(), "http://icon6", false, "UTF-8;UTF-16",
|
| - month_ago, Time());
|
| + month_ago, Time(), Time());
|
|
|
| // We just added a few items, validate them.
|
| EXPECT_EQ(6U, model()->GetTemplateURLs().size());
|
| @@ -595,13 +604,13 @@ TEST_F(TemplateURLServiceTest, ClearBrowsingData_KeywordsForUrls) {
|
| // Create one for now and +/- 1 day.
|
| AddKeywordWithDate("name1", "key1", "http://foo1", "http://suggest1",
|
| std::string(), "http://icon2", true, "UTF-8;UTF-16",
|
| - now - one_day, Time());
|
| + now - one_day, Time(), Time());
|
| AddKeywordWithDate("name2", "key2", "http://foo2", std::string(),
|
| std::string(), std::string(), true, std::string(), now,
|
| - Time());
|
| + Time(), Time());
|
| AddKeywordWithDate("name3", "key3", "http://foo3", std::string(),
|
| std::string(), std::string(), true, std::string(),
|
| - now + one_day, Time());
|
| + now + one_day, Time(), Time());
|
|
|
| // We just added a few items, validate them.
|
| EXPECT_EQ(3U, model()->GetTemplateURLs().size());
|
| @@ -653,6 +662,7 @@ TEST_F(TemplateURLServiceTest, Reset) {
|
| data.favicon_url = GURL("http://favicon.url");
|
| data.date_created = Time::FromTimeT(100);
|
| data.last_modified = Time::FromTimeT(100);
|
| + data.last_visited = Time::FromTimeT(100);
|
| TemplateURL* t_url = model()->Add(base::MakeUnique<TemplateURL>(data));
|
|
|
| VerifyObserverCount(1);
|
| @@ -693,9 +703,10 @@ TEST_F(TemplateURLServiceTest, DefaultSearchProvider) {
|
| // Add a new TemplateURL.
|
| test_util()->VerifyLoad();
|
| const size_t initial_count = model()->GetTemplateURLs().size();
|
| - TemplateURL* t_url = AddKeywordWithDate(
|
| - "name1", "key1", "http://foo1/{searchTerms}", "http://sugg1",
|
| - std::string(), "http://icon1", true, "UTF-8;UTF-16", Time(), Time());
|
| + TemplateURL* t_url =
|
| + AddKeywordWithDate("name1", "key1", "http://foo1/{searchTerms}",
|
| + "http://sugg1", std::string(), "http://icon1", true,
|
| + "UTF-8;UTF-16", Time(), Time(), Time());
|
| test_util()->ResetObserverCount();
|
|
|
| model()->SetUserSelectedDefaultSearchProvider(t_url);
|
| @@ -723,7 +734,7 @@ TEST_F(TemplateURLServiceTest, CantReplaceWithSameKeyword) {
|
| NULL));
|
| TemplateURL* t_url = AddKeywordWithDate(
|
| "name1", "foo", "http://foo1", "http://sugg1", std::string(),
|
| - "http://icon1", true, "UTF-8;UTF-16", Time(), Time());
|
| + "http://icon1", true, "UTF-8;UTF-16", Time(), Time(), Time());
|
|
|
| // Can still replace, newly added template url is marked safe to replace.
|
| ASSERT_TRUE(model()->CanAddAutogeneratedKeyword(ASCIIToUTF16("foo"),
|
| @@ -744,7 +755,7 @@ TEST_F(TemplateURLServiceTest, CantReplaceWithSameHosts) {
|
| GURL("http://foo.com"), NULL));
|
| TemplateURL* t_url = AddKeywordWithDate(
|
| "name1", "foo", "http://foo.com", "http://sugg1", std::string(),
|
| - "http://icon1", true, "UTF-8;UTF-16", Time(), Time());
|
| + "http://icon1", true, "UTF-8;UTF-16", Time(), Time(), Time());
|
|
|
| // Can still replace, newly added template url is marked safe to replace.
|
| ASSERT_TRUE(model()->CanAddAutogeneratedKeyword(ASCIIToUTF16("bar"),
|
| @@ -780,6 +791,7 @@ TEST_F(TemplateURLServiceTest, DefaultSearchProviderLoadedFromPrefs) {
|
| data.instant_url = "http://instant";
|
| data.date_created = Time::FromTimeT(100);
|
| data.last_modified = Time::FromTimeT(100);
|
| + data.last_visited = Time::FromTimeT(100);
|
| TemplateURL* t_url = model()->Add(base::MakeUnique<TemplateURL>(data));
|
| const TemplateURLID id = t_url->id();
|
|
|
| @@ -824,8 +836,8 @@ TEST_F(TemplateURLServiceTest, RepairPrepopulatedSearchEngines) {
|
| // Add third-party default search engine.
|
| TemplateURL* user_dse = AddKeywordWithDate(
|
| "malware", "google.com", "http://www.goo.com/s?q={searchTerms}",
|
| - std::string(), std::string(), std::string(),
|
| - true, "UTF-8", Time(), Time());
|
| + std::string(), std::string(), std::string(), true, "UTF-8", Time(),
|
| + Time(), Time());
|
| model()->SetUserSelectedDefaultSearchProvider(user_dse);
|
| EXPECT_EQ(user_dse, model()->GetDefaultSearchProvider());
|
|
|
| @@ -902,7 +914,8 @@ TEST_F(TemplateURLServiceTest, UpdateKeywordSearchTermsForURL) {
|
| test_util()->ChangeModelToLoadState();
|
| AddKeywordWithDate("name", "x", "http://x/foo?q={searchTerms}",
|
| "http://sugg1", "http://x/foo#query={searchTerms}",
|
| - "http://icon1", false, "UTF-8;UTF-16", Time(), Time());
|
| + "http://icon1", false, "UTF-8;UTF-16", Time(), Time(),
|
| + Time());
|
|
|
| for (size_t i = 0; i < arraysize(data); ++i) {
|
| TemplateURLService::URLVisitedDetails details = {
|
| @@ -924,7 +937,8 @@ TEST_F(TemplateURLServiceTest, DontUpdateKeywordSearchForNonReplaceable) {
|
|
|
| test_util()->ChangeModelToLoadState();
|
| AddKeywordWithDate("name", "x", "http://x/foo", "http://sugg1", std::string(),
|
| - "http://icon1", false, "UTF-8;UTF-16", Time(), Time());
|
| + "http://icon1", false, "UTF-8;UTF-16", Time(), Time(),
|
| + Time());
|
|
|
| for (size_t i = 0; i < arraysize(data); ++i) {
|
| TemplateURLService::URLVisitedDetails details = {
|
| @@ -943,7 +957,8 @@ TEST_F(TemplateURLServiceWithoutFallbackTest, ChangeGoogleBaseValue) {
|
| test_util()->SetGoogleBaseURL(GURL("http://google.com/"));
|
| const TemplateURL* t_url = AddKeywordWithDate(
|
| "name", "google.com", "{google:baseURL}?q={searchTerms}", "http://sugg1",
|
| - std::string(), "http://icon1", false, "UTF-8;UTF-16", Time(), Time());
|
| + std::string(), "http://icon1", false, "UTF-8;UTF-16", Time(), Time(),
|
| + Time());
|
| ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.com"));
|
| EXPECT_EQ("google.com", t_url->url_ref().GetHost(search_terms_data()));
|
| EXPECT_EQ(ASCIIToUTF16("google.com"), t_url->keyword());
|
| @@ -964,9 +979,9 @@ TEST_F(TemplateURLServiceWithoutFallbackTest, ChangeGoogleBaseValue) {
|
| // Now add a manual entry and then change the Google base URL such that the
|
| // autogenerated Google search keyword would conflict.
|
| TemplateURL* manual = AddKeywordWithDate(
|
| - "manual", "google.de", "http://google.de/search?q={searchTerms}",
|
| - std::string(), std::string(), std::string(), false, "UTF-8", Time(),
|
| - Time());
|
| + "manual", "google.de", "http://google.de/search?q={searchTerms}",
|
| + std::string(), std::string(), std::string(), false, "UTF-8", Time(),
|
| + Time(), Time());
|
| test_util()->SetGoogleBaseURL(GURL("http://google.de"));
|
|
|
| // Verify that the manual entry is untouched, and the autogenerated keyword
|
| @@ -1003,7 +1018,7 @@ TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) {
|
| TemplateURL* t_url = AddKeywordWithDate(
|
| "keyword", "keyword", "http://foo.com/foo?query={searchTerms}",
|
| "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16",
|
| - base::Time::Now(), base::Time::Now());
|
| + base::Time::Now(), base::Time::Now(), base::Time());
|
|
|
| // Add a visit that matches the url of the keyword.
|
| history::HistoryService* history = HistoryServiceFactory::GetForProfile(
|
| @@ -1212,9 +1227,10 @@ TEST_F(TemplateURLServiceTest, TestManagedDefaultSearch) {
|
| test_util()->ResetObserverCount();
|
|
|
| // Set a regular default search provider.
|
| - TemplateURL* regular_default = AddKeywordWithDate(
|
| - "name1", "key1", "http://foo1/{searchTerms}", "http://sugg1",
|
| - std::string(), "http://icon1", true, "UTF-8;UTF-16", Time(), Time());
|
| + TemplateURL* regular_default =
|
| + AddKeywordWithDate("name1", "key1", "http://foo1/{searchTerms}",
|
| + "http://sugg1", std::string(), "http://icon1", true,
|
| + "UTF-8;UTF-16", Time(), Time(), Time());
|
| VerifyObserverCount(1);
|
| model()->SetUserSelectedDefaultSearchProvider(regular_default);
|
| // Adding the URL and setting the default search provider should have caused
|
| @@ -1376,16 +1392,16 @@ TEST_F(TemplateURLServiceTest, DefaultExtensionEngine) {
|
| test_util()->VerifyLoad();
|
| // Add third-party default search engine.
|
| TemplateURL* user_dse = AddKeywordWithDate(
|
| - "user", "user", "http://www.goo.com/s?q={searchTerms}",
|
| - std::string(), std::string(), std::string(),
|
| - true, "UTF-8", Time(), Time());
|
| + "user", "user", "http://www.goo.com/s?q={searchTerms}", std::string(),
|
| + std::string(), std::string(), true, "UTF-8", Time(), Time(), Time());
|
| model()->SetUserSelectedDefaultSearchProvider(user_dse);
|
| EXPECT_EQ(user_dse, model()->GetDefaultSearchProvider());
|
|
|
| std::unique_ptr<TemplateURL> ext_dse = CreateKeywordWithDate(
|
| model(), "ext", "ext", "http://www.search.com/s?q={searchTerms}",
|
| std::string(), std::string(), std::string(), true, kPrepopulatedId,
|
| - "UTF-8", Time(), Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
|
| + "UTF-8", Time(), Time(), Time(),
|
| + TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
|
| std::unique_ptr<TemplateURL::AssociatedExtensionInfo> extension_info(
|
| new TemplateURL::AssociatedExtensionInfo("ext"));
|
| extension_info->wants_to_be_default_engine = true;
|
| @@ -1402,16 +1418,15 @@ TEST_F(TemplateURLServiceTest, ExtensionEnginesNotPersist) {
|
| test_util()->VerifyLoad();
|
| // Add third-party default search engine.
|
| TemplateURL* user_dse = AddKeywordWithDate(
|
| - "user", "user", "http://www.goo.com/s?q={searchTerms}",
|
| - std::string(), std::string(), std::string(),
|
| - true, "UTF-8", Time(), Time());
|
| + "user", "user", "http://www.goo.com/s?q={searchTerms}", std::string(),
|
| + std::string(), std::string(), true, "UTF-8", Time(), Time(), Time());
|
| model()->SetUserSelectedDefaultSearchProvider(user_dse);
|
| EXPECT_EQ(user_dse, model()->GetDefaultSearchProvider());
|
|
|
| std::unique_ptr<TemplateURL> ext_dse = CreateKeywordWithDate(
|
| model(), "ext1", "ext1", "http://www.ext1.com/s?q={searchTerms}",
|
| std::string(), std::string(), std::string(), true, 0, "UTF-8", Time(),
|
| - Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
|
| + Time(), Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
|
| std::unique_ptr<TemplateURL::AssociatedExtensionInfo> extension_info(
|
| new TemplateURL::AssociatedExtensionInfo("ext1"));
|
| extension_info->wants_to_be_default_engine = false;
|
| @@ -1422,7 +1437,8 @@ TEST_F(TemplateURLServiceTest, ExtensionEnginesNotPersist) {
|
| ext_dse = CreateKeywordWithDate(
|
| model(), "ext2", "ext2", "http://www.ext2.com/s?q={searchTerms}",
|
| std::string(), std::string(), std::string(), true, kPrepopulatedId,
|
| - "UTF-8", Time(), Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
|
| + "UTF-8", Time(), Time(), Time(),
|
| + TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
|
| extension_info.reset(new TemplateURL::AssociatedExtensionInfo("ext2"));
|
| extension_info->wants_to_be_default_engine = true;
|
| TemplateURL* ext_dse_ptr = model()->AddExtensionControlledTURL(
|
| @@ -1451,7 +1467,8 @@ TEST_F(TemplateURLServiceTest, ExtensionEngineVsPolicy) {
|
| std::unique_ptr<TemplateURL> ext_dse = CreateKeywordWithDate(
|
| model(), "ext1", "ext1", "http://www.ext1.com/s?q={searchTerms}",
|
| std::string(), std::string(), std::string(), true, kPrepopulatedId,
|
| - "UTF-8", Time(), Time(), TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
|
| + "UTF-8", Time(), Time(), Time(),
|
| + TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
|
| auto extension_info =
|
| base::MakeUnique<TemplateURL::AssociatedExtensionInfo>("ext1");
|
| extension_info->wants_to_be_default_engine = true;
|
| @@ -1463,3 +1480,20 @@ TEST_F(TemplateURLServiceTest, ExtensionEngineVsPolicy) {
|
| actual_managed_default = model()->GetDefaultSearchProvider();
|
| ExpectSimilar(expected_managed_default.get(), actual_managed_default);
|
| }
|
| +
|
| +TEST_F(TemplateURLServiceTest, LastVisitedTimeUpdate) {
|
| + test_util()->VerifyLoad();
|
| + TemplateURL* original_url = AddKeywordWithDate(
|
| + "name1", "key1", "http://foo1", "http://suggest1", std::string(),
|
| + "http://icon1", true, "UTF-8;UTF-16", Time(), Time(), Time());
|
| + const base::Time original_last_visited = original_url->last_visited();
|
| + model()->UpdateTemplateURLVisitTime(original_url);
|
| + TemplateURL* modified_url =
|
| + model()->GetTemplateURLForKeyword(ASCIIToUTF16("key1"));
|
| + const base::Time modified_last_visited = modified_url->last_visited();
|
| + EXPECT_NE(original_last_visited, modified_last_visited);
|
| + test_util()->ResetModel(true);
|
| + TemplateURL* reloaded_url =
|
| + model()->GetTemplateURLForKeyword(ASCIIToUTF16("key1"));
|
| + AssertTimesEqual(modified_last_visited, reloaded_url->last_visited());
|
| +}
|
|
|