diff options
author | pkasting@google.com <pkasting@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-01 17:38:56 +0000 |
---|---|---|
committer | pkasting@google.com <pkasting@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-01 17:38:56 +0000 |
commit | fab288ae66e4e45b792d929aa44210fd8104f5e7 (patch) | |
tree | b737518357c503bce66334bcc59309cdcc4e509c /chrome/browser/webdata/web_database_unittest.cc | |
parent | 1fcb8b01fe855dde2485b82d620cdaecb580a3bd (diff) | |
download | chromium_src-fab288ae66e4e45b792d929aa44210fd8104f5e7.zip chromium_src-fab288ae66e4e45b792d929aa44210fd8104f5e7.tar.gz chromium_src-fab288ae66e4e45b792d929aa44210fd8104f5e7.tar.bz2 |
Add the ability to dynamically generate keywords. Mark the Google engine as needing this. This ensures that users in countries where the Google base URL is not "google.com" will see the appropriate keyword for their local country (and can trigger it for tab-to-search, etc.).
BUG=1301290
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata/web_database_unittest.cc')
-rw-r--r-- | chrome/browser/webdata/web_database_unittest.cc | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index fd68974..4e62e0f 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -115,10 +115,10 @@ TEST_F(WebDatabaseTest, Keywords) { TemplateURL template_url; template_url.set_short_name(L"short_name"); template_url.set_keyword(L"keyword"); - GURL favicon_url("http://favicon.url"); - GURL originating_url("http://google.com"); + GURL favicon_url("http://favicon.url/"); + GURL originating_url("http://google.com/"); template_url.SetFavIconURL(favicon_url); - template_url.SetURL(L"url", 0, 0); + template_url.SetURL(L"http://url/", 0, 0); template_url.set_safe_for_autoreplace(true); template_url.set_show_in_default_list(true); template_url.set_originating_url(originating_url); @@ -139,6 +139,8 @@ TEST_F(WebDatabaseTest, Keywords) { EXPECT_EQ(template_url.keyword(), restored_url->keyword()); + EXPECT_FALSE(restored_url->autogenerate_keyword()); + EXPECT_TRUE(favicon_url == restored_url->GetFavIconURL()); EXPECT_TRUE(restored_url->safe_for_autoreplace()); @@ -189,10 +191,10 @@ TEST_F(WebDatabaseTest, UpdateKeyword) { TemplateURL template_url; template_url.set_short_name(L"short_name"); template_url.set_keyword(L"keyword"); - GURL favicon_url("http://favicon.url"); - GURL originating_url("http://originating.url"); + GURL favicon_url("http://favicon.url/"); + GURL originating_url("http://originating.url/"); template_url.SetFavIconURL(favicon_url); - template_url.SetURL(L"url", 0, 0); + template_url.SetURL(L"http://url/", 0, 0); template_url.set_safe_for_autoreplace(true); template_url.set_show_in_default_list(true); template_url.SetSuggestionsURL(L"url2", 0, 0); @@ -200,9 +202,10 @@ TEST_F(WebDatabaseTest, UpdateKeyword) { EXPECT_TRUE(db.AddKeyword(template_url)); - GURL originating_url2("http://originating.url"); - template_url.set_keyword(L"X"); + GURL originating_url2("http://originating.url/"); template_url.set_originating_url(originating_url2); + template_url.set_autogenerate_keyword(true); + EXPECT_EQ(L"url", template_url.keyword()); template_url.add_input_encoding("Shift_JIS"); set_prepopulate_id(&template_url, 5); EXPECT_TRUE(db.UpdateKeyword(template_url)); @@ -217,6 +220,8 @@ TEST_F(WebDatabaseTest, UpdateKeyword) { EXPECT_EQ(template_url.keyword(), restored_url->keyword()); + EXPECT_TRUE(restored_url->autogenerate_keyword()); + EXPECT_TRUE(favicon_url == restored_url->GetFavIconURL()); EXPECT_TRUE(restored_url->safe_for_autoreplace()); @@ -248,7 +253,7 @@ TEST_F(WebDatabaseTest, KeywordWithNoFavicon) { TemplateURL template_url; template_url.set_short_name(L"short_name"); template_url.set_keyword(L"keyword"); - template_url.SetURL(L"url", 0, 0); + template_url.SetURL(L"http://url/", 0, 0); template_url.set_safe_for_autoreplace(true); SetID(-100, &template_url); @@ -287,7 +292,7 @@ TEST_F(WebDatabaseTest, Logins) { form.password_element = L"Passwd"; form.password_value = L"test"; form.submit_element = L"signIn"; - form.signon_realm = "http://www.google.com"; + form.signon_realm = "http://www.google.com/"; form.ssl_valid = false; form.preferred = false; form.scheme = PasswordForm::SCHEME_HTML; @@ -328,7 +333,7 @@ TEST_F(WebDatabaseTest, Logins) { // Imagine the site moves to a secure server for login. PasswordForm form4(form3); - form4.signon_realm = "https://www.google.com"; + form4.signon_realm = "https://www.google.com/"; form4.ssl_valid = true; // We have only an http record, so no match for this. @@ -480,7 +485,7 @@ TEST_F(WebDatabaseTest, BlacklistedLogins) { form.username_element = L"Email"; form.password_element = L"Passwd"; form.submit_element = L"signIn"; - form.signon_realm = "http://www.google.com"; + form.signon_realm = "http://www.google.com/"; form.ssl_valid = false; form.preferred = true; form.blacklisted_by_user = true; @@ -506,7 +511,7 @@ TEST_F(WebDatabaseTest, WebAppHasAllImages) { WebDatabase db; EXPECT_TRUE(db.Init(file_)); - GURL url("http://google.com"); + GURL url("http://google.com/"); // Initial value for unknown web app should be false. EXPECT_FALSE(db.GetWebAppHasAllImages(url)); @@ -524,7 +529,7 @@ TEST_F(WebDatabaseTest, WebAppImages) { WebDatabase db; ASSERT_TRUE(db.Init(file_)); - GURL url("http://google.com"); + GURL url("http://google.com/"); // Web app should initially have no images. std::vector<SkBitmap> images; |