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

Issue 2606473003: Use AutofillDriver* in ContentAutofillDriverFactory when possible (Closed)

Created:
3 years, 12 months ago by vabr (Chromium)
Modified:
3 years, 10 months ago
Reviewers:
CC:
chromium-reviews, rouslan+autofill_chromium.org, jam, sebsg+autofillwatch_chromium.org, browser-components-watch_chromium.org, mathp+autofillwatch_chromium.org, darin-cc_chromium.org, vabr+watchlistautofill_chromium.org, estade+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use AutofillDriver* in ContentAutofillDriverFactory when possible ContentAutofillDriverFactory creates ContentAutofillDriver instances in production code. However, it interacts with them in a limited way. Apart from creating and destroying those instances, there are currently two actions performed by the factory: calling DidNavigateFrame, and BindRequest. DidNavigateFrame passes an unnecessary amount of //content-dependent detail to just notify the driver when the frame navigated to a different page. The latter is a //content-independent notion. This CL pushes the //content-related aruguments out of this method, renames it accordingly, and promotes it to the parent interface, AutofillDriver. BindRequest is specific to ContentAutofillDriver, as opposed to AutofillDriver, because the iOS implementation of AutofillDriver does not use interprocess communication at all. The BindRequest is only performed in a static binding method used by ChromeContentBrowserClient. The fact that ContentAutofillDriverFactory expects to be handling a ContentAutofillDriver makes unittesting hard. In fact, there is no unittest for the factory at the moment. The inability to mock the AutofillDriver API results in a cascade of production-code dependencies when trying to construct a factory instance and test it. Given that DidNavigateFrame is renamed and pushed to AutofillDriver, and that BindRequest is not used in instance methods of the factory, this CL reduces the expectation of the factory to only work with AutofillDriver. This paves the way for creating a unittest. Another necessary step to allow creating a unittest for the factory was allowing the factory to create mocks of AutofillDriver instead of the production version. This CL achieves this by passing a factory function to the ContentAutofillDriverFactory on construction. In production code this function creates ContentAutofillDriver instances, but the test can inject a different function, creating mocks. Finally, the CL also adds a unittest for the factory, testing the logic for calling NavigatedToDifferentPage which moved from the driver to the factory. BUG=669045

Patch Set 1 #

Patch Set 2 : Version 2 #

Patch Set 3 : Fix compile #

Patch Set 4 : downcast for autofill_manager() #

Patch Set 5 : Fix Android compilation #

Unified diffs Side-by-side diffs Delta from patch set Stats (+187 lines, -65 lines) Patch
M chrome/browser/autofill/android/personal_data_manager_android.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/autofill/autofill_browsertest.cc View 1 2 3 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/autofill/autofill_interactive_uitest.cc View 1 2 3 2 chunks +6 lines, -4 lines 0 comments Download
M chrome/browser/autofill/form_structure_browsertest.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/password_manager/chrome_password_manager_client.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/autofill/chrome_autofill_client.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M components/autofill/content/browser/BUILD.gn View 1 1 chunk +1 line, -0 lines 0 comments Download
M components/autofill/content/browser/content_autofill_driver.h View 3 chunks +1 line, -6 lines 0 comments Download
M components/autofill/content/browser/content_autofill_driver.cc View 1 4 chunks +7 lines, -9 lines 0 comments Download
M components/autofill/content/browser/content_autofill_driver_factory.h View 1 4 chunks +15 lines, -6 lines 0 comments Download
M components/autofill/content/browser/content_autofill_driver_factory.cc View 1 7 chunks +28 lines, -7 lines 0 comments Download
A components/autofill/content/browser/content_autofill_driver_factory_unittest.cc View 1 1 chunk +108 lines, -0 lines 0 comments Download
M components/autofill/content/browser/content_autofill_driver_unittest.cc View 1 3 chunks +1 line, -19 lines 0 comments Download
M components/autofill/core/browser/autofill_driver.h View 1 chunk +3 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 23 (22 generated)
vabr (Chromium)
3 years, 10 months ago (2017-02-23 06:27:06 UTC) #23
This has been superseded by https://codereview.chromium.org/2715483002/, hence
closing without landing.

Powered by Google App Engine
This is Rietveld 408576698