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

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

Issue 330703005: Revert of Change HistoryService::QueryURL to use CancelableTaskTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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/custom_home_pages_table_model.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/browsing_data/browsing_data_remover.h" 5 #include "chrome/browser/browsing_data/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_util.h" 12 #include "base/file_util.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/guid.h" 14 #include "base/guid.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/prefs/testing_pref_service.h" 16 #include "base/prefs/testing_pref_service.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/task/cancelable_task_tracker.h"
19 #include "chrome/browser/autofill/personal_data_manager_factory.h" 18 #include "chrome/browser/autofill/personal_data_manager_factory.h"
20 #include "chrome/browser/browsing_data/browsing_data_helper.h" 19 #include "chrome/browser/browsing_data/browsing_data_helper.h"
21 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" 20 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
22 #include "chrome/browser/chrome_notification_types.h" 21 #include "chrome/browser/chrome_notification_types.h"
23 #if defined(OS_CHROMEOS) 22 #if defined(OS_CHROMEOS)
24 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" 23 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
25 #include "chrome/browser/chromeos/login/users/user_manager.h" 24 #include "chrome/browser/chromeos/login/users/user_manager.h"
26 #include "chrome/browser/chromeos/settings/cros_settings.h" 25 #include "chrome/browser/chromeos/settings/cros_settings.h"
27 #include "chrome/browser/chromeos/settings/device_settings_service.h" 26 #include "chrome/browser/chromeos/settings/device_settings_service.h"
28 #endif 27 #endif
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 377 }
379 378
380 // Returns true, if the given URL exists in the history service. 379 // Returns true, if the given URL exists in the history service.
381 bool HistoryContainsURL(const GURL& url) { 380 bool HistoryContainsURL(const GURL& url) {
382 scoped_refptr<content::MessageLoopRunner> message_loop_runner = 381 scoped_refptr<content::MessageLoopRunner> message_loop_runner =
383 new content::MessageLoopRunner; 382 new content::MessageLoopRunner;
384 quit_closure_ = message_loop_runner->QuitClosure(); 383 quit_closure_ = message_loop_runner->QuitClosure();
385 history_service_->QueryURL( 384 history_service_->QueryURL(
386 url, 385 url,
387 true, 386 true,
387 &consumer_,
388 base::Bind(&RemoveHistoryTester::SaveResultAndQuit, 388 base::Bind(&RemoveHistoryTester::SaveResultAndQuit,
389 base::Unretained(this)), 389 base::Unretained(this)));
390 &tracker_);
391 message_loop_runner->Run(); 390 message_loop_runner->Run();
392 return query_url_success_; 391 return query_url_success_;
393 } 392 }
394 393
395 void AddHistory(const GURL& url, base::Time time) { 394 void AddHistory(const GURL& url, base::Time time) {
396 history_service_->AddPage(url, time, NULL, 0, GURL(), 395 history_service_->AddPage(url, time, NULL, 0, GURL(),
397 history::RedirectList(), content::PAGE_TRANSITION_LINK, 396 history::RedirectList(), content::PAGE_TRANSITION_LINK,
398 history::SOURCE_BROWSED, false); 397 history::SOURCE_BROWSED, false);
399 } 398 }
400 399
401 private: 400 private:
402 // Callback for HistoryService::QueryURL. 401 // Callback for HistoryService::QueryURL.
403 void SaveResultAndQuit(bool success, 402 void SaveResultAndQuit(HistoryService::Handle,
404 const history::URLRow&, 403 bool success,
405 const history::VisitVector&) { 404 const history::URLRow*,
405 history::VisitVector*) {
406 query_url_success_ = success; 406 query_url_success_ = success;
407 quit_closure_.Run(); 407 quit_closure_.Run();
408 } 408 }
409 409
410 // For History requests. 410 // For History requests.
411 base::CancelableTaskTracker tracker_; 411 CancelableRequestConsumer consumer_;
412 bool query_url_success_; 412 bool query_url_success_;
413 base::Closure quit_closure_; 413 base::Closure quit_closure_;
414 414
415 // TestingProfile owns the history service; we shouldn't delete it. 415 // TestingProfile owns the history service; we shouldn't delete it.
416 HistoryService* history_service_; 416 HistoryService* history_service_;
417 417
418 DISALLOW_COPY_AND_ASSIGN(RemoveHistoryTester); 418 DISALLOW_COPY_AND_ASSIGN(RemoveHistoryTester);
419 }; 419 };
420 420
421 class RemoveAutofillTester : public autofill::PersonalDataManagerObserver { 421 class RemoveAutofillTester : public autofill::PersonalDataManagerObserver {
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 } 1687 }
1688 1688
1689 TEST_F(BrowsingDataRemoverTest, DomainReliability_Contexts_ProtectedOrigins) { 1689 TEST_F(BrowsingDataRemoverTest, DomainReliability_Contexts_ProtectedOrigins) {
1690 DomainReliabilityMonitor* monitor = UseProfileWithDomainReliabilityMonitor(); 1690 DomainReliabilityMonitor* monitor = UseProfileWithDomainReliabilityMonitor();
1691 BlockUntilBrowsingDataRemoved( 1691 BlockUntilBrowsingDataRemoved(
1692 BrowsingDataRemover::EVERYTHING, 1692 BrowsingDataRemover::EVERYTHING,
1693 BrowsingDataRemover::REMOVE_COOKIES, true); 1693 BrowsingDataRemover::REMOVE_COOKIES, true);
1694 EXPECT_TRUE(monitor->was_cleared_for_testing()); 1694 EXPECT_TRUE(monitor->was_cleared_for_testing());
1695 EXPECT_EQ(CLEAR_CONTEXTS, monitor->cleared_mode_for_testing()); 1695 EXPECT_EQ(CLEAR_CONTEXTS, monitor->cleared_mode_for_testing());
1696 } 1696 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/custom_home_pages_table_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698