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

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

Issue 659563005: Standardize usage of virtual/override/final in chrome/browser/password_manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 6 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" 8 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace { 23 namespace {
24 24
25 class TestPopupObserver : public autofill::PasswordGenerationPopupObserver { 25 class TestPopupObserver : public autofill::PasswordGenerationPopupObserver {
26 public: 26 public:
27 TestPopupObserver() 27 TestPopupObserver()
28 : popup_showing_(false), 28 : popup_showing_(false),
29 password_visible_(false) {} 29 password_visible_(false) {}
30 virtual ~TestPopupObserver() {} 30 virtual ~TestPopupObserver() {}
31 31
32 virtual void OnPopupShown(bool password_visible) override { 32 void OnPopupShown(bool password_visible) override {
33 popup_showing_ = true; 33 popup_showing_ = true;
34 password_visible_ = password_visible; 34 password_visible_ = password_visible;
35 } 35 }
36 36
37 virtual void OnPopupHidden() override { 37 void OnPopupHidden() override { popup_showing_ = false; }
38 popup_showing_ = false;
39 }
40 38
41 bool popup_showing() { return popup_showing_; } 39 bool popup_showing() { return popup_showing_; }
42 bool password_visible() { return password_visible_; } 40 bool password_visible() { return password_visible_; }
43 41
44 private: 42 private:
45 bool popup_showing_; 43 bool popup_showing_;
46 bool password_visible_; 44 bool password_visible_;
47 }; 45 };
48 46
49 } // namespace 47 } // namespace
50 48
51 class PasswordGenerationInteractiveTest : public InProcessBrowserTest { 49 class PasswordGenerationInteractiveTest : public InProcessBrowserTest {
52 public: 50 public:
53 virtual void SetUpCommandLine(CommandLine* command_line) override { 51 void SetUpCommandLine(CommandLine* command_line) override {
54 // Make sure the feature is enabled. 52 // Make sure the feature is enabled.
55 command_line->AppendSwitch(autofill::switches::kEnablePasswordGeneration); 53 command_line->AppendSwitch(autofill::switches::kEnablePasswordGeneration);
56 54
57 // Don't require ping from autofill or blacklist checking. 55 // Don't require ping from autofill or blacklist checking.
58 command_line->AppendSwitch( 56 command_line->AppendSwitch(
59 autofill::switches::kLocalHeuristicsOnlyForPasswordGeneration); 57 autofill::switches::kLocalHeuristicsOnlyForPasswordGeneration);
60 } 58 }
61 59
62 virtual void SetUpOnMainThread() override { 60 void SetUpOnMainThread() override {
63 // Disable Autofill requesting access to AddressBook data. This will cause 61 // Disable Autofill requesting access to AddressBook data. This will cause
64 // the tests to hang on Mac. 62 // the tests to hang on Mac.
65 autofill::test::DisableSystemServices(browser()->profile()->GetPrefs()); 63 autofill::test::DisableSystemServices(browser()->profile()->GetPrefs());
66 64
67 // Set observer for popup. 65 // Set observer for popup.
68 ChromePasswordManagerClient* client = 66 ChromePasswordManagerClient* client =
69 ChromePasswordManagerClient::FromWebContents(GetWebContents()); 67 ChromePasswordManagerClient::FromWebContents(GetWebContents());
70 client->SetTestObserver(&observer_); 68 client->SetTestObserver(&observer_);
71 69
72 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 70 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
73 GURL url = embedded_test_server()->GetURL("/password/signup_form.html"); 71 GURL url = embedded_test_server()->GetURL("/password/signup_form.html");
74 ui_test_utils::NavigateToURL(browser(), url); 72 ui_test_utils::NavigateToURL(browser(), url);
75 } 73 }
76 74
77 virtual void TearDownOnMainThread() override { 75 void TearDownOnMainThread() override {
78 // Clean up UI. 76 // Clean up UI.
79 ChromePasswordManagerClient* client = 77 ChromePasswordManagerClient* client =
80 ChromePasswordManagerClient::FromWebContents(GetWebContents()); 78 ChromePasswordManagerClient::FromWebContents(GetWebContents());
81 client->HidePasswordGenerationPopup(); 79 client->HidePasswordGenerationPopup();
82 } 80 }
83 81
84 content::WebContents* GetWebContents() { 82 content::WebContents* GetWebContents() {
85 return browser()->tab_strip_model()->GetActiveWebContents(); 83 return browser()->tab_strip_model()->GetActiveWebContents();
86 } 84 }
87 85
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, 182 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest,
185 MAYBE_PopupShownAndDismissedByScrolling) { 183 MAYBE_PopupShownAndDismissedByScrolling) {
186 FocusPasswordField(); 184 FocusPasswordField();
187 EXPECT_TRUE(GenerationPopupShowing()); 185 EXPECT_TRUE(GenerationPopupShowing());
188 186
189 ASSERT_TRUE(content::ExecuteScript(GetRenderViewHost(), 187 ASSERT_TRUE(content::ExecuteScript(GetRenderViewHost(),
190 "window.scrollTo(100, 0);")); 188 "window.scrollTo(100, 0);"));
191 189
192 EXPECT_FALSE(GenerationPopupShowing()); 190 EXPECT_FALSE(GenerationPopupShowing());
193 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698