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

Side by Side Diff: chrome/browser/history/history_backend_unittest.cc

Issue 1055173003: Remove unused ThumbnailDatabase::UpdateIconMapping() and ThumbnailDatabase::CloneIconMappings() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/history/thumbnail_database_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/history/core/browser/history_backend.h" 5 #include "components/history/core/browser/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 2635
2636 backend_->UpdateFaviconMappingsAndFetch(GURL(), 2636 backend_->UpdateFaviconMappingsAndFetch(GURL(),
2637 std::vector<GURL>(), 2637 std::vector<GURL>(),
2638 favicon_base::FAVICON, 2638 favicon_base::FAVICON,
2639 GetEdgeSizesSmallAndLarge(), 2639 GetEdgeSizesSmallAndLarge(),
2640 &bitmap_results); 2640 &bitmap_results);
2641 2641
2642 EXPECT_TRUE(bitmap_results.empty()); 2642 EXPECT_TRUE(bitmap_results.empty());
2643 } 2643 }
2644 2644
2645 TEST_F(HistoryBackendTest, CloneFaviconIsRestrictedToSameDomain) {
2646 const GURL url("http://www.google.com/");
2647 const GURL same_domain_url("http://www.google.com/subdir/index.html");
2648 const GURL foreign_domain_url("http://www.not-google.com/");
2649 const GURL icon_url("http://www.google.com/icon.png");
2650 std::vector<SkBitmap> bitmaps;
2651 bitmaps.push_back(CreateBitmap(SK_ColorBLUE, kSmallEdgeSize));
2652
2653 // Add a favicon
2654 backend_->SetFavicons(url, favicon_base::FAVICON, icon_url, bitmaps);
2655 EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingsForPageURL(
2656 url, favicon_base::FAVICON, NULL));
2657
2658 // Validate starting state.
2659 std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results_out;
2660 EXPECT_TRUE(backend_->GetFaviconsFromDB(url,
2661 favicon_base::FAVICON,
2662 GetEdgeSizesSmallAndLarge(),
2663 &bitmap_results_out));
2664 EXPECT_FALSE(backend_->GetFaviconsFromDB(same_domain_url,
2665 favicon_base::FAVICON,
2666 GetEdgeSizesSmallAndLarge(),
2667 &bitmap_results_out));
2668 EXPECT_FALSE(backend_->GetFaviconsFromDB(foreign_domain_url,
2669 favicon_base::FAVICON,
2670 GetEdgeSizesSmallAndLarge(),
2671 &bitmap_results_out));
2672
2673 // Same-domain cloning should work.
2674 backend_->CloneFavicons(url, same_domain_url);
2675 EXPECT_TRUE(backend_->GetFaviconsFromDB(same_domain_url,
2676 favicon_base::FAVICON,
2677 GetEdgeSizesSmallAndLarge(),
2678 &bitmap_results_out));
2679
2680 // Foreign-domain cloning is forbidden.
2681 backend_->CloneFavicons(url, foreign_domain_url);
2682 EXPECT_FALSE(backend_->GetFaviconsFromDB(foreign_domain_url,
2683 favicon_base::FAVICON,
2684 GetEdgeSizesSmallAndLarge(),
2685 &bitmap_results_out));
2686 }
2687
2688 TEST_F(HistoryBackendTest, QueryFilteredURLs) { 2645 TEST_F(HistoryBackendTest, QueryFilteredURLs) {
2689 const char* google = "http://www.google.com/"; 2646 const char* google = "http://www.google.com/";
2690 const char* yahoo = "http://www.yahoo.com/"; 2647 const char* yahoo = "http://www.yahoo.com/";
2691 const char* yahoo_sports = "http://sports.yahoo.com/"; 2648 const char* yahoo_sports = "http://sports.yahoo.com/";
2692 const char* yahoo_sports_with_article1 = 2649 const char* yahoo_sports_with_article1 =
2693 "http://sports.yahoo.com/article1.htm"; 2650 "http://sports.yahoo.com/article1.htm";
2694 const char* yahoo_sports_with_article2 = 2651 const char* yahoo_sports_with_article2 =
2695 "http://sports.yahoo.com/article2.htm"; 2652 "http://sports.yahoo.com/article2.htm";
2696 const char* yahoo_sports_soccer = "http://sports.yahoo.com/soccer"; 2653 const char* yahoo_sports_soccer = "http://sports.yahoo.com/soccer";
2697 const char* apple = "http://www.apple.com/"; 2654 const char* apple = "http://www.apple.com/";
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 // Verify that the second term is no longer returned as result, and also check 3333 // Verify that the second term is no longer returned as result, and also check
3377 // at the low level that it is gone for good. The term corresponding to the 3334 // at the low level that it is gone for good. The term corresponding to the
3378 // first URLRow should not be affected. 3335 // first URLRow should not be affected.
3379 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); 3336 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1));
3380 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); 3337 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2));
3381 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); 3338 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL));
3382 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); 3339 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL));
3383 } 3340 }
3384 3341
3385 } // namespace history 3342 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/thumbnail_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698