OLD | NEW |
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual 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 virtual void OnInsufficientFormData() override { |
97 OnPersonalDataChanged(); | 97 OnPersonalDataChanged(); |
98 } | 98 } |
99 | 99 |
100 // infobars::InfoBarManager::Observer: | 100 // infobars::InfoBarManager::Observer: |
101 virtual void OnInfoBarAdded(infobars::InfoBar* infobar) OVERRIDE { | 101 virtual void OnInfoBarAdded(infobars::InfoBar* infobar) override { |
102 ConfirmInfoBarDelegate* infobar_delegate = | 102 ConfirmInfoBarDelegate* infobar_delegate = |
103 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); | 103 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); |
104 ASSERT_TRUE(infobar_delegate); | 104 ASSERT_TRUE(infobar_delegate); |
105 infobar_delegate->Accept(); | 105 infobar_delegate->Accept(); |
106 } | 106 } |
107 | 107 |
108 private: | 108 private: |
109 bool alerted_; | 109 bool alerted_; |
110 bool has_run_message_loop_; | 110 bool has_run_message_loop_; |
111 Browser* browser_; | 111 Browser* browser_; |
112 InfoBarService* infobar_service_; | 112 InfoBarService* infobar_service_; |
113 }; | 113 }; |
114 | 114 |
115 class AutofillTest : public InProcessBrowserTest { | 115 class AutofillTest : public InProcessBrowserTest { |
116 protected: | 116 protected: |
117 AutofillTest() {} | 117 AutofillTest() {} |
118 | 118 |
119 virtual void SetUpOnMainThread() OVERRIDE { | 119 virtual void SetUpOnMainThread() override { |
120 // Don't want Keychain coming up on Mac. | 120 // Don't want Keychain coming up on Mac. |
121 test::DisableSystemServices(browser()->profile()->GetPrefs()); | 121 test::DisableSystemServices(browser()->profile()->GetPrefs()); |
122 } | 122 } |
123 | 123 |
124 virtual void TearDownOnMainThread() OVERRIDE { | 124 virtual void TearDownOnMainThread() override { |
125 // Make sure to close any showing popups prior to tearing down the UI. | 125 // Make sure to close any showing popups prior to tearing down the UI. |
126 content::WebContents* web_contents = | 126 content::WebContents* web_contents = |
127 browser()->tab_strip_model()->GetActiveWebContents(); | 127 browser()->tab_strip_model()->GetActiveWebContents(); |
128 AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents( | 128 AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents( |
129 web_contents)->autofill_manager(); | 129 web_contents)->autofill_manager(); |
130 autofill_manager->client()->HideAutofillPopup(); | 130 autofill_manager->client()->HideAutofillPopup(); |
131 } | 131 } |
132 | 132 |
133 PersonalDataManager* personal_data_manager() { | 133 PersonalDataManager* personal_data_manager() { |
134 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); | 134 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 IN_PROC_BROWSER_TEST_F(AutofillTest, | 834 IN_PROC_BROWSER_TEST_F(AutofillTest, |
835 DISABLED_MergeAggregatedDuplicatedProfiles) { | 835 DISABLED_MergeAggregatedDuplicatedProfiles) { |
836 int num_of_profiles = | 836 int num_of_profiles = |
837 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); | 837 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); |
838 | 838 |
839 ASSERT_GT(num_of_profiles, | 839 ASSERT_GT(num_of_profiles, |
840 static_cast<int>(personal_data_manager()->GetProfiles().size())); | 840 static_cast<int>(personal_data_manager()->GetProfiles().size())); |
841 } | 841 } |
842 | 842 |
843 } // namespace autofill | 843 } // namespace autofill |
OLD | NEW |