chromium/chrome/browser/password_manager/multi_profile_credentials_filter_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/password_manager/multi_profile_credentials_filter.h"

#include <string>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/chrome_signin_client_test_util.h"
#include "chrome/browser/signin/dice_web_signin_interceptor.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/password_manager/core/browser/password_form.h"
#include "components/password_manager/core/browser/stub_password_manager_client.h"
#include "components/password_manager/core/browser/sync_username_test_base.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace {

// Dummy DiceWebSigninInterceptor::Delegate that does nothing.
class TestDiceWebSigninInterceptorDelegate
    : public WebSigninInterceptor::Delegate {};

class TestPasswordManagerClient
    : public password_manager::StubPasswordManagerClient {};

}  // namespace

class MultiProfileCredentialsFilterTest : public BrowserWithTestWindowTest {};

// Checks that MultiProfileCredentialsFilter returns false when
// SyncCredentialsFilter returns false.
TEST_F(MultiProfileCredentialsFilterTest, SyncCredentialsFilter) {}

// Returns true when the interceptor is nullptr.
TEST_F(MultiProfileCredentialsFilterTest, NullInterceptor) {}

// Returns true for non-gaia forms.
TEST_F(MultiProfileCredentialsFilterTest, NonGaia) {}

// Returns false for an invalid email address.
// Regression test for https://crbug.com/1401924
TEST_F(MultiProfileCredentialsFilterTest, InvalidEmail) {}

// Returns true for email addresses with no domain part when sign-in is not
// intercepted.
TEST_F(MultiProfileCredentialsFilterTest, UsernameWithNoDomain) {}

// Returns false when interception is already in progress.
TEST_F(MultiProfileCredentialsFilterTest, InterceptInProgress) {}

// Returns false when the signin is not in progress yet, but the signin will be
// intercepted.
TEST_F(MultiProfileCredentialsFilterTest, SigninIntercepted) {}

// Returns false when the outcome of the interception is unknown.
TEST_F(MultiProfileCredentialsFilterTest, SigninInterceptionUnknown) {}

// Returns true when the signin is not intercepted.
TEST_F(MultiProfileCredentialsFilterTest, SigninNotIntercepted) {}