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

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: Fixes. 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 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698