| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/codec/jpeg_codec.h" | 5 #include "app/gfx/codec/jpeg_codec.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 } | 478 } |
| 479 | 479 |
| 480 TEST_F(HistoryBackendTest, ClientRedirect) { | 480 TEST_F(HistoryBackendTest, ClientRedirect) { |
| 481 ASSERT_TRUE(backend_.get()); | 481 ASSERT_TRUE(backend_.get()); |
| 482 | 482 |
| 483 int transition1; | 483 int transition1; |
| 484 int transition2; | 484 int transition2; |
| 485 | 485 |
| 486 // Initial transition to page A. | 486 // Initial transition to page A. |
| 487 GURL url_a("http://google.com/a"); | 487 GURL url_a("http://google.com/a"); |
| 488 AddClientRedirect(GURL(), url_a, false, &transition1, &transition2); | 488 AddClientRedirect(GURL(), url_a, false, &transition1, &transition2); |
| 489 EXPECT_TRUE(transition2 & PageTransition::CHAIN_END); | 489 EXPECT_TRUE(transition2 & PageTransition::CHAIN_END); |
| 490 | 490 |
| 491 // User initiated redirect to page B. | 491 // User initiated redirect to page B. |
| 492 GURL url_b("http://google.com/b"); | 492 GURL url_b("http://google.com/b"); |
| 493 AddClientRedirect(url_a, url_b, false, &transition1, &transition2); | 493 AddClientRedirect(url_a, url_b, false, &transition1, &transition2); |
| 494 EXPECT_TRUE(transition1 & PageTransition::CHAIN_END); | 494 EXPECT_TRUE(transition1 & PageTransition::CHAIN_END); |
| 495 EXPECT_TRUE(transition2 & PageTransition::CHAIN_END); | 495 EXPECT_TRUE(transition2 & PageTransition::CHAIN_END); |
| 496 | 496 |
| 497 // Non-user initiated redirect to page C. | 497 // Non-user initiated redirect to page C. |
| 498 GURL url_c("http://google.com/c"); | 498 GURL url_c("http://google.com/c"); |
| 499 AddClientRedirect(url_b, url_c, true, &transition1, &transition2); | 499 AddClientRedirect(url_b, url_c, true, &transition1, &transition2); |
| 500 EXPECT_FALSE(transition1 & PageTransition::CHAIN_END); | 500 EXPECT_FALSE(transition1 & PageTransition::CHAIN_END); |
| 501 EXPECT_TRUE(transition2 & PageTransition::CHAIN_END); | 501 EXPECT_TRUE(transition2 & PageTransition::CHAIN_END); |
| 502 } | 502 } |
| 503 | 503 |
| 504 TEST_F(HistoryBackendTest, ImportedFaviconsTest) { | 504 TEST_F(HistoryBackendTest, ImportedFaviconsTest) { |
| 505 // Setup test data - two Urls in the history, one with favicon assigned and | 505 // Setup test data - two Urls in the history, one with favicon assigned and |
| 506 // one without. | 506 // one without. |
| 507 GURL favicon_url1("http://www.google.com/favicon.ico"); | 507 GURL favicon_url1("http://www.google.com/favicon.ico"); |
| 508 FavIconID favicon1 = backend_->thumbnail_db_->AddFavIcon(favicon_url1); | 508 FavIconID favicon1 = backend_->thumbnail_db_->AddFavIcon(favicon_url1); |
| 509 std::vector<unsigned char> data; | 509 std::vector<unsigned char> data; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 557 |
| 558 // If the URL is bookmarked, it should get added to history with 0 visits. | 558 // If the URL is bookmarked, it should get added to history with 0 visits. |
| 559 bookmark_model_.AddURL(bookmark_model_.GetBookmarkBarNode(), 0, | 559 bookmark_model_.AddURL(bookmark_model_.GetBookmarkBarNode(), 0, |
| 560 std::wstring(), url3); | 560 std::wstring(), url3); |
| 561 backend_->SetImportedFavicons(favicons); | 561 backend_->SetImportedFavicons(favicons); |
| 562 EXPECT_FALSE(backend_->db_->GetRowForURL(url3, &url_row3) == 0); | 562 EXPECT_FALSE(backend_->db_->GetRowForURL(url3, &url_row3) == 0); |
| 563 EXPECT_TRUE(url_row3.visit_count() == 0); | 563 EXPECT_TRUE(url_row3.visit_count() == 0); |
| 564 } | 564 } |
| 565 | 565 |
| 566 } // namespace history | 566 } // namespace history |
| OLD | NEW |