| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/passwords_counter.h" | 5 #include "chrome/browser/browsing_data/passwords_counter.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/password_manager/password_store_factory.h" | 10 #include "chrome/browser/password_manager/password_store_factory.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return; | 80 return; |
| 81 run_loop_.reset(new base::RunLoop()); | 81 run_loop_.reset(new base::RunLoop()); |
| 82 run_loop_->Run(); | 82 run_loop_->Run(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 BrowsingDataCounter::ResultInt GetResult() { | 85 BrowsingDataCounter::ResultInt GetResult() { |
| 86 DCHECK(finished_); | 86 DCHECK(finished_); |
| 87 return result_; | 87 return result_; |
| 88 } | 88 } |
| 89 | 89 |
| 90 void Callback(bool finished, BrowsingDataCounter::ResultInt count) { | 90 void Callback(scoped_ptr<BrowsingDataCounter::Result> result) { |
| 91 finished_ = finished; | 91 finished_ = result->finished(); |
| 92 result_ = count; | 92 result_ = result->value(); |
| 93 if (run_loop_ && finished) | 93 |
| 94 if (run_loop_ && finished_) |
| 94 run_loop_->Quit(); | 95 run_loop_->Quit(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 private: | 98 private: |
| 98 PasswordForm CreateCredentials(const std::string& origin, | 99 PasswordForm CreateCredentials(const std::string& origin, |
| 99 const std::string& username, | 100 const std::string& username, |
| 100 bool blacklisted) { | 101 bool blacklisted) { |
| 101 PasswordForm result; | 102 PasswordForm result; |
| 102 result.signon_realm = origin; | 103 result.signon_realm = origin; |
| 103 result.origin = GURL(origin); | 104 result.origin = GURL(origin); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 SetDeletionPeriodPref(BrowsingDataRemover::FOUR_WEEKS); | 239 SetDeletionPeriodPref(BrowsingDataRemover::FOUR_WEEKS); |
| 239 WaitForCounting(); | 240 WaitForCounting(); |
| 240 EXPECT_EQ(3u, GetResult()); | 241 EXPECT_EQ(3u, GetResult()); |
| 241 | 242 |
| 242 SetDeletionPeriodPref(BrowsingDataRemover::EVERYTHING); | 243 SetDeletionPeriodPref(BrowsingDataRemover::EVERYTHING); |
| 243 WaitForCounting(); | 244 WaitForCounting(); |
| 244 EXPECT_EQ(4u, GetResult()); | 245 EXPECT_EQ(4u, GetResult()); |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace | 248 } // namespace |
| OLD | NEW |