| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3097 | 3097 |
| 3098 TEST_F(HistoryBackendTest, TopHosts_IgnoreUnusualURLs) { | 3098 TEST_F(HistoryBackendTest, TopHosts_IgnoreUnusualURLs) { |
| 3099 std::vector<GURL> urls; | 3099 std::vector<GURL> urls; |
| 3100 urls.push_back(GURL("http://cnn.com/us")); | 3100 urls.push_back(GURL("http://cnn.com/us")); |
| 3101 urls.push_back(GURL("ftp://cnn.com/intl")); | 3101 urls.push_back(GURL("ftp://cnn.com/intl")); |
| 3102 urls.push_back(GURL("https://cnn.com/sports")); | 3102 urls.push_back(GURL("https://cnn.com/sports")); |
| 3103 urls.push_back( | 3103 urls.push_back( |
| 3104 GURL("chrome-extension://nghiiepjnjgjeolabmjjceablnkpkjde/options.html")); | 3104 GURL("chrome-extension://nghiiepjnjgjeolabmjjceablnkpkjde/options.html")); |
| 3105 urls.push_back(GURL("file:///home/foobar/tmp/baz.html")); | 3105 urls.push_back(GURL("file:///home/foobar/tmp/baz.html")); |
| 3106 urls.push_back(GURL("data:text/plain,Hello%20world%21")); | 3106 urls.push_back(GURL("data:text/plain,Hello%20world%21")); |
| 3107 urls.push_back(GURL("chrome://memory")); | 3107 urls.push_back(GURL("chrome://version")); |
| 3108 urls.push_back(GURL("about:mammon")); | 3108 urls.push_back(GURL("about:mammon")); |
| 3109 for (const GURL& url : urls) { | 3109 for (const GURL& url : urls) { |
| 3110 backend_->AddPageVisit(url, base::Time::Now(), 0, ui::PAGE_TRANSITION_LINK, | 3110 backend_->AddPageVisit(url, base::Time::Now(), 0, ui::PAGE_TRANSITION_LINK, |
| 3111 history::SOURCE_BROWSED); | 3111 history::SOURCE_BROWSED); |
| 3112 } | 3112 } |
| 3113 | 3113 |
| 3114 EXPECT_THAT(backend_->TopHosts(5), ElementsAre(std::make_pair("cnn.com", 3))); | 3114 EXPECT_THAT(backend_->TopHosts(5), ElementsAre(std::make_pair("cnn.com", 3))); |
| 3115 } | 3115 } |
| 3116 | 3116 |
| 3117 TEST_F(HistoryBackendTest, HostRankIfAvailable) { | 3117 TEST_F(HistoryBackendTest, HostRankIfAvailable) { |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3738 // Verify that the second term is no longer returned as result, and also check | 3738 // Verify that the second term is no longer returned as result, and also check |
| 3739 // at the low level that it is gone for good. The term corresponding to the | 3739 // at the low level that it is gone for good. The term corresponding to the |
| 3740 // first URLRow should not be affected. | 3740 // first URLRow should not be affected. |
| 3741 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); | 3741 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); |
| 3742 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); | 3742 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); |
| 3743 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); | 3743 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); |
| 3744 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); | 3744 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); |
| 3745 } | 3745 } |
| 3746 | 3746 |
| 3747 } // namespace history | 3747 } // namespace history |
| OLD | NEW |