Chromium Code Reviews| Index: chrome/browser/password_manager/password_manager_test_base.h |
| diff --git a/chrome/browser/password_manager/password_manager_test_base.h b/chrome/browser/password_manager/password_manager_test_base.h |
| index 5d36a1e02893a6b88c17e8f910422e20d9c4ae91..be6e51b7c5f707bd68e7cd32f2fb73294dec97ad 100644 |
| --- a/chrome/browser/password_manager/password_manager_test_base.h |
| +++ b/chrome/browser/password_manager/password_manager_test_base.h |
| @@ -9,6 +9,7 @@ |
| #include "base/macros.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| +#include "components/password_manager/core/browser/password_store_consumer.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "content/public/test/test_utils.h" |
| @@ -86,6 +87,24 @@ class BubbleObserver { |
| DISALLOW_COPY_AND_ASSIGN(BubbleObserver); |
| }; |
| +// A helper class that synchronously waits until the password store handles a |
| +// GetLogins() request. |
| +class PasswordStoreResultsObserver |
|
vasilii
2017/01/12 14:59:21
Is it needed in the header?
jdoerrie
2017/01/12 17:40:58
Nope. Moved it into an anonymous namespace in the
|
| + : public password_manager::PasswordStoreConsumer { |
| + public: |
| + PasswordStoreResultsObserver() = default; |
| + |
| + void OnGetPasswordStoreResults( |
| + std::vector<std::unique_ptr<autofill::PasswordForm>> results) override; |
| + |
| + void Wait(); |
| + |
| + private: |
| + base::RunLoop run_loop_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PasswordStoreResultsObserver); |
| +}; |
| + |
| class PasswordManagerBrowserTestBase : public InProcessBrowserTest { |
| public: |
| PasswordManagerBrowserTestBase(); |
| @@ -122,6 +141,9 @@ class PasswordManagerBrowserTestBase : public InProcessBrowserTest { |
| void WaitForElementValue(const std::string& iframe_id, |
| const std::string& element_id, |
| const std::string& expected_value); |
| + // Make sure that the password store processed all the previous calls which |
| + // are executed on another thread. |
| + void WaitForPasswordStore(); |
| // Checks that the current "value" attribute of the HTML element with |
| // |element_id| is equal to |expected_value|. |
| void CheckElementValue(const std::string& element_id, |