Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| 11 #include "components/password_manager/core/browser/password_store_consumer.h" | |
| 12 #include "components/password_manager/core/browser/test_password_store.h" | |
|
vabr (Chromium)
2015/08/05 08:37:35
You do not need this.
xunlu
2015/08/05 18:37:13
Done.
| |
| 11 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
| 13 | 15 |
| 14 class NavigationObserver : public content::WebContentsObserver { | 16 class NavigationObserver : public content::WebContentsObserver { |
| 15 public: | 17 public: |
| 16 explicit NavigationObserver(content::WebContents* web_contents); | 18 explicit NavigationObserver(content::WebContents* web_contents); |
| 17 ~NavigationObserver() override; | 19 ~NavigationObserver() override; |
| 18 | 20 |
| 19 // Normally Wait() will not return until a main frame navigation occurs. | 21 // Normally Wait() will not return until a main frame navigation occurs. |
| 20 // If a path is set, Wait() will return after this path has been seen, | 22 // If a path is set, Wait() will return after this path has been seen, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 37 const content::LoadCommittedDetails& load_details) override; | 39 const content::LoadCommittedDetails& load_details) override; |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 std::string wait_for_path_; | 42 std::string wait_for_path_; |
| 41 bool quit_on_entry_committed_; | 43 bool quit_on_entry_committed_; |
| 42 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 44 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| 43 | 45 |
| 44 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); | 46 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); |
| 45 }; | 47 }; |
| 46 | 48 |
| 49 class PasswordStoreObserver : public password_manager::PasswordStoreConsumer { | |
|
vabr (Chromium)
2015/08/05 08:37:35
I suggest against naming the class *Observer. It c
xunlu
2015/08/05 18:37:13
Done.
| |
| 50 public: | |
| 51 explicit PasswordStoreObserver(password_manager::TestPasswordStore*); | |
|
vabr (Chromium)
2015/08/05 08:37:35
Please change TestPasswordStore references to Pass
xunlu
2015/08/05 18:37:13
Done.
| |
| 52 ~PasswordStoreObserver() override; | |
| 53 | |
| 54 // password_manager::PasswordStoreConsumer | |
| 55 void OnGetPasswordStoreResults( | |
| 56 ScopedVector<autofill::PasswordForm> results) override; | |
| 57 | |
| 58 // Wait for test_password_store_ to respond to GetLogins(); | |
| 59 void Wait(); | |
|
vabr (Chromium)
2015/08/05 08:37:35
The name is too short and vague. Also, it seems st
xunlu
2015/08/05 18:37:13
Done.
| |
| 60 | |
| 61 private: | |
| 62 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | |
| 63 password_manager::TestPasswordStore* test_password_store_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(PasswordStoreObserver); | |
| 66 }; | |
| 67 | |
| 47 // Observes the save password prompt (bubble or infobar) for a specified | 68 // Observes the save password prompt (bubble or infobar) for a specified |
| 48 // WebContents, keeps track of whether or not it is currently shown, and allows | 69 // WebContents, keeps track of whether or not it is currently shown, and allows |
| 49 // accepting saving passwords through it. | 70 // accepting saving passwords through it. |
| 50 class PromptObserver { | 71 class PromptObserver { |
| 51 public: | 72 public: |
| 52 virtual ~PromptObserver(); | 73 virtual ~PromptObserver(); |
| 53 | 74 |
| 54 // Checks if the prompt is being currently shown. | 75 // Checks if the prompt is being currently shown. |
| 55 virtual bool IsShowingPrompt() const = 0; | 76 virtual bool IsShowingPrompt() const = 0; |
| 56 | 77 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 | 134 |
| 114 // Accessors | 135 // Accessors |
| 115 content::WebContents* WebContents(); | 136 content::WebContents* WebContents(); |
| 116 content::RenderViewHost* RenderViewHost(); | 137 content::RenderViewHost* RenderViewHost(); |
| 117 | 138 |
| 118 private: | 139 private: |
| 119 DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase); | 140 DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase); |
| 120 }; | 141 }; |
| 121 | 142 |
| 122 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ | 143 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ |
| OLD | NEW |