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

Side by Side Diff: chrome/browser/password_manager/password_manager_test_base.h

Issue 1151373006: Update Confirmation UI for saved password change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tiny test fix Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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 "content/public/browser/web_contents_observer.h" 11 #include "content/public/browser/web_contents_observer.h"
12 #include "content/public/test/test_utils.h" 12 #include "content/public/test/test_utils.h"
13 13
14 namespace autofill {
15 struct PasswordForm;
16 }
17
14 class NavigationObserver : public content::WebContentsObserver { 18 class NavigationObserver : public content::WebContentsObserver {
15 public: 19 public:
16 explicit NavigationObserver(content::WebContents* web_contents); 20 explicit NavigationObserver(content::WebContents* web_contents);
17 ~NavigationObserver() override; 21 ~NavigationObserver() override;
18 22
19 // Normally Wait() will not return until a main frame navigation occurs. 23 // 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, 24 // If a path is set, Wait() will return after this path has been seen,
21 // regardless of the frame that navigated. Useful for multi-frame pages. 25 // regardless of the frame that navigated. Useful for multi-frame pages.
22 void SetPathToWaitFor(const std::string& path) { wait_for_path_ = path; } 26 void SetPathToWaitFor(const std::string& path) { wait_for_path_ = path; }
23 27
(...skipping 24 matching lines...) Expand all
48 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); 52 DISALLOW_COPY_AND_ASSIGN(NavigationObserver);
49 }; 53 };
50 54
51 // Observes the save password prompt (bubble or infobar) for a specified 55 // Observes the save password prompt (bubble or infobar) for a specified
52 // WebContents, keeps track of whether or not it is currently shown, and allows 56 // WebContents, keeps track of whether or not it is currently shown, and allows
53 // accepting saving passwords through it. 57 // accepting saving passwords through it.
54 class PromptObserver { 58 class PromptObserver {
55 public: 59 public:
56 virtual ~PromptObserver(); 60 virtual ~PromptObserver();
57 61
58 // Checks if the prompt is being currently shown. 62 // Checks if the save prompt is being currently shown.
59 virtual bool IsShowingPrompt() const = 0; 63 virtual bool IsShowingPrompt() const = 0;
60 64
65 // Checks if the update prompt is being currently shown.
66 virtual bool IsShowingUpdatePrompt() const;
67
61 // Expecting that the prompt is shown, saves the password. Checks that the 68 // Expecting that the prompt is shown, saves the password. Checks that the
62 // prompt is no longer visible afterwards. 69 // prompt is no longer visible afterwards.
63 void Accept() const; 70 void Accept() const;
64 71
72 // Expecting that the prompt is shown, update |form| with the password from
73 // observed form. Checks that the prompt is no longer visible afterwards.
74 void AcceptUpdatePrompt(const autofill::PasswordForm& form) const;
75
65 // Chooses the right implementation of PromptObserver and creates an instance 76 // Chooses the right implementation of PromptObserver and creates an instance
66 // of it. 77 // of it.
67 static scoped_ptr<PromptObserver> Create(content::WebContents* web_contents); 78 static scoped_ptr<PromptObserver> Create(content::WebContents* web_contents);
68 79
69 protected: 80 protected:
70 PromptObserver(); 81 PromptObserver();
71 82
72 // Accepts the password. The implementation can assume that the prompt is 83 // Accepts the password. The implementation can assume that the prompt is
73 // currently shown, but is required to verify that the prompt is eventually 84 // currently shown, but is required to verify that the prompt is eventually
74 // closed. 85 // closed.
75 virtual void AcceptImpl() const = 0; 86 virtual void AcceptImpl() const = 0;
76 87
88 // Accepts the password update. The implementation can assume that the prompt
89 // is currently shown, but is required to verify that the prompt is eventually
90 // closed.
91 virtual void AcceptUpdatePromptImpl(
92 const autofill::PasswordForm& form) const {}
vabr (Chromium) 2015/08/04 08:59:07 Please insert a TODO comment noting that this shou
dvadym 2015/08/04 14:34:46 Done.
93
77 private: 94 private:
78 DISALLOW_COPY_AND_ASSIGN(PromptObserver); 95 DISALLOW_COPY_AND_ASSIGN(PromptObserver);
79 }; 96 };
80 97
81 class PasswordManagerBrowserTestBase : public InProcessBrowserTest { 98 class PasswordManagerBrowserTestBase : public InProcessBrowserTest {
82 public: 99 public:
83 PasswordManagerBrowserTestBase(); 100 PasswordManagerBrowserTestBase();
84 ~PasswordManagerBrowserTestBase() override; 101 ~PasswordManagerBrowserTestBase() override;
85 102
86 // InProcessBrowserTest: 103 // InProcessBrowserTest:
(...skipping 30 matching lines...) Expand all
117 134
118 // Accessors 135 // Accessors
119 content::WebContents* WebContents(); 136 content::WebContents* WebContents();
120 content::RenderViewHost* RenderViewHost(); 137 content::RenderViewHost* RenderViewHost();
121 138
122 private: 139 private:
123 DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase); 140 DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase);
124 }; 141 };
125 142
126 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ 143 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698