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

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

Issue 1271053002: [PasswordManager] Fix Flaky BrowserTest related to dynamically created (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 "components/password_manager/core/browser/password_store_consumer.h"
11 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
12 #include "content/public/test/test_utils.h" 13 #include "content/public/test/test_utils.h"
13 14
14 namespace autofill { 15 namespace autofill {
15 struct PasswordForm; 16 struct PasswordForm;
16 } 17 }
17 18
19 namespace password_manager {
20 class PasswordStore;
21 }
22
18 class NavigationObserver : public content::WebContentsObserver { 23 class NavigationObserver : public content::WebContentsObserver {
19 public: 24 public:
20 explicit NavigationObserver(content::WebContents* web_contents); 25 explicit NavigationObserver(content::WebContents* web_contents);
21 ~NavigationObserver() override; 26 ~NavigationObserver() override;
22 27
23 // Normally Wait() will not return until a main frame navigation occurs. 28 // Normally Wait() will not return until a main frame navigation occurs.
24 // If a path is set, Wait() will return after this path has been seen, 29 // If a path is set, Wait() will return after this path has been seen,
25 // regardless of the frame that navigated. Useful for multi-frame pages. 30 // regardless of the frame that navigated. Useful for multi-frame pages.
26 void SetPathToWaitFor(const std::string& path) { wait_for_path_ = path; } 31 void SetPathToWaitFor(const std::string& path) { wait_for_path_ = path; }
27 32
(...skipping 17 matching lines...) Expand all
45 50
46 private: 51 private:
47 std::string wait_for_path_; 52 std::string wait_for_path_;
48 content::RenderFrameHost* render_frame_host_; 53 content::RenderFrameHost* render_frame_host_;
49 bool quit_on_entry_committed_; 54 bool quit_on_entry_committed_;
50 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; 55 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
51 56
52 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); 57 DISALLOW_COPY_AND_ASSIGN(NavigationObserver);
53 }; 58 };
54 59
60 class DummyStoreConsumer : public password_manager::PasswordStoreConsumer {
61 public:
62 DummyStoreConsumer();
63 ~DummyStoreConsumer() override;
64
65 // password_manager::PasswordStoreConsumer
66 void OnGetPasswordStoreResults(
67 ScopedVector<autofill::PasswordForm> results) override;
68
69 // Make a dummy GetLogins() request ot |password_store| and wait for its
70 // response
71 void RequestLoginsAndWait(
72 scoped_refptr<password_manager::PasswordStore> password_store);
73
74 private:
75 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
76
77 DISALLOW_COPY_AND_ASSIGN(DummyStoreConsumer);
78 };
79
55 // Observes the save password prompt (bubble or infobar) for a specified 80 // Observes the save password prompt (bubble or infobar) for a specified
56 // WebContents, keeps track of whether or not it is currently shown, and allows 81 // WebContents, keeps track of whether or not it is currently shown, and allows
57 // accepting saving passwords through it. 82 // accepting saving passwords through it.
58 class PromptObserver { 83 class PromptObserver {
59 public: 84 public:
60 virtual ~PromptObserver(); 85 virtual ~PromptObserver();
61 86
62 // Checks if the save prompt is being currently shown. 87 // Checks if the save prompt is being currently shown.
63 virtual bool IsShowingPrompt() const = 0; 88 virtual bool IsShowingPrompt() const = 0;
64 89
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 161
137 // Accessors 162 // Accessors
138 content::WebContents* WebContents(); 163 content::WebContents* WebContents();
139 content::RenderViewHost* RenderViewHost(); 164 content::RenderViewHost* RenderViewHost();
140 165
141 private: 166 private:
142 DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase); 167 DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase);
143 }; 168 };
144 169
145 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_ 170 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698