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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 18 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
19 #include "chrome/browser/infobars/infobar_service.h" | 19 #include "chrome/browser/infobars/infobar_service.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
24 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
25 #include "chrome/test/base/in_process_browser_test.h" | 25 #include "chrome/test/base/in_process_browser_test.h" |
26 #include "chrome/test/base/test_switches.h" | 26 #include "chrome/test/base/test_switches.h" |
27 #include "chrome/test/base/ui_test_utils.h" | 27 #include "chrome/test/base/ui_test_utils.h" |
28 #include "components/autofill/content/browser/content_autofill_driver.h" | 28 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 29 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
29 #include "components/autofill/core/browser/autofill_profile.h" | 30 #include "components/autofill/core/browser/autofill_profile.h" |
30 #include "components/autofill/core/browser/autofill_test_utils.h" | 31 #include "components/autofill/core/browser/autofill_test_utils.h" |
31 #include "components/autofill/core/browser/credit_card.h" | 32 #include "components/autofill/core/browser/credit_card.h" |
32 #include "components/autofill/core/browser/personal_data_manager.h" | 33 #include "components/autofill/core/browser/personal_data_manager.h" |
33 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 34 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
34 #include "components/autofill/core/browser/validation.h" | 35 #include "components/autofill/core/browser/validation.h" |
35 #include "components/infobars/core/confirm_infobar_delegate.h" | 36 #include "components/infobars/core/confirm_infobar_delegate.h" |
36 #include "components/infobars/core/infobar.h" | 37 #include "components/infobars/core/infobar.h" |
37 #include "components/infobars/core/infobar_manager.h" | 38 #include "components/infobars/core/infobar_manager.h" |
38 #include "content/public/browser/navigation_controller.h" | 39 #include "content/public/browser/navigation_controller.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 117 |
117 void SetUpOnMainThread() override { | 118 void SetUpOnMainThread() override { |
118 // Don't want Keychain coming up on Mac. | 119 // Don't want Keychain coming up on Mac. |
119 test::DisableSystemServices(browser()->profile()->GetPrefs()); | 120 test::DisableSystemServices(browser()->profile()->GetPrefs()); |
120 } | 121 } |
121 | 122 |
122 void TearDownOnMainThread() override { | 123 void TearDownOnMainThread() override { |
123 // Make sure to close any showing popups prior to tearing down the UI. | 124 // Make sure to close any showing popups prior to tearing down the UI. |
124 content::WebContents* web_contents = | 125 content::WebContents* web_contents = |
125 browser()->tab_strip_model()->GetActiveWebContents(); | 126 browser()->tab_strip_model()->GetActiveWebContents(); |
126 AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents( | 127 AutofillManager* autofill_manager = |
127 web_contents)->autofill_manager(); | 128 ContentAutofillDriverFactory::FromWebContents(web_contents) |
| 129 ->DriverForFrame(web_contents->GetMainFrame()) |
| 130 ->autofill_manager(); |
128 autofill_manager->client()->HideAutofillPopup(); | 131 autofill_manager->client()->HideAutofillPopup(); |
129 } | 132 } |
130 | 133 |
131 PersonalDataManager* personal_data_manager() { | 134 PersonalDataManager* personal_data_manager() { |
132 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); | 135 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); |
133 } | 136 } |
134 | 137 |
135 void SetProfiles(std::vector<AutofillProfile>* profiles) { | 138 void SetProfiles(std::vector<AutofillProfile>* profiles) { |
136 WindowedPersonalDataManagerObserver observer(browser()); | 139 WindowedPersonalDataManagerObserver observer(browser()); |
137 personal_data_manager()->SetProfiles(profiles); | 140 personal_data_manager()->SetProfiles(profiles); |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 IN_PROC_BROWSER_TEST_F(AutofillTest, | 835 IN_PROC_BROWSER_TEST_F(AutofillTest, |
833 DISABLED_MergeAggregatedDuplicatedProfiles) { | 836 DISABLED_MergeAggregatedDuplicatedProfiles) { |
834 int num_of_profiles = | 837 int num_of_profiles = |
835 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); | 838 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); |
836 | 839 |
837 ASSERT_GT(num_of_profiles, | 840 ASSERT_GT(num_of_profiles, |
838 static_cast<int>(personal_data_manager()->GetProfiles().size())); | 841 static_cast<int>(personal_data_manager()->GetProfiles().size())); |
839 } | 842 } |
840 | 843 |
841 } // namespace autofill | 844 } // namespace autofill |
OLD | NEW |