| 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 "chrome/browser/history/history_backend.h" | 5 #include "chrome/browser/history/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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 void HistoryBackendTestDelegate::DBLoaded() { | 302 void HistoryBackendTestDelegate::DBLoaded() { |
| 303 test_->loaded_ = true; | 303 test_->loaded_ = true; |
| 304 } | 304 } |
| 305 | 305 |
| 306 class HistoryBackendTest : public HistoryBackendTestBase { | 306 class HistoryBackendTest : public HistoryBackendTestBase { |
| 307 public: | 307 public: |
| 308 HistoryBackendTest() {} | 308 HistoryBackendTest() {} |
| 309 ~HistoryBackendTest() override {} | 309 ~HistoryBackendTest() override {} |
| 310 | 310 |
| 311 protected: | 311 protected: |
| 312 void AddRedirectChain(const char* sequence[], int page_id) { | 312 void AddRedirectChain(const char* sequence[], int nav_entry_id) { |
| 313 AddRedirectChainWithTransitionAndTime(sequence, page_id, | 313 AddRedirectChainWithTransitionAndTime(sequence, nav_entry_id, |
| 314 ui::PAGE_TRANSITION_LINK, | 314 ui::PAGE_TRANSITION_LINK, |
| 315 Time::Now()); | 315 Time::Now()); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void AddRedirectChainWithTransitionAndTime( | 318 void AddRedirectChainWithTransitionAndTime( |
| 319 const char* sequence[], | 319 const char* sequence[], |
| 320 int page_id, | 320 int nav_entry_id, |
| 321 ui::PageTransition transition, | 321 ui::PageTransition transition, |
| 322 base::Time time) { | 322 base::Time time) { |
| 323 history::RedirectList redirects; | 323 history::RedirectList redirects; |
| 324 for (int i = 0; sequence[i] != NULL; ++i) | 324 for (int i = 0; sequence[i] != NULL; ++i) |
| 325 redirects.push_back(GURL(sequence[i])); | 325 redirects.push_back(GURL(sequence[i])); |
| 326 | 326 |
| 327 ContextID context_id = reinterpret_cast<ContextID>(1); | 327 ContextID context_id = reinterpret_cast<ContextID>(1); |
| 328 history::HistoryAddPageArgs request( | 328 history::HistoryAddPageArgs request( |
| 329 redirects.back(), time, context_id, page_id, GURL(), | 329 redirects.back(), time, context_id, nav_entry_id, GURL(), |
| 330 redirects, transition, history::SOURCE_BROWSED, | 330 redirects, transition, history::SOURCE_BROWSED, |
| 331 true); | 331 true); |
| 332 backend_->AddPage(request); | 332 backend_->AddPage(request); |
| 333 } | 333 } |
| 334 | 334 |
| 335 // Adds CLIENT_REDIRECT page transition. | 335 // Adds CLIENT_REDIRECT page transition. |
| 336 // |url1| is the source URL and |url2| is the destination. | 336 // |url1| is the source URL and |url2| is the destination. |
| 337 // |did_replace| is true if the transition is non-user initiated and the | 337 // |did_replace| is true if the transition is non-user initiated and the |
| 338 // navigation entry for |url2| has replaced that for |url1|. The possibly | 338 // navigation entry for |url2| has replaced that for |url1|. The possibly |
| 339 // updated transition code of the visit records for |url1| and |url2| is | 339 // updated transition code of the visit records for |url1| and |url2| is |
| (...skipping 2933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3273 // Verify that the second term is no longer returned as result, and also check | 3273 // Verify that the second term is no longer returned as result, and also check |
| 3274 // at the low level that it is gone for good. The term corresponding to the | 3274 // at the low level that it is gone for good. The term corresponding to the |
| 3275 // first URLRow should not be affected. | 3275 // first URLRow should not be affected. |
| 3276 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); | 3276 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); |
| 3277 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); | 3277 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); |
| 3278 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); | 3278 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); |
| 3279 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); | 3279 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); |
| 3280 } | 3280 } |
| 3281 | 3281 |
| 3282 } // namespace history | 3282 } // namespace history |
| OLD | NEW |