Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5179)

Unified Diff: chrome/browser/signin/account_reconcilor_unittest.cc

Issue 601643002: Use a distinct source parameter on gaia endpoints for the reconcilor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@uber
Patch Set: Remove functions Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/account_reconcilor_unittest.cc
diff --git a/chrome/browser/signin/account_reconcilor_unittest.cc b/chrome/browser/signin/account_reconcilor_unittest.cc
index 0bb444c66f077152151f595145d5192d02585d00..c6194fb0e6fcbbcf08c37f97882dd78f10cf8c88 100644
--- a/chrome/browser/signin/account_reconcilor_unittest.cc
+++ b/chrome/browser/signin/account_reconcilor_unittest.cc
@@ -28,6 +28,7 @@
#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"
@@ -99,6 +100,8 @@ class AccountReconcilorTest : public ::testing::TestWithParam<bool> {
const std::string& account_id,
const GoogleServiceAuthError& error);
+ GURL list_accounts_url() { return list_accounts_url_; }
+
private:
content::TestBrowserThreadBundle bundle_;
TestingProfile* profile_;
@@ -108,6 +111,7 @@ class AccountReconcilorTest : public ::testing::TestWithParam<bool> {
net::FakeURLFetcherFactory url_fetcher_factory_;
scoped_ptr<TestingProfileManager> testing_profile_manager_;
base::HistogramTester histogram_tester_;
+ GURL list_accounts_url_;
DISALLOW_COPY_AND_ASSIGN(AccountReconcilorTest);
};
@@ -126,6 +130,9 @@ void AccountReconcilorTest::SetUp() {
switches::kEnableNewProfileManagement);
}
+ list_accounts_url_ = GaiaUrls::GetInstance()->ListAccountsURLWithSource(
+ GaiaConstants::kReconcilorSource);
+
testing_profile_manager_.reset(
new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
ASSERT_TRUE(testing_profile_manager_.get()->SetUp());
@@ -238,7 +245,7 @@ TEST_F(AccountReconcilorTest, GetAccountsFromCookieSuccess) {
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);
@@ -260,7 +267,7 @@ TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) {
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();
@@ -278,7 +285,7 @@ TEST_P(AccountReconcilorTest, StartReconcileNoop) {
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);
@@ -313,7 +320,7 @@ TEST_P(AccountReconcilorTest, StartReconcileNoopWithDots) {
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);
@@ -338,7 +345,7 @@ TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) {
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);
@@ -363,7 +370,7 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookie) {
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);
@@ -393,7 +400,7 @@ TEST_P(AccountReconcilorTest, StartReconcileRemoveFromCookie) {
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);
@@ -426,7 +433,7 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) {
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);
@@ -452,7 +459,7 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) {
// 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,
@@ -494,7 +501,7 @@ TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) {
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);
@@ -529,7 +536,7 @@ TEST_P(AccountReconcilorTest, StartReconcileOnlyOnce) {
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);
@@ -548,7 +555,7 @@ TEST_P(AccountReconcilorTest, StartReconcileWithSessionInfoExpiredDefault) {
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);
@@ -573,7 +580,7 @@ TEST_F(AccountReconcilorTest, MergeSessionCompletedWithBogusAccount) {
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);
« no previous file with comments | « chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc ('k') | chrome/browser/ui/auto_login_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698