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

Side by Side Diff: chrome/browser/autofill/autofill_browsertest.cc

Issue 648653003: Standardize usage of virtual/override/final in chrome/browser/ (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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 : alerted_(false), 60 : alerted_(false),
61 has_run_message_loop_(false), 61 has_run_message_loop_(false),
62 browser_(browser), 62 browser_(browser),
63 infobar_service_(InfoBarService::FromWebContents( 63 infobar_service_(InfoBarService::FromWebContents(
64 browser_->tab_strip_model()->GetActiveWebContents())) { 64 browser_->tab_strip_model()->GetActiveWebContents())) {
65 PersonalDataManagerFactory::GetForProfile(browser_->profile())-> 65 PersonalDataManagerFactory::GetForProfile(browser_->profile())->
66 AddObserver(this); 66 AddObserver(this);
67 infobar_service_->AddObserver(this); 67 infobar_service_->AddObserver(this);
68 } 68 }
69 69
70 virtual ~WindowedPersonalDataManagerObserver() { 70 ~WindowedPersonalDataManagerObserver() override {
71 infobar_service_->RemoveObserver(this); 71 infobar_service_->RemoveObserver(this);
72 72
73 if (infobar_service_->infobar_count() > 0) { 73 if (infobar_service_->infobar_count() > 0) {
74 infobar_service_->RemoveInfoBar(infobar_service_->infobar_at(0)); 74 infobar_service_->RemoveInfoBar(infobar_service_->infobar_at(0));
75 } 75 }
76 } 76 }
77 77
78 void Wait() { 78 void Wait() {
79 if (!alerted_) { 79 if (!alerted_) {
80 has_run_message_loop_ = true; 80 has_run_message_loop_ = true;
81 content::RunMessageLoop(); 81 content::RunMessageLoop();
82 } 82 }
83 PersonalDataManagerFactory::GetForProfile(browser_->profile())-> 83 PersonalDataManagerFactory::GetForProfile(browser_->profile())->
84 RemoveObserver(this); 84 RemoveObserver(this);
85 } 85 }
86 86
87 // PersonalDataManagerObserver: 87 // PersonalDataManagerObserver:
88 virtual void OnPersonalDataChanged() override { 88 void OnPersonalDataChanged() override {
89 if (has_run_message_loop_) { 89 if (has_run_message_loop_) {
90 base::MessageLoopForUI::current()->Quit(); 90 base::MessageLoopForUI::current()->Quit();
91 has_run_message_loop_ = false; 91 has_run_message_loop_ = false;
92 } 92 }
93 alerted_ = true; 93 alerted_ = true;
94 } 94 }
95 95
96 virtual void OnInsufficientFormData() override { 96 void OnInsufficientFormData() override { OnPersonalDataChanged(); }
97 OnPersonalDataChanged();
98 }
99 97
100 // infobars::InfoBarManager::Observer: 98 // infobars::InfoBarManager::Observer:
101 virtual void OnInfoBarAdded(infobars::InfoBar* infobar) override { 99 void OnInfoBarAdded(infobars::InfoBar* infobar) override {
102 ConfirmInfoBarDelegate* infobar_delegate = 100 ConfirmInfoBarDelegate* infobar_delegate =
103 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); 101 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
104 ASSERT_TRUE(infobar_delegate); 102 ASSERT_TRUE(infobar_delegate);
105 infobar_delegate->Accept(); 103 infobar_delegate->Accept();
106 } 104 }
107 105
108 private: 106 private:
109 bool alerted_; 107 bool alerted_;
110 bool has_run_message_loop_; 108 bool has_run_message_loop_;
111 Browser* browser_; 109 Browser* browser_;
112 InfoBarService* infobar_service_; 110 InfoBarService* infobar_service_;
113 }; 111 };
114 112
115 class AutofillTest : public InProcessBrowserTest { 113 class AutofillTest : public InProcessBrowserTest {
116 protected: 114 protected:
117 AutofillTest() {} 115 AutofillTest() {}
118 116
119 virtual void SetUpOnMainThread() override { 117 void SetUpOnMainThread() override {
120 // Don't want Keychain coming up on Mac. 118 // Don't want Keychain coming up on Mac.
121 test::DisableSystemServices(browser()->profile()->GetPrefs()); 119 test::DisableSystemServices(browser()->profile()->GetPrefs());
122 } 120 }
123 121
124 virtual void TearDownOnMainThread() override { 122 void TearDownOnMainThread() override {
125 // Make sure to close any showing popups prior to tearing down the UI. 123 // Make sure to close any showing popups prior to tearing down the UI.
126 content::WebContents* web_contents = 124 content::WebContents* web_contents =
127 browser()->tab_strip_model()->GetActiveWebContents(); 125 browser()->tab_strip_model()->GetActiveWebContents();
128 AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents( 126 AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents(
129 web_contents)->autofill_manager(); 127 web_contents)->autofill_manager();
130 autofill_manager->client()->HideAutofillPopup(); 128 autofill_manager->client()->HideAutofillPopup();
131 } 129 }
132 130
133 PersonalDataManager* personal_data_manager() { 131 PersonalDataManager* personal_data_manager() {
134 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); 132 return PersonalDataManagerFactory::GetForProfile(browser()->profile());
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 IN_PROC_BROWSER_TEST_F(AutofillTest, 832 IN_PROC_BROWSER_TEST_F(AutofillTest,
835 DISABLED_MergeAggregatedDuplicatedProfiles) { 833 DISABLED_MergeAggregatedDuplicatedProfiles) {
836 int num_of_profiles = 834 int num_of_profiles =
837 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); 835 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt");
838 836
839 ASSERT_GT(num_of_profiles, 837 ASSERT_GT(num_of_profiles,
840 static_cast<int>(personal_data_manager()->GetProfiles().size())); 838 static_cast<int>(personal_data_manager()->GetProfiles().size()));
841 } 839 }
842 840
843 } // namespace autofill 841 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/zero_suggest_provider_unittest.cc ('k') | chrome/browser/autofill/autofill_cc_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698