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

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

Issue 872313005: Remove dependency on visitedlink from history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@init-prefs
Patch Set: Rebase Created 5 years, 10 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 | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/history/history_service.h » ('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 "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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/files/file_util.h" 16 #include "base/files/file_util.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/path_service.h" 19 #include "base/path_service.h"
20 #include "base/prefs/pref_service.h" 20 #include "base/prefs/pref_service.h"
21 #include "base/run_loop.h" 21 #include "base/run_loop.h"
22 #include "base/strings/string16.h" 22 #include "base/strings/string16.h"
23 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "chrome/browser/history/content_visit_delegate.h"
25 #include "chrome/browser/history/history_service.h" 26 #include "chrome/browser/history/history_service.h"
26 #include "chrome/browser/history/history_service_factory.h" 27 #include "chrome/browser/history/history_service_factory.h"
27 #include "chrome/browser/history/in_memory_history_backend.h" 28 #include "chrome/browser/history/in_memory_history_backend.h"
28 #include "chrome/common/chrome_constants.h" 29 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
31 #include "chrome/test/base/testing_profile.h" 32 #include "chrome/test/base/testing_profile.h"
32 #include "components/favicon_base/favicon_usage_data.h" 33 #include "components/favicon_base/favicon_usage_data.h"
33 #include "components/history/core/browser/history_constants.h" 34 #include "components/history/core/browser/history_constants.h"
34 #include "components/history/core/browser/history_database_params.h" 35 #include "components/history/core/browser/history_database_params.h"
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 3035
3035 // Simple test that removes a bookmark. This test exercises the code paths in 3036 // Simple test that removes a bookmark. This test exercises the code paths in
3036 // History that block till bookmark bar model is loaded. 3037 // History that block till bookmark bar model is loaded.
3037 TEST_F(HistoryBackendTest, RemoveNotification) { 3038 TEST_F(HistoryBackendTest, RemoveNotification) {
3038 scoped_ptr<TestingProfile> profile(new TestingProfile()); 3039 scoped_ptr<TestingProfile> profile(new TestingProfile());
3039 3040
3040 // Add a URL. 3041 // Add a URL.
3041 GURL url("http://www.google.com"); 3042 GURL url("http://www.google.com");
3042 HistoryClientMock history_client; 3043 HistoryClientMock history_client;
3043 history_client.AddBookmark(url); 3044 history_client.AddBookmark(url);
3044 scoped_ptr<HistoryService> service( 3045 scoped_ptr<HistoryService> service(new HistoryService(
3045 new HistoryService(&history_client, profile.get())); 3046 &history_client, scoped_ptr<history::VisitDelegate>()));
3046 EXPECT_TRUE( 3047 EXPECT_TRUE(
3047 service->Init(profile->GetPrefs()->GetString(prefs::kAcceptLanguages), 3048 service->Init(profile->GetPrefs()->GetString(prefs::kAcceptLanguages),
3048 TestHistoryDatabaseParamsForPath(profile->GetPath()))); 3049 TestHistoryDatabaseParamsForPath(profile->GetPath())));
3049 3050
3050 service->AddPage( 3051 service->AddPage(
3051 url, base::Time::Now(), NULL, 1, GURL(), RedirectList(), 3052 url, base::Time::Now(), NULL, 1, GURL(), RedirectList(),
3052 ui::PAGE_TRANSITION_TYPED, SOURCE_BROWSED, false); 3053 ui::PAGE_TRANSITION_TYPED, SOURCE_BROWSED, false);
3053 3054
3054 // This won't actually delete the URL, rather it'll empty out the visits. 3055 // This won't actually delete the URL, rather it'll empty out the visits.
3055 // This triggers blocking on the BookmarkModel. 3056 // This triggers blocking on the BookmarkModel.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3289 // Verify that the second term is no longer returned as result, and also check 3290 // Verify that the second term is no longer returned as result, and also check
3290 // at the low level that it is gone for good. The term corresponding to the 3291 // at the low level that it is gone for good. The term corresponding to the
3291 // first URLRow should not be affected. 3292 // first URLRow should not be affected.
3292 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); 3293 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1));
3293 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); 3294 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2));
3294 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); 3295 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL));
3295 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); 3296 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL));
3296 } 3297 }
3297 3298
3298 } // namespace history 3299 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/history/history_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698