Commit 7d383387 authored by Vadym Doroshenko's avatar Vadym Doroshenko Committed by Commit Bot

Stop saving sync password on any google domain.

Password Manager shouldn't save any sync password. This CL ensures that
the sync password wouldn't saved on any google domain.

Change-Id: I8418f94bab362a830ed88c1dbdb42ba884fd334c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1754002Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Vadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686781}
parent 9ff07791
......@@ -50,7 +50,7 @@ std::string GetSyncUsernameIfSyncingPasswords(
bool IsSyncAccountCredential(const autofill::PasswordForm& form,
const syncer::SyncService* sync_service,
const signin::IdentityManager* identity_manager) {
if (!IsGaiaCredentialPage(form.signon_realm))
if (!GURL(form.signon_realm).DomainIs("google.com"))
return false;
// The empty username can mean that Chrome did not detect it correctly. For
......
......@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/sync_username_test_base.h"
......@@ -19,6 +20,7 @@
#endif // SYNC_PASSWORD_REUSE_DETECTION_ENABLED
using autofill::PasswordForm;
using base::ASCIIToUTF16;
namespace password_manager {
namespace sync_util {
......@@ -31,6 +33,13 @@ PasswordForm SimpleGAIAChangePasswordForm() {
return form;
}
PasswordForm SimpleForm(const char* signon_realm, const char* username) {
PasswordForm form;
form.signon_realm = signon_realm;
form.username_value = ASCIIToUTF16(username);
return form;
}
TEST_F(PasswordSyncUtilTest, GetSyncUsernameIfSyncingPasswords) {
const struct TestCase {
enum { SYNCING_PASSWORDS, NOT_SYNCING_PASSWORDS } password_sync;
......@@ -82,6 +91,10 @@ TEST_F(PasswordSyncUtilTest, IsSyncAccountCredential) {
{SimpleGaiaForm(""), "sync_user@example.org", true},
{SimpleNonGaiaForm(""), "sync_user@example.org", false},
{SimpleGAIAChangePasswordForm(), "sync_user@example.org", true},
{SimpleForm("https://subdomain.google.com/", "sync_user@example.org"),
"sync_user@example.org", true},
{SimpleForm("https://subdomain.google.com/", ""), "sync_user@example.org",
true},
};
for (size_t i = 0; i < base::size(kTestCases); ++i) {
......
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