| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <list> | 5 #include <list> |
| 6 #include <map> | 6 #include <map> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 private: | 298 private: |
| 299 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTest); | 299 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTest); |
| 300 }; | 300 }; |
| 301 | 301 |
| 302 TEST_F(WebDatabaseTest, Keywords) { | 302 TEST_F(WebDatabaseTest, Keywords) { |
| 303 WebDatabase db; | 303 WebDatabase db; |
| 304 | 304 |
| 305 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); | 305 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); |
| 306 | 306 |
| 307 TemplateURL template_url; | 307 TemplateURL template_url; |
| 308 template_url.set_short_name(ASCIIToUTF16("short_name")); | 308 template_url.set_short_name(L"short_name"); |
| 309 template_url.set_keyword(ASCIIToUTF16("keyword")); | 309 template_url.set_keyword(L"keyword"); |
| 310 GURL favicon_url("http://favicon.url/"); | 310 GURL favicon_url("http://favicon.url/"); |
| 311 GURL originating_url("http://google.com/"); | 311 GURL originating_url("http://google.com/"); |
| 312 template_url.SetFavIconURL(favicon_url); | 312 template_url.SetFavIconURL(favicon_url); |
| 313 template_url.SetURL("http://url/", 0, 0); | 313 template_url.SetURL("http://url/", 0, 0); |
| 314 template_url.set_safe_for_autoreplace(true); | 314 template_url.set_safe_for_autoreplace(true); |
| 315 base::Time created_time = Time::Now(); | 315 base::Time created_time = Time::Now(); |
| 316 template_url.set_date_created(created_time); | 316 template_url.set_date_created(created_time); |
| 317 template_url.set_show_in_default_list(true); | 317 template_url.set_show_in_default_list(true); |
| 318 template_url.set_originating_url(originating_url); | 318 template_url.set_originating_url(originating_url); |
| 319 template_url.set_usage_count(32); | 319 template_url.set_usage_count(32); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 ASSERT_EQ(10, db.GetDefaulSearchProviderID()); | 391 ASSERT_EQ(10, db.GetDefaulSearchProviderID()); |
| 392 ASSERT_EQ(11, db.GetBuitinKeywordVersion()); | 392 ASSERT_EQ(11, db.GetBuitinKeywordVersion()); |
| 393 } | 393 } |
| 394 | 394 |
| 395 TEST_F(WebDatabaseTest, UpdateKeyword) { | 395 TEST_F(WebDatabaseTest, UpdateKeyword) { |
| 396 WebDatabase db; | 396 WebDatabase db; |
| 397 | 397 |
| 398 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); | 398 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); |
| 399 | 399 |
| 400 TemplateURL template_url; | 400 TemplateURL template_url; |
| 401 template_url.set_short_name(ASCIIToUTF16("short_name")); | 401 template_url.set_short_name(L"short_name"); |
| 402 template_url.set_keyword(ASCIIToUTF16("keyword")); | 402 template_url.set_keyword(L"keyword"); |
| 403 GURL favicon_url("http://favicon.url/"); | 403 GURL favicon_url("http://favicon.url/"); |
| 404 GURL originating_url("http://originating.url/"); | 404 GURL originating_url("http://originating.url/"); |
| 405 template_url.SetFavIconURL(favicon_url); | 405 template_url.SetFavIconURL(favicon_url); |
| 406 template_url.SetURL("http://url/", 0, 0); | 406 template_url.SetURL("http://url/", 0, 0); |
| 407 template_url.set_safe_for_autoreplace(true); | 407 template_url.set_safe_for_autoreplace(true); |
| 408 template_url.set_show_in_default_list(true); | 408 template_url.set_show_in_default_list(true); |
| 409 template_url.SetSuggestionsURL("url2", 0, 0); | 409 template_url.SetSuggestionsURL("url2", 0, 0); |
| 410 SetID(1, &template_url); | 410 SetID(1, &template_url); |
| 411 | 411 |
| 412 EXPECT_TRUE(db.AddKeyword(template_url)); | 412 EXPECT_TRUE(db.AddKeyword(template_url)); |
| 413 | 413 |
| 414 GURL originating_url2("http://originating.url/"); | 414 GURL originating_url2("http://originating.url/"); |
| 415 template_url.set_originating_url(originating_url2); | 415 template_url.set_originating_url(originating_url2); |
| 416 template_url.set_autogenerate_keyword(true); | 416 template_url.set_autogenerate_keyword(true); |
| 417 EXPECT_EQ(ASCIIToUTF16("url"), template_url.keyword()); | 417 EXPECT_EQ(L"url", template_url.keyword()); |
| 418 template_url.add_input_encoding("Shift_JIS"); | 418 template_url.add_input_encoding("Shift_JIS"); |
| 419 set_prepopulate_id(&template_url, 5); | 419 set_prepopulate_id(&template_url, 5); |
| 420 set_logo_id(&template_url, 2000); | 420 set_logo_id(&template_url, 2000); |
| 421 template_url.SetInstantURL("http://instant2/", 0, 0); | 421 template_url.SetInstantURL("http://instant2/", 0, 0); |
| 422 EXPECT_TRUE(db.UpdateKeyword(template_url)); | 422 EXPECT_TRUE(db.UpdateKeyword(template_url)); |
| 423 | 423 |
| 424 std::vector<TemplateURL*> template_urls; | 424 std::vector<TemplateURL*> template_urls; |
| 425 EXPECT_TRUE(db.GetKeywords(&template_urls)); | 425 EXPECT_TRUE(db.GetKeywords(&template_urls)); |
| 426 | 426 |
| 427 EXPECT_EQ(1U, template_urls.size()); | 427 EXPECT_EQ(1U, template_urls.size()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 461 |
| 462 delete restored_url; | 462 delete restored_url; |
| 463 } | 463 } |
| 464 | 464 |
| 465 TEST_F(WebDatabaseTest, KeywordWithNoFavicon) { | 465 TEST_F(WebDatabaseTest, KeywordWithNoFavicon) { |
| 466 WebDatabase db; | 466 WebDatabase db; |
| 467 | 467 |
| 468 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); | 468 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); |
| 469 | 469 |
| 470 TemplateURL template_url; | 470 TemplateURL template_url; |
| 471 template_url.set_short_name(ASCIIToUTF16("short_name")); | 471 template_url.set_short_name(L"short_name"); |
| 472 template_url.set_keyword(ASCIIToUTF16("keyword")); | 472 template_url.set_keyword(L"keyword"); |
| 473 template_url.SetURL("http://url/", 0, 0); | 473 template_url.SetURL("http://url/", 0, 0); |
| 474 template_url.set_safe_for_autoreplace(true); | 474 template_url.set_safe_for_autoreplace(true); |
| 475 SetID(-100, &template_url); | 475 SetID(-100, &template_url); |
| 476 | 476 |
| 477 EXPECT_TRUE(db.AddKeyword(template_url)); | 477 EXPECT_TRUE(db.AddKeyword(template_url)); |
| 478 | 478 |
| 479 std::vector<TemplateURL*> template_urls; | 479 std::vector<TemplateURL*> template_urls; |
| 480 EXPECT_TRUE(db.GetKeywords(&template_urls)); | 480 EXPECT_TRUE(db.GetKeywords(&template_urls)); |
| 481 EXPECT_EQ(1U, template_urls.size()); | 481 EXPECT_EQ(1U, template_urls.size()); |
| 482 const TemplateURL* restored_url = template_urls.front(); | 482 const TemplateURL* restored_url = template_urls.front(); |
| (...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2833 &credit_card_a, | 2833 &credit_card_a, |
| 2834 &cc_label_a, | 2834 &cc_label_a, |
| 2835 &cc_number_encrypted_a, | 2835 &cc_number_encrypted_a, |
| 2836 &cc_date_modified_a)); | 2836 &cc_date_modified_a)); |
| 2837 EXPECT_EQ(credit_card, credit_card_a); | 2837 EXPECT_EQ(credit_card, credit_card_a); |
| 2838 EXPECT_EQ(cc_label, cc_label_a); | 2838 EXPECT_EQ(cc_label, cc_label_a); |
| 2839 EXPECT_EQ(cc_number_encrypted, cc_number_encrypted_a); | 2839 EXPECT_EQ(cc_number_encrypted, cc_number_encrypted_a); |
| 2840 EXPECT_EQ(cc_date_modified, cc_date_modified_a); | 2840 EXPECT_EQ(cc_date_modified, cc_date_modified_a); |
| 2841 } | 2841 } |
| 2842 } | 2842 } |
| OLD | NEW |