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

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

Issue 16286020: Abstract WebContentsObserver from Autofill shared code (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to fix conflict Created 7 years, 6 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/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/test/base/ui_test_utils.h" 29 #include "chrome/test/base/ui_test_utils.h"
30 #include "components/autofill/browser/autofill_common_test.h" 30 #include "components/autofill/browser/autofill_common_test.h"
31 #include "components/autofill/browser/autofill_external_delegate.h" 31 #include "components/autofill/browser/autofill_external_delegate.h"
32 #include "components/autofill/browser/autofill_manager.h" 32 #include "components/autofill/browser/autofill_manager.h"
33 #include "components/autofill/browser/autofill_manager_test_delegate.h" 33 #include "components/autofill/browser/autofill_manager_test_delegate.h"
34 #include "components/autofill/browser/autofill_profile.h" 34 #include "components/autofill/browser/autofill_profile.h"
35 #include "components/autofill/browser/credit_card.h" 35 #include "components/autofill/browser/credit_card.h"
36 #include "components/autofill/browser/personal_data_manager.h" 36 #include "components/autofill/browser/personal_data_manager.h"
37 #include "components/autofill/browser/personal_data_manager_observer.h" 37 #include "components/autofill/browser/personal_data_manager_observer.h"
38 #include "components/autofill/browser/validation.h" 38 #include "components/autofill/browser/validation.h"
39 #include "components/autofill/content/browser/autofill_driver_impl.h"
39 #include "content/public/browser/navigation_controller.h" 40 #include "content/public/browser/navigation_controller.h"
40 #include "content/public/browser/notification_observer.h" 41 #include "content/public/browser/notification_observer.h"
41 #include "content/public/browser/notification_registrar.h" 42 #include "content/public/browser/notification_registrar.h"
42 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/render_view_host.h" 44 #include "content/public/browser/render_view_host.h"
44 #include "content/public/browser/web_contents.h" 45 #include "content/public/browser/web_contents.h"
45 #include "content/public/test/browser_test_utils.h" 46 #include "content/public/test/browser_test_utils.h"
46 #include "content/public/test/test_renderer_host.h" 47 #include "content/public/test/test_renderer_host.h"
47 #include "content/public/test/test_utils.h" 48 #include "content/public/test/test_utils.h"
48 #include "net/url_request/test_url_fetcher_factory.h" 49 #include "net/url_request/test_url_fetcher_factory.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 223
223 virtual void SetUpOnMainThread() OVERRIDE { 224 virtual void SetUpOnMainThread() OVERRIDE {
224 // Don't want Keychain coming up on Mac. 225 // Don't want Keychain coming up on Mac.
225 test::DisableSystemServices(browser()->profile()); 226 test::DisableSystemServices(browser()->profile());
226 227
227 // When testing the native UI, hook up a test external delegate, which 228 // When testing the native UI, hook up a test external delegate, which
228 // allows us to forward keyboard events to the popup directly. 229 // allows us to forward keyboard events to the popup directly.
229 content::WebContents* web_contents = 230 content::WebContents* web_contents =
230 browser()->tab_strip_model()->GetActiveWebContents(); 231 browser()->tab_strip_model()->GetActiveWebContents();
231 AutofillManager* autofill_manager = 232 AutofillManager* autofill_manager =
232 AutofillManager::FromWebContents(web_contents); 233 AutofillDriverImpl::FromWebContents(web_contents)->autofill_manager();
233 if (autofill_manager->IsNativeUiEnabled()) { 234 if (autofill_manager->IsNativeUiEnabled()) {
234 external_delegate_.reset( 235 external_delegate_.reset(
235 new TestAutofillExternalDelegate(web_contents, autofill_manager)); 236 new TestAutofillExternalDelegate(web_contents, autofill_manager));
236 autofill_manager->SetExternalDelegate(external_delegate_.get()); 237 autofill_manager->SetExternalDelegate(external_delegate_.get());
237 } 238 }
238 autofill_manager->SetTestDelegate(&test_delegate_); 239 autofill_manager->SetTestDelegate(&test_delegate_);
239 } 240 }
240 241
241 virtual void CleanUpOnMainThread() OVERRIDE { 242 virtual void CleanUpOnMainThread() OVERRIDE {
242 // Make sure to close any showing popups prior to tearing down the UI. 243 // Make sure to close any showing popups prior to tearing down the UI.
243 content::WebContents* web_contents = 244 content::WebContents* web_contents =
244 browser()->tab_strip_model()->GetActiveWebContents(); 245 browser()->tab_strip_model()->GetActiveWebContents();
245 AutofillManager* autofill_manager = 246 AutofillManager* autofill_manager =
246 AutofillManager::FromWebContents(web_contents); 247 AutofillDriverImpl::FromWebContents(web_contents)->autofill_manager();
247 autofill_manager->delegate()->HideAutofillPopup(); 248 autofill_manager->delegate()->HideAutofillPopup();
248 } 249 }
249 250
250 PersonalDataManager* personal_data_manager() { 251 PersonalDataManager* personal_data_manager() {
251 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); 252 return PersonalDataManagerFactory::GetForProfile(browser()->profile());
252 } 253 }
253 254
254 void CreateTestProfile() { 255 void CreateTestProfile() {
255 AutofillProfile profile; 256 AutofillProfile profile;
256 test::SetProfileInfo( 257 test::SetProfileInfo(
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 IN_PROC_BROWSER_TEST_F(AutofillTest, 1713 IN_PROC_BROWSER_TEST_F(AutofillTest,
1713 DISABLED_MergeAggregatedDuplicatedProfiles) { 1714 DISABLED_MergeAggregatedDuplicatedProfiles) {
1714 int num_of_profiles = 1715 int num_of_profiles =
1715 AggregateProfilesIntoAutofillPrefs("dataset_no_address.txt"); 1716 AggregateProfilesIntoAutofillPrefs("dataset_no_address.txt");
1716 1717
1717 ASSERT_GT(num_of_profiles, 1718 ASSERT_GT(num_of_profiles,
1718 static_cast<int>(personal_data_manager()->GetProfiles().size())); 1719 static_cast<int>(personal_data_manager()->GetProfiles().size()));
1719 } 1720 }
1720 1721
1721 } // namespace autofill 1722 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | chrome/browser/autofill/autofill_external_delegate_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698