#include "components/signin/core/common/profile_management_switches.h"
#include "components/signin/core/common/signin_switches.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
SigninClient* client);
virtual ~MockAccountReconcilor() {}
- virtual void StartFetchingExternalCcResult() OVERRIDE {
+ virtual void StartFetchingExternalCcResult() override {
// Don't do this in tests.
}
class AccountReconcilorTest : public ::testing::TestWithParam<bool> {
public:
AccountReconcilorTest();
- virtual void SetUp() OVERRIDE;
+ void SetUp() override;
TestingProfile* profile() { return profile_; }
FakeSigninManagerForTesting* signin_manager() { return signin_manager_; }
const std::string& account_id,
const GoogleServiceAuthError& error);
+ GURL list_accounts_url() { return list_accounts_url_; }
+ GURL get_check_connection_info_url() {
+ return get_check_connection_info_url_;
+ }
+
private:
content::TestBrowserThreadBundle bundle_;
TestingProfile* profile_;
net::FakeURLFetcherFactory url_fetcher_factory_;
scoped_ptr<TestingProfileManager> testing_profile_manager_;
base::HistogramTester histogram_tester_;
+ GURL list_accounts_url_;
+ GURL get_check_connection_info_url_;
DISALLOW_COPY_AND_ASSIGN(AccountReconcilorTest);
};
switches::kEnableNewProfileManagement);
}
+ list_accounts_url_ = GaiaUrls::GetInstance()->ListAccountsURLWithSource(
+ GaiaConstants::kReconcilorSource);
+ get_check_connection_info_url_ =
+ GaiaUrls::GetInstance()->GetCheckConnectionInfoURLWithSource(
+ GaiaConstants::kReconcilorSource);
+
+ SetFakeResponse(get_check_connection_info_url().spec(), "[]",
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
+
testing_profile_manager_.reset(
new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
ASSERT_TRUE(testing_profile_manager_.get()->SetUp());
AccountReconcilorFactory::GetForProfile(profile());
ASSERT_TRUE(reconcilor);
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
AccountReconcilorFactory::GetForProfile(profile());
ASSERT_TRUE(reconcilor);
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), "",
+ SetFakeResponse(list_accounts_url().spec(), "",
net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS);
reconcilor->StartReconcile();
AccountReconcilorFactory::GetForProfile(profile());
ASSERT_TRUE(reconcilor);
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
AccountReconcilorFactory::GetForProfile(profile());
ASSERT_TRUE(reconcilor);
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"dot.s@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
AccountReconcilorFactory::GetForProfile(profile());
ASSERT_TRUE(reconcilor);
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], "
"[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com"));
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction());
EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com"));
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], "
"[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("third@gmail.com"));
SetFakeResponse(
- GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK,
net::URLRequestStatus::SUCCESS);
// Do another pass after I've added a third account to the token service
SetFakeResponse(
- GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], "
"[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK,
EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com"));
EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com"));
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1], "
"[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
AccountReconcilorFactory::GetForProfile(profile());
ASSERT_TRUE(reconcilor);
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com"));
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0],"
"[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com"));
- SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
+ SetFakeResponse(list_accounts_url().spec(),
"[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled,
AccountReconcilorTest,
testing::Bool());
-