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

Side by Side Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_samples.h" 8 #include "base/metrics/histogram_samples.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Normally Wait() will not return until a main frame navigation occurs. 72 // Normally Wait() will not return until a main frame navigation occurs.
73 // If a path is set, Wait() will return after this path has been seen, 73 // If a path is set, Wait() will return after this path has been seen,
74 // regardless of the frame that navigated. Useful for multi-frame pages. 74 // regardless of the frame that navigated. Useful for multi-frame pages.
75 void SetPathToWaitFor(const std::string& path) { 75 void SetPathToWaitFor(const std::string& path) {
76 wait_for_path_ = path; 76 wait_for_path_ = path;
77 } 77 }
78 78
79 // content::WebContentsObserver: 79 // content::WebContentsObserver:
80 virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, 80 virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host,
81 const GURL& validated_url) OVERRIDE { 81 const GURL& validated_url) override {
82 if (!wait_for_path_.empty()) { 82 if (!wait_for_path_.empty()) {
83 if (validated_url.path() == wait_for_path_) 83 if (validated_url.path() == wait_for_path_)
84 message_loop_runner_->Quit(); 84 message_loop_runner_->Quit();
85 } else if (!render_frame_host->GetParent()) { 85 } else if (!render_frame_host->GetParent()) {
86 message_loop_runner_->Quit(); 86 message_loop_runner_->Quit();
87 } 87 }
88 } 88 }
89 89
90 void Wait() { message_loop_runner_->Run(); } 90 void Wait() { message_loop_runner_->Run(); }
91 91
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 infobar_service_->AddObserver(this); 138 infobar_service_->AddObserver(this);
139 } 139 }
140 140
141 virtual ~InfoBarObserver() { 141 virtual ~InfoBarObserver() {
142 if (infobar_service_) 142 if (infobar_service_)
143 infobar_service_->RemoveObserver(this); 143 infobar_service_->RemoveObserver(this);
144 } 144 }
145 145
146 private: 146 private:
147 // PromptObserver: 147 // PromptObserver:
148 virtual bool IsShowingPrompt() const OVERRIDE { 148 virtual bool IsShowingPrompt() const override {
149 return infobar_is_being_shown_; 149 return infobar_is_being_shown_;
150 } 150 }
151 151
152 virtual void AcceptImpl() const OVERRIDE { 152 virtual void AcceptImpl() const override {
153 EXPECT_EQ(1u, infobar_service_->infobar_count()); 153 EXPECT_EQ(1u, infobar_service_->infobar_count());
154 if (!infobar_service_->infobar_count()) 154 if (!infobar_service_->infobar_count())
155 return; // Let the test finish to gather possibly more diagnostics. 155 return; // Let the test finish to gather possibly more diagnostics.
156 156
157 // ConfirmInfoBarDelegate::Accept returning true means the infobar is 157 // ConfirmInfoBarDelegate::Accept returning true means the infobar is
158 // immediately closed. Checking the return value is preferred to testing 158 // immediately closed. Checking the return value is preferred to testing
159 // IsShowingPrompt() here, for it avoids the delay until the closing 159 // IsShowingPrompt() here, for it avoids the delay until the closing
160 // notification is received. 160 // notification is received.
161 EXPECT_TRUE(infobar_service_->infobar_at(0) 161 EXPECT_TRUE(infobar_service_->infobar_at(0)
162 ->delegate() 162 ->delegate()
163 ->AsConfirmInfoBarDelegate() 163 ->AsConfirmInfoBarDelegate()
164 ->Accept()); 164 ->Accept());
165 } 165 }
166 166
167 // infobars::InfoBarManager::Observer: 167 // infobars::InfoBarManager::Observer:
168 virtual void OnInfoBarAdded(infobars::InfoBar* infobar) OVERRIDE { 168 virtual void OnInfoBarAdded(infobars::InfoBar* infobar) override {
169 infobar_is_being_shown_ = true; 169 infobar_is_being_shown_ = true;
170 } 170 }
171 171
172 virtual void OnInfoBarRemoved(infobars::InfoBar* infobar, 172 virtual void OnInfoBarRemoved(infobars::InfoBar* infobar,
173 bool animate) OVERRIDE { 173 bool animate) override {
174 infobar_is_being_shown_ = false; 174 infobar_is_being_shown_ = false;
175 } 175 }
176 176
177 virtual void OnManagerShuttingDown( 177 virtual void OnManagerShuttingDown(
178 infobars::InfoBarManager* manager) OVERRIDE { 178 infobars::InfoBarManager* manager) override {
179 ASSERT_EQ(infobar_service_, manager); 179 ASSERT_EQ(infobar_service_, manager);
180 infobar_service_->RemoveObserver(this); 180 infobar_service_->RemoveObserver(this);
181 infobar_service_ = NULL; 181 infobar_service_ = NULL;
182 } 182 }
183 183
184 bool infobar_is_being_shown_; 184 bool infobar_is_being_shown_;
185 InfoBarService* infobar_service_; 185 InfoBarService* infobar_service_;
186 186
187 DISALLOW_COPY_AND_ASSIGN(InfoBarObserver); 187 DISALLOW_COPY_AND_ASSIGN(InfoBarObserver);
188 }; 188 };
189 189
190 class BubbleObserver : public PromptObserver { 190 class BubbleObserver : public PromptObserver {
191 public: 191 public:
192 explicit BubbleObserver(content::WebContents* web_contents) 192 explicit BubbleObserver(content::WebContents* web_contents)
193 : ui_controller_( 193 : ui_controller_(
194 ManagePasswordsUIController::FromWebContents(web_contents)) {} 194 ManagePasswordsUIController::FromWebContents(web_contents)) {}
195 195
196 virtual ~BubbleObserver() {} 196 virtual ~BubbleObserver() {}
197 197
198 private: 198 private:
199 // PromptObserver: 199 // PromptObserver:
200 virtual bool IsShowingPrompt() const OVERRIDE { 200 virtual bool IsShowingPrompt() const override {
201 return ui_controller_->PasswordPendingUserDecision(); 201 return ui_controller_->PasswordPendingUserDecision();
202 } 202 }
203 203
204 virtual void AcceptImpl() const OVERRIDE { 204 virtual void AcceptImpl() const override {
205 ui_controller_->SavePassword(); 205 ui_controller_->SavePassword();
206 EXPECT_FALSE(IsShowingPrompt()); 206 EXPECT_FALSE(IsShowingPrompt());
207 } 207 }
208 208
209 ManagePasswordsUIController* const ui_controller_; 209 ManagePasswordsUIController* const ui_controller_;
210 210
211 DISALLOW_COPY_AND_ASSIGN(BubbleObserver); 211 DISALLOW_COPY_AND_ASSIGN(BubbleObserver);
212 }; 212 };
213 213
214 GURL GetFileURL(const char* filename) { 214 GURL GetFileURL(const char* filename) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 258
259 // PasswordManagerBrowserTest ------------------------------------------------- 259 // PasswordManagerBrowserTest -------------------------------------------------
260 260
261 class PasswordManagerBrowserTest : public InProcessBrowserTest { 261 class PasswordManagerBrowserTest : public InProcessBrowserTest {
262 public: 262 public:
263 PasswordManagerBrowserTest() {} 263 PasswordManagerBrowserTest() {}
264 virtual ~PasswordManagerBrowserTest() {} 264 virtual ~PasswordManagerBrowserTest() {}
265 265
266 // InProcessBrowserTest: 266 // InProcessBrowserTest:
267 virtual void SetUpOnMainThread() OVERRIDE { 267 virtual void SetUpOnMainThread() override {
268 // Use TestPasswordStore to remove a possible race. Normally the 268 // Use TestPasswordStore to remove a possible race. Normally the
269 // PasswordStore does its database manipulation on the DB thread, which 269 // PasswordStore does its database manipulation on the DB thread, which
270 // creates a possible race during navigation. Specifically the 270 // creates a possible race during navigation. Specifically the
271 // PasswordManager will ignore any forms in a page if the load from the 271 // PasswordManager will ignore any forms in a page if the load from the
272 // PasswordStore has not completed. 272 // PasswordStore has not completed.
273 PasswordStoreFactory::GetInstance()->SetTestingFactory( 273 PasswordStoreFactory::GetInstance()->SetTestingFactory(
274 browser()->profile(), TestPasswordStoreService::Build); 274 browser()->profile(), TestPasswordStoreService::Build);
275 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 275 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
276 ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch( 276 ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch(
277 password_manager::switches::kEnableAutomaticPasswordSaving)); 277 password_manager::switches::kEnableAutomaticPasswordSaving));
278 } 278 }
279 279
280 virtual void TearDownOnMainThread() OVERRIDE { 280 virtual void TearDownOnMainThread() override {
281 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); 281 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
282 } 282 }
283 283
284 protected: 284 protected:
285 content::WebContents* WebContents() { 285 content::WebContents* WebContents() {
286 return browser()->tab_strip_model()->GetActiveWebContents(); 286 return browser()->tab_strip_model()->GetActiveWebContents();
287 } 287 }
288 288
289 content::RenderViewHost* RenderViewHost() { 289 content::RenderViewHost* RenderViewHost() {
290 return WebContents()->GetRenderViewHost(); 290 return WebContents()->GetRenderViewHost();
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 NavigateToFile("/password/form_with_only_password_field.html"); 1273 NavigateToFile("/password/form_with_only_password_field.html");
1274 1274
1275 // Let the user interact with the page, so that DOM gets modification events, 1275 // Let the user interact with the page, so that DOM gets modification events,
1276 // needed for autofilling fields. 1276 // needed for autofilling fields.
1277 content::SimulateMouseClickAt( 1277 content::SimulateMouseClickAt(
1278 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); 1278 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1));
1279 1279
1280 // Wait until that interaction causes the password value to be revealed. 1280 // Wait until that interaction causes the password value to be revealed.
1281 WaitForElementValue("password", "mypassword"); 1281 WaitForElementValue("password", "mypassword");
1282 } 1282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698