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

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

Issue 870143004: HistoryService::Init() receives the list of languages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-history-service
Patch Set: Address comments 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 | « no previous file | chrome/browser/history/history_querying_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 "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/run_loop.h" 21 #include "base/run_loop.h"
21 #include "base/strings/string16.h" 22 #include "base/strings/string16.h"
22 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
24 #include "chrome/browser/history/history_service.h" 25 #include "chrome/browser/history/history_service.h"
25 #include "chrome/browser/history/history_service_factory.h" 26 #include "chrome/browser/history/history_service_factory.h"
26 #include "chrome/browser/history/in_memory_history_backend.h" 27 #include "chrome/browser/history/in_memory_history_backend.h"
27 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
28 #include "chrome/common/chrome_paths.h" 29 #include "chrome/common/chrome_paths.h"
29 #include "chrome/common/importer/imported_favicon_usage.h" 30 #include "chrome/common/importer/imported_favicon_usage.h"
31 #include "chrome/common/pref_names.h"
30 #include "chrome/test/base/testing_profile.h" 32 #include "chrome/test/base/testing_profile.h"
31 #include "components/history/core/browser/history_constants.h" 33 #include "components/history/core/browser/history_constants.h"
32 #include "components/history/core/browser/history_database_params.h" 34 #include "components/history/core/browser/history_database_params.h"
33 #include "components/history/core/browser/history_service_observer.h" 35 #include "components/history/core/browser/history_service_observer.h"
34 #include "components/history/core/browser/in_memory_database.h" 36 #include "components/history/core/browser/in_memory_database.h"
35 #include "components/history/core/browser/keyword_search_term.h" 37 #include "components/history/core/browser/keyword_search_term.h"
36 #include "components/history/core/browser/visit_filter.h" 38 #include "components/history/core/browser/visit_filter.h"
37 #include "components/history/core/test/history_client_fake_bookmarks.h" 39 #include "components/history/core/test/history_client_fake_bookmarks.h"
38 #include "components/history/core/test/test_history_database.h" 40 #include "components/history/core/test/test_history_database.h"
39 #include "content/public/test/test_browser_thread.h" 41 #include "content/public/test/test_browser_thread.h"
(...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 TEST_F(HistoryBackendTest, RemoveNotification) { 3037 TEST_F(HistoryBackendTest, RemoveNotification) {
3036 scoped_ptr<TestingProfile> profile(new TestingProfile()); 3038 scoped_ptr<TestingProfile> profile(new TestingProfile());
3037 3039
3038 // Add a URL. 3040 // Add a URL.
3039 GURL url("http://www.google.com"); 3041 GURL url("http://www.google.com");
3040 HistoryClientMock history_client; 3042 HistoryClientMock history_client;
3041 history_client.AddBookmark(url); 3043 history_client.AddBookmark(url);
3042 scoped_ptr<HistoryService> service( 3044 scoped_ptr<HistoryService> service(
3043 new HistoryService(&history_client, profile.get())); 3045 new HistoryService(&history_client, profile.get()));
3044 EXPECT_TRUE( 3046 EXPECT_TRUE(
3045 service->Init(TestHistoryDatabaseParamsForPath(profile->GetPath()))); 3047 service->Init(profile->GetPrefs()->GetString(prefs::kAcceptLanguages),
3048 TestHistoryDatabaseParamsForPath(profile->GetPath())));
3046 3049
3047 service->AddPage( 3050 service->AddPage(
3048 url, base::Time::Now(), NULL, 1, GURL(), RedirectList(), 3051 url, base::Time::Now(), NULL, 1, GURL(), RedirectList(),
3049 ui::PAGE_TRANSITION_TYPED, SOURCE_BROWSED, false); 3052 ui::PAGE_TRANSITION_TYPED, SOURCE_BROWSED, false);
3050 3053
3051 // This won't actually delete the URL, rather it'll empty out the visits. 3054 // This won't actually delete the URL, rather it'll empty out the visits.
3052 // This triggers blocking on the BookmarkModel. 3055 // This triggers blocking on the BookmarkModel.
3053 EXPECT_CALL(history_client, BlockUntilBookmarksLoaded()); 3056 EXPECT_CALL(history_client, BlockUntilBookmarksLoaded());
3054 service->DeleteURL(url); 3057 service->DeleteURL(url);
3055 } 3058 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 // Verify that the second term is no longer returned as result, and also check 3289 // Verify that the second term is no longer returned as result, and also check
3287 // at the low level that it is gone for good. The term corresponding to the 3290 // at the low level that it is gone for good. The term corresponding to the
3288 // first URLRow should not be affected. 3291 // first URLRow should not be affected.
3289 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); 3292 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1));
3290 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); 3293 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2));
3291 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); 3294 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL));
3292 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); 3295 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL));
3293 } 3296 }
3294 3297
3295 } // namespace history 3298 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/history_querying_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698