Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Unified Diff: chrome/browser/webdata/keyword_table_unittest.cc

Issue 7980028: Ensure that TemplateURLs created from old database entries without sync_guids generate their own ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/webdata/keyword_table.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/keyword_table_unittest.cc
===================================================================
--- chrome/browser/webdata/keyword_table_unittest.cc (revision 101377)
+++ chrome/browser/webdata/keyword_table_unittest.cc (working copy)
@@ -252,3 +252,33 @@
EXPECT_EQ(GetID(&template_url), GetID(restored_url));
delete restored_url;
}
+
+TEST_F(KeywordTableTest, KeywordWithEmptySyncGUID) {
+ WebDatabase db;
+
+ ASSERT_EQ(sql::INIT_OK, db.Init(file_));
+
+ TemplateURL template_url;
+ template_url.set_short_name(ASCIIToUTF16("short_name"));
+ template_url.set_keyword(ASCIIToUTF16("keyword"));
+ template_url.SetURL("http://url/", 0, 0);
+ template_url.set_safe_for_autoreplace(true);
+ SetID(-100, &template_url);
+
+ // A GUID should be generated when |template_url| was created. Clear it.
+ ASSERT_FALSE(template_url.sync_guid().empty());
+ template_url.set_sync_guid(std::string());
+
+ EXPECT_TRUE(db.GetKeywordTable()->AddKeyword(template_url));
+
+ std::vector<TemplateURL*> template_urls;
+ EXPECT_TRUE(db.GetKeywordTable()->GetKeywords(&template_urls));
+ EXPECT_EQ(1U, template_urls.size());
+ const TemplateURL* restored_url = template_urls.front();
+
+ EXPECT_EQ(template_url.short_name(), restored_url->short_name());
+ EXPECT_EQ(template_url.keyword(), restored_url->keyword());
+ EXPECT_EQ(GetID(&template_url), GetID(restored_url));
+ EXPECT_FALSE(restored_url->sync_guid().empty());
+ delete restored_url;
+}
« no previous file with comments | « chrome/browser/webdata/keyword_table.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698