Commit 92689682 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Enabled HTTP FOAS Feature by Default

The HTTP FOAS feature will be rolled out to 100% starting M77. Following
the advice in go/finch-best-practices this change enables the feature by
default ToT and deletes the Field Trial Testing config.

Bug: 914765
Change-Id: Ief6a62c17ebbcc8adf66ff7e1678c3ae02dfc124
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1789228
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694719}
parent e921922e
...@@ -28,6 +28,7 @@ using autofill::PasswordForm; ...@@ -28,6 +28,7 @@ using autofill::PasswordForm;
using autofill::PasswordFormFillData; using autofill::PasswordFormFillData;
using base::ASCIIToUTF16; using base::ASCIIToUTF16;
using testing::_; using testing::_;
using testing::Return;
using testing::SaveArg; using testing::SaveArg;
namespace password_manager { namespace password_manager {
...@@ -47,12 +48,12 @@ class MockPasswordManagerDriver : public StubPasswordManagerDriver { ...@@ -47,12 +48,12 @@ class MockPasswordManagerDriver : public StubPasswordManagerDriver {
class MockPasswordManagerClient : public StubPasswordManagerClient { class MockPasswordManagerClient : public StubPasswordManagerClient {
public: public:
MockPasswordManagerClient() {}
MOCK_METHOD3(PasswordWasAutofilled, MOCK_METHOD3(PasswordWasAutofilled,
void(const std::map<base::string16, const PasswordForm*>&, void(const std::map<base::string16, const PasswordForm*>&,
const GURL&, const GURL&,
const std::vector<const PasswordForm*>*)); const std::vector<const PasswordForm*>*));
MOCK_CONST_METHOD0(IsMainFrameSecure, bool());
}; };
} // namespace } // namespace
...@@ -60,19 +61,22 @@ class MockPasswordManagerClient : public StubPasswordManagerClient { ...@@ -60,19 +61,22 @@ class MockPasswordManagerClient : public StubPasswordManagerClient {
class PasswordFormFillingTest : public testing::Test { class PasswordFormFillingTest : public testing::Test {
public: public:
PasswordFormFillingTest() { PasswordFormFillingTest() {
observed_form_.origin = GURL("http://accounts.google.com/a/LoginAuth"); ON_CALL(client_, IsMainFrameSecure()).WillByDefault(Return(true));
observed_form_.action = GURL("http://accounts.google.com/a/Login");
observed_form_.origin = GURL("https://accounts.google.com/a/LoginAuth");
observed_form_.action = GURL("https://accounts.google.com/a/Login");
observed_form_.username_element = ASCIIToUTF16("Email"); observed_form_.username_element = ASCIIToUTF16("Email");
observed_form_.username_element_renderer_id = 100; observed_form_.username_element_renderer_id = 100;
observed_form_.password_element = ASCIIToUTF16("Passwd"); observed_form_.password_element = ASCIIToUTF16("Passwd");
observed_form_.password_element_renderer_id = 101; observed_form_.password_element_renderer_id = 101;
observed_form_.submit_element = ASCIIToUTF16("signIn"); observed_form_.submit_element = ASCIIToUTF16("signIn");
observed_form_.signon_realm = "http://accounts.google.com"; observed_form_.signon_realm = "https://accounts.google.com";
observed_form_.form_data.name = ASCIIToUTF16("the-form-name"); observed_form_.form_data.name = ASCIIToUTF16("the-form-name");
saved_match_ = observed_form_; saved_match_ = observed_form_;
saved_match_.origin = GURL("http://accounts.google.com/a/ServiceLoginAuth"); saved_match_.origin =
saved_match_.action = GURL("http://accounts.google.com/a/ServiceLogin"); GURL("https://accounts.google.com/a/ServiceLoginAuth");
saved_match_.action = GURL("https://accounts.google.com/a/ServiceLogin");
saved_match_.preferred = true; saved_match_.preferred = true;
saved_match_.username_value = ASCIIToUTF16("test@gmail.com"); saved_match_.username_value = ASCIIToUTF16("test@gmail.com");
saved_match_.password_value = ASCIIToUTF16("test1"); saved_match_.password_value = ASCIIToUTF16("test1");
...@@ -80,9 +84,9 @@ class PasswordFormFillingTest : public testing::Test { ...@@ -80,9 +84,9 @@ class PasswordFormFillingTest : public testing::Test {
psl_saved_match_ = saved_match_; psl_saved_match_ = saved_match_;
psl_saved_match_.is_public_suffix_match = true; psl_saved_match_.is_public_suffix_match = true;
psl_saved_match_.origin = psl_saved_match_.origin =
GURL("http://m.accounts.google.com/a/ServiceLoginAuth"); GURL("https://m.accounts.google.com/a/ServiceLoginAuth");
psl_saved_match_.action = GURL("http://m.accounts.google.com/a/Login"); psl_saved_match_.action = GURL("https://m.accounts.google.com/a/Login");
psl_saved_match_.signon_realm = "http://m.accounts.google.com"; psl_saved_match_.signon_realm = "https://m.accounts.google.com";
metrics_recorder_ = base::MakeRefCounted<PasswordFormMetricsRecorder>( metrics_recorder_ = base::MakeRefCounted<PasswordFormMetricsRecorder>(
true, client_.GetUkmSourceId()); true, client_.GetUkmSourceId());
...@@ -231,25 +235,28 @@ TEST_F(PasswordFormFillingTest, AutofillPSLMatch) { ...@@ -231,25 +235,28 @@ TEST_F(PasswordFormFillingTest, AutofillPSLMatch) {
EXPECT_EQ(saved_match_.password_value, fill_data.password_field.value); EXPECT_EQ(saved_match_.password_value, fill_data.password_field.value);
} }
TEST_F(PasswordFormFillingTest, FillingOnHttp) { TEST_F(PasswordFormFillingTest, NoAutofillOnHttp) {
ASSERT_FALSE(GURL(saved_match_.signon_realm).SchemeIsCryptographic()); PasswordForm observed_http_form = observed_form_;
std::map<base::string16, const autofill::PasswordForm*> best_matches; observed_http_form.origin = GURL("http://accounts.google.com/a/LoginAuth");
best_matches.emplace(saved_match_.username_value, &saved_match_); observed_http_form.action = GURL("http://accounts.google.com/a/Login");
observed_http_form.signon_realm = "http://accounts.google.com";
for (bool enable_foas_http : {false, true}) {
SCOPED_TRACE(testing::Message() << "Enable FOAS on HTTP: " << std::boolalpha PasswordForm saved_http_match = saved_match_;
<< enable_foas_http); saved_http_match.origin =
base::test::ScopedFeatureList features; GURL("http://accounts.google.com/a/ServiceLoginAuth");
features.InitWithFeatureState(features::kFillOnAccountSelectHttp, saved_http_match.action = GURL("http://accounts.google.com/a/ServiceLogin");
enable_foas_http); saved_http_match.signon_realm = "http://accounts.google.com";
ASSERT_FALSE(GURL(saved_http_match.signon_realm).SchemeIsCryptographic());
std::map<base::string16, const autofill::PasswordForm*> best_matches = {
{saved_http_match.username_value, &saved_http_match},
};
LikelyFormFilling likely_form_filling = SendFillInformationToRenderer( EXPECT_CALL(client_, IsMainFrameSecure).WillOnce(Return(false));
&client_, &driver_, observed_form_, best_matches, federated_matches_, LikelyFormFilling likely_form_filling = SendFillInformationToRenderer(
&saved_match_, metrics_recorder_.get()); &client_, &driver_, observed_http_form, best_matches, federated_matches_,
EXPECT_EQ(enable_foas_http ? LikelyFormFilling::kFillOnAccountSelect &saved_http_match, metrics_recorder_.get());
: LikelyFormFilling::kFillOnPageLoad, EXPECT_EQ(LikelyFormFilling::kFillOnAccountSelect, likely_form_filling);
likely_form_filling);
}
} }
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
......
...@@ -119,6 +119,8 @@ class MockPasswordManagerClient : public StubPasswordManagerClient { ...@@ -119,6 +119,8 @@ class MockPasswordManagerClient : public StubPasswordManagerClient {
MOCK_METHOD2(AutofillHttpAuth, MOCK_METHOD2(AutofillHttpAuth,
void(const PasswordForm&, const PasswordFormManagerForUI*)); void(const PasswordForm&, const PasswordFormManagerForUI*));
MOCK_CONST_METHOD0(IsMainFrameSecure, bool());
}; };
void CheckPendingCredentials(const PasswordForm& expected, void CheckPendingCredentials(const PasswordForm& expected,
...@@ -335,10 +337,11 @@ class PasswordFormManagerTest : public testing::Test { ...@@ -335,10 +337,11 @@ class PasswordFormManagerTest : public testing::Test {
blacklisted_match_.blacklisted_by_user = true; blacklisted_match_.blacklisted_by_user = true;
EXPECT_CALL(client_, GetAutofillDownloadManager()) EXPECT_CALL(client_, GetAutofillDownloadManager())
.WillRepeatedly(testing::Return(&mock_autofill_download_manager_)); .WillRepeatedly(Return(&mock_autofill_download_manager_));
ON_CALL(client_, IsMainFrameSecure()).WillByDefault(Return(true));
ON_CALL(mock_autofill_download_manager_, ON_CALL(mock_autofill_download_manager_,
StartUploadRequest(_, _, _, _, _, _)) StartUploadRequest(_, _, _, _, _, _))
.WillByDefault(testing::Return(true)); .WillByDefault(Return(true));
fetcher_.reset(new FakeFormFetcher()); fetcher_.reset(new FakeFormFetcher());
fetcher_->Fetch(); fetcher_->Fetch();
......
...@@ -150,6 +150,7 @@ class MockPasswordManagerClient : public StubPasswordManagerClient { ...@@ -150,6 +150,7 @@ class MockPasswordManagerClient : public StubPasswordManagerClient {
MOCK_METHOD0(AutomaticPasswordSaveIndicator, void()); MOCK_METHOD0(AutomaticPasswordSaveIndicator, void());
MOCK_CONST_METHOD0(GetPrefs, PrefService*()); MOCK_CONST_METHOD0(GetPrefs, PrefService*());
MOCK_CONST_METHOD0(GetMainFrameURL, const GURL&()); MOCK_CONST_METHOD0(GetMainFrameURL, const GURL&());
MOCK_CONST_METHOD0(IsMainFrameSecure, bool());
MOCK_METHOD0(GetDriver, PasswordManagerDriver*()); MOCK_METHOD0(GetDriver, PasswordManagerDriver*());
MOCK_CONST_METHOD0(GetStoreResultFilter, const MockStoreResultFilter*()); MOCK_CONST_METHOD0(GetStoreResultFilter, const MockStoreResultFilter*());
MOCK_METHOD0(GetMetricsRecorder, PasswordManagerMetricsRecorder*()); MOCK_METHOD0(GetMetricsRecorder, PasswordManagerMetricsRecorder*());
...@@ -305,6 +306,7 @@ class PasswordManagerTest : public testing::Test { ...@@ -305,6 +306,7 @@ class PasswordManagerTest : public testing::Test {
EXPECT_CALL(*store_, IsAbleToSavePasswords()).WillRepeatedly(Return(true)); EXPECT_CALL(*store_, IsAbleToSavePasswords()).WillRepeatedly(Return(true));
ON_CALL(client_, GetMainFrameURL()).WillByDefault(ReturnRef(test_url_)); ON_CALL(client_, GetMainFrameURL()).WillByDefault(ReturnRef(test_url_));
ON_CALL(client_, IsMainFrameSecure()).WillByDefault(Return(true));
ON_CALL(client_, GetMetricsRecorder()).WillByDefault(Return(nullptr)); ON_CALL(client_, GetMetricsRecorder()).WillByDefault(Return(nullptr));
ON_CALL(client_, PromptUserToSaveOrUpdatePasswordPtr(_)) ON_CALL(client_, PromptUserToSaveOrUpdatePasswordPtr(_))
.WillByDefault(WithArg<0>(DeletePtr())); .WillByDefault(WithArg<0>(DeletePtr()));
......
...@@ -33,7 +33,7 @@ const base::Feature kFillOnAccountSelect = {"fill-on-account-select", ...@@ -33,7 +33,7 @@ const base::Feature kFillOnAccountSelect = {"fill-on-account-select",
// Enables the experiment for the password manager to only fill on account // Enables the experiment for the password manager to only fill on account
// selection when the password form was served over HTTP. // selection when the password form was served over HTTP.
const base::Feature kFillOnAccountSelectHttp = { const base::Feature kFillOnAccountSelectHttp = {
"FillOnAccountSelectHttp", base::FEATURE_DISABLED_BY_DEFAULT}; "FillOnAccountSelectHttp", base::FEATURE_ENABLED_BY_DEFAULT};
// Forces password generation to ask user to update the password instead of // Forces password generation to ask user to update the password instead of
// overwriting silently. // overwriting silently.
......
...@@ -4094,26 +4094,6 @@ ...@@ -4094,26 +4094,6 @@
] ]
} }
], ],
"PasswordFillOnAccountSelectOverHttp": [
{
"platforms": [
"android",
"chromeos",
"ios",
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "Enabled_20190328",
"enable_features": [
"FillOnAccountSelectHttp"
]
}
]
}
],
"PasswordProtectionForEnterprise": [ "PasswordProtectionForEnterprise": [
{ {
"platforms": [ "platforms": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment