| 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 <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
| 14 | 15 |
| 15 namespace autofill { | 16 namespace autofill { |
| 16 struct PasswordForm; | 17 struct PasswordForm; |
| 17 } | 18 } |
| 18 | 19 |
| 19 class NavigationObserver : public content::WebContentsObserver { | 20 class NavigationObserver : public content::WebContentsObserver { |
| 20 public: | 21 public: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // Expecting that the prompt is shown, saves the password. Checks that the | 70 // Expecting that the prompt is shown, saves the password. Checks that the |
| 70 // prompt is no longer visible afterwards. | 71 // prompt is no longer visible afterwards. |
| 71 void Accept() const; | 72 void Accept() const; |
| 72 | 73 |
| 73 // Expecting that the prompt is shown, update |form| with the password from | 74 // Expecting that the prompt is shown, update |form| with the password from |
| 74 // observed form. Checks that the prompt is no longer visible afterwards. | 75 // observed form. Checks that the prompt is no longer visible afterwards. |
| 75 void AcceptUpdatePrompt(const autofill::PasswordForm& form) const; | 76 void AcceptUpdatePrompt(const autofill::PasswordForm& form) const; |
| 76 | 77 |
| 77 // Chooses the right implementation of PromptObserver and creates an instance | 78 // Chooses the right implementation of PromptObserver and creates an instance |
| 78 // of it. | 79 // of it. |
| 79 static scoped_ptr<PromptObserver> Create(content::WebContents* web_contents); | 80 static std::unique_ptr<PromptObserver> Create( |
| 81 content::WebContents* web_contents); |
| 80 | 82 |
| 81 protected: | 83 protected: |
| 82 PromptObserver(); | 84 PromptObserver(); |
| 83 | 85 |
| 84 // Accepts the password. The implementation can assume that the prompt is | 86 // Accepts the password. The implementation can assume that the prompt is |
| 85 // currently shown, but is required to verify that the prompt is eventually | 87 // currently shown, but is required to verify that the prompt is eventually |
| 86 // closed. | 88 // closed. |
| 87 virtual void AcceptImpl() const = 0; | 89 virtual void AcceptImpl() const = 0; |
| 88 | 90 |
| 89 // Accepts the password update. The implementation can assume that the prompt | 91 // Accepts the password update. The implementation can assume that the prompt |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 147 |
| 146 // Accessors | 148 // Accessors |
| 147 content::WebContents* WebContents(); | 149 content::WebContents* WebContents(); |
| 148 content::RenderViewHost* RenderViewHost(); | 150 content::RenderViewHost* RenderViewHost(); |
| 149 | 151 |
| 150 private: | 152 private: |
| 151 DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase); | 153 DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase); |
| 152 }; | 154 }; |
| 153 | 155 |
| 154 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ | 156 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ |
| OLD | NEW |