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

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: rebased 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..4868f12cafd678d3a8c5094985e1b759966f8e1d 100644
--- a/chrome/browser/signin/account_reconcilor_unittest.cc
+++ b/chrome/browser/signin/account_reconcilor_unittest.cc
@@ -5,6 +5,7 @@
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
+#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/histogram_tester.h"
#include "base/time/time.h"
@@ -28,6 +29,8 @@
#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_auth_fetcher.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 +102,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 +113,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 +132,9 @@ void AccountReconcilorTest::SetUp() {
switches::kEnableNewProfileManagement);
}
+ list_accounts_url_ = GaiaAuthFetcher::BuildListAccountsURL(
+ GaiaConstants::kReconcilorSource);
+
testing_profile_manager_.reset(
new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
ASSERT_TRUE(testing_profile_manager_.get()->SetUp());
@@ -238,7 +247,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 +269,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 +287,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 +322,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 +347,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 +372,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 +402,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 +435,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 +461,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 +503,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 +538,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 +557,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 +582,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);

Powered by Google App Engine
This is Rietveld 408576698