#include "components/gcm_driver/account_tracker.h"
#include <algorithm>
#include <memory>
#include <vector>
#include "base/strings/stringprintf.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const char kPrimaryAccountEmail[] = …;
enum TrackingEventType { … };
class TrackingEvent { … };
bool CompareByUser(TrackingEvent a, TrackingEvent b) { … }
std::string Str(const std::vector<TrackingEvent>& events) { … }
}
namespace gcm {
class AccountTrackerObserver : public AccountTracker::Observer { … };
void AccountTrackerObserver::OnAccountSignInChanged(
const CoreAccountInfo& account,
bool is_signed_in) { … }
void AccountTrackerObserver::Clear() { … }
void AccountTrackerObserver::SortEventsByUser() { … }
testing::AssertionResult AccountTrackerObserver::CheckEvents() { … }
testing::AssertionResult AccountTrackerObserver::CheckEvents(
const TrackingEvent& e1) { … }
testing::AssertionResult AccountTrackerObserver::CheckEvents(
const TrackingEvent& e1,
const TrackingEvent& e2) { … }
testing::AssertionResult AccountTrackerObserver::CheckEvents(
const TrackingEvent& e1,
const TrackingEvent& e2,
const TrackingEvent& e3) { … }
testing::AssertionResult AccountTrackerObserver::CheckEvents(
const TrackingEvent& e1,
const TrackingEvent& e2,
const TrackingEvent& e3,
const TrackingEvent& e4) { … }
testing::AssertionResult AccountTrackerObserver::CheckEvents(
const TrackingEvent& e1,
const TrackingEvent& e2,
const TrackingEvent& e3,
const TrackingEvent& e4,
const TrackingEvent& e5) { … }
testing::AssertionResult AccountTrackerObserver::CheckEvents(
const TrackingEvent& e1,
const TrackingEvent& e2,
const TrackingEvent& e3,
const TrackingEvent& e4,
const TrackingEvent& e5,
const TrackingEvent& e6) { … }
testing::AssertionResult AccountTrackerObserver::CheckEvents(
const std::vector<TrackingEvent>& events) { … }
class AccountTrackerTest : public testing::Test { … };
TEST_F(AccountTrackerTest, PrimaryNoEventsBeforeLogin) { … }
TEST_F(AccountTrackerTest, PrimaryLoginThenTokenAvailable) { … }
TEST_F(AccountTrackerTest, PrimaryRevoke) { … }
TEST_F(AccountTrackerTest, PrimaryRevokeThenTokenAvailable) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(AccountTrackerTest, PrimaryTokenAvailableThenLogin) { … }
TEST_F(AccountTrackerTest, PrimaryTokenAvailableAndRevokedThenLogin) { … }
TEST_F(AccountTrackerTest, PrimaryRevokeThenLogin) { … }
TEST_F(AccountTrackerTest, PrimaryLogoutThenRevoke) { … }
#endif
TEST_F(AccountTrackerTest, Available) { … }
TEST_F(AccountTrackerTest, AvailableRevokeAvailable) { … }
TEST_F(AccountTrackerTest, AvailableRevokeRevoke) { … }
TEST_F(AccountTrackerTest, AvailableAvailable) { … }
TEST_F(AccountTrackerTest, TwoAccounts) { … }
TEST_F(AccountTrackerTest, MultiNoEventsBeforeLogin) { … }
TEST_F(AccountTrackerTest, MultiRevokePrimaryDoesNotRemoveAllAccounts) { … }
TEST_F(AccountTrackerTest, GetAccountsPrimary) { … }
TEST_F(AccountTrackerTest, GetAccountsSignedOut) { … }
TEST_F(AccountTrackerTest, GetMultipleAccounts) { … }
TEST_F(AccountTrackerTest, GetAccountsReturnNothingWhenPrimarySignedOut) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(AccountTrackerTest, MultiLogoutRemovesAllAccounts) { … }
#endif
}