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

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

Issue 1420013004: Polish the result communication and display of the browsing data counters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 5 years, 1 month 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
OLDNEW
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
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
93 if (run_loop_ && finished) 93 if (finished_) {
94 result_ = static_cast<BrowsingDataCounter::FinishedResult*>(
95 result.get())->Value();
96 }
97
98 if (run_loop_ && finished_)
94 run_loop_->Quit(); 99 run_loop_->Quit();
95 } 100 }
96 101
97 private: 102 private:
98 PasswordForm CreateCredentials(const std::string& origin, 103 PasswordForm CreateCredentials(const std::string& origin,
99 const std::string& username, 104 const std::string& username,
100 bool blacklisted) { 105 bool blacklisted) {
101 PasswordForm result; 106 PasswordForm result;
102 result.signon_realm = origin; 107 result.signon_realm = origin;
103 result.origin = GURL(origin); 108 result.origin = GURL(origin);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 SetDeletionPeriodPref(BrowsingDataRemover::FOUR_WEEKS); 243 SetDeletionPeriodPref(BrowsingDataRemover::FOUR_WEEKS);
239 WaitForCounting(); 244 WaitForCounting();
240 EXPECT_EQ(3u, GetResult()); 245 EXPECT_EQ(3u, GetResult());
241 246
242 SetDeletionPeriodPref(BrowsingDataRemover::EVERYTHING); 247 SetDeletionPeriodPref(BrowsingDataRemover::EVERYTHING);
243 WaitForCounting(); 248 WaitForCounting();
244 EXPECT_EQ(4u, GetResult()); 249 EXPECT_EQ(4u, GetResult());
245 } 250 }
246 251
247 } // namespace 252 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698