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

Side by Side Diff: chrome/browser/browsing_data_remover_unittest.cc

Issue 10782004: Removing usage of profile_->GetHistory() from the codebase in order to remove that function. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
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/browsing_data_remover.h" 5 #include "chrome/browser/browsing_data_remover.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/platform_file.h" 15 #include "base/platform_file.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/browsing_data_helper.h" 17 #include "chrome/browser/browsing_data_helper.h"
18 #include "chrome/browser/extensions/mock_extension_special_storage_policy.h" 18 #include "chrome/browser/extensions/mock_extension_special_storage_policy.h"
19 #include "chrome/browser/history/history.h" 19 #include "chrome/browser/history/history.h"
20 #include "chrome/browser/history/history_service_factory.h"
20 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 21 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
21 #include "chrome/common/chrome_notification_types.h" 22 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "chrome/test/base/testing_browser_process.h" 24 #include "chrome/test/base/testing_browser_process.h"
24 #include "chrome/test/base/testing_pref_service.h" 25 #include "chrome/test/base/testing_pref_service.h"
25 #include "chrome/test/base/testing_profile.h" 26 #include "chrome/test/base/testing_profile.h"
26 #include "content/public/browser/dom_storage_context.h" 27 #include "content/public/browser/dom_storage_context.h"
27 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
28 #include "content/public/test/test_browser_thread.h" 29 #include "content/public/test/test_browser_thread.h"
29 #include "net/base/server_bound_cert_service.h" 30 #include "net/base/server_bound_cert_service.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 std::string cert_; 261 std::string cert_;
261 262
262 DISALLOW_COPY_AND_ASSIGN(RemoveServerBoundCertTester); 263 DISALLOW_COPY_AND_ASSIGN(RemoveServerBoundCertTester);
263 }; 264 };
264 265
265 class RemoveHistoryTester : public BrowsingDataRemoverTester { 266 class RemoveHistoryTester : public BrowsingDataRemoverTester {
266 public: 267 public:
267 explicit RemoveHistoryTester(TestingProfile* profile) 268 explicit RemoveHistoryTester(TestingProfile* profile)
268 : query_url_success_(false) { 269 : query_url_success_(false) {
269 profile->CreateHistoryService(true, false); 270 profile->CreateHistoryService(true, false);
270 history_service_ = profile->GetHistoryService(Profile::EXPLICIT_ACCESS); 271 history_service_ = HistoryServiceFactory::GetForProfile(
272 profile, Profile::EXPLICIT_ACCESS);
271 } 273 }
272 274
273 // Returns true, if the given URL exists in the history service. 275 // Returns true, if the given URL exists in the history service.
274 bool HistoryContainsURL(const GURL& url) { 276 bool HistoryContainsURL(const GURL& url) {
275 history_service_->QueryURL( 277 history_service_->QueryURL(
276 url, 278 url,
277 true, 279 true,
278 &consumer_, 280 &consumer_,
279 base::Bind(&RemoveHistoryTester::SaveResultAndQuit, 281 base::Bind(&RemoveHistoryTester::SaveResultAndQuit,
280 base::Unretained(this))); 282 base::Unretained(this)));
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 ASSERT_TRUE(tester->HistoryContainsURL(kOrigin2)); 1147 ASSERT_TRUE(tester->HistoryContainsURL(kOrigin2));
1146 1148
1147 BlockUntilOriginDataRemoved(BrowsingDataRemover::LAST_HOUR, 1149 BlockUntilOriginDataRemoved(BrowsingDataRemover::LAST_HOUR,
1148 BrowsingDataRemover::REMOVE_HISTORY, kOrigin2, tester.get()); 1150 BrowsingDataRemover::REMOVE_HISTORY, kOrigin2, tester.get());
1149 1151
1150 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); 1152 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask());
1151 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1153 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1152 EXPECT_TRUE(tester->HistoryContainsURL(kOrigin1)); 1154 EXPECT_TRUE(tester->HistoryContainsURL(kOrigin1));
1153 EXPECT_TRUE(tester->HistoryContainsURL(kOrigin2)); 1155 EXPECT_TRUE(tester->HistoryContainsURL(kOrigin2));
1154 } 1156 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover.cc ('k') | chrome/browser/custom_home_pages_table_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698