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

Unified Diff: chrome/browser/password_manager/password_manager_test_base.cc

Issue 2607413003: Add security feature to ProvisionalSavePassword (Closed)
Patch Set: Addressed nit. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_manager_test_base.cc
diff --git a/chrome/browser/password_manager/password_manager_test_base.cc b/chrome/browser/password_manager/password_manager_test_base.cc
index 44180f52543ecb00f87c1bb0d8c483b1448dd1ff..e8d0327ccaf2ca249f59990508be0f253846439a 100644
--- a/chrome/browser/password_manager/password_manager_test_base.cc
+++ b/chrome/browser/password_manager/password_manager_test_base.cc
@@ -25,6 +25,30 @@
#include "content/public/test/test_utils.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+namespace {
+
+// A helper class that synchronously waits until the password store handles a
+// GetLogins() request.
+class PasswordStoreResultsObserver
+ : public password_manager::PasswordStoreConsumer {
+ public:
+ PasswordStoreResultsObserver() = default;
+
+ void OnGetPasswordStoreResults(
+ std::vector<std::unique_ptr<autofill::PasswordForm>> results) override {
+ run_loop_.Quit();
+ }
+
+ void Wait() { run_loop_.Run(); }
+
+ private:
+ base::RunLoop run_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(PasswordStoreResultsObserver);
+};
+
+} // namespace
+
NavigationObserver::NavigationObserver(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
quit_on_entry_committed_(false),
@@ -230,6 +254,15 @@ void PasswordManagerBrowserTestBase::WaitForElementValue(
<< ", expected_value = " << expected_value;
}
+void PasswordManagerBrowserTestBase::WaitForPasswordStore() {
+ scoped_refptr<password_manager::PasswordStore> password_store =
+ PasswordStoreFactory::GetForProfile(browser()->profile(),
+ ServiceAccessType::IMPLICIT_ACCESS);
+ PasswordStoreResultsObserver syncer;
+ password_store->GetAutofillableLoginsWithAffiliatedRealms(&syncer);
+ syncer.Wait();
+}
+
void PasswordManagerBrowserTestBase::CheckElementValue(
const std::string& element_id,
const std::string& expected_value) {

Powered by Google App Engine
This is Rietveld 408576698