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

Unified Diff: components/signin/core/browser/gaia_cookie_manager_service_unittest.cc

Issue 1044933002: GaiaCookieServiceManager handles general request types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: components/signin/core/browser/gaia_cookie_manager_service_unittest.cc
diff --git a/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc b/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc
index 5675369c29c7eb7327dce608bde0b276aadafde3..fb53a7193e88b195589a6a948b4d375b1f86a791 100644
--- a/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc
+++ b/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc
@@ -58,7 +58,7 @@ class InstrumentedGaiaCookieManagerService : public GaiaCookieManagerService {
virtual ~InstrumentedGaiaCookieManagerService() { total--; }
- MOCK_METHOD0(StartFetching, void());
+ MOCK_METHOD0(StartFetchingUbertoken, void());
MOCK_METHOD0(StartLogOutUrlFetch, void());
private:
@@ -136,7 +136,7 @@ TEST_F(GaiaCookieManagerServiceTest, Success) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- EXPECT_CALL(helper, StartFetching());
+ EXPECT_CALL(helper, StartFetchingUbertoken());
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
no_error()));
@@ -148,7 +148,7 @@ TEST_F(GaiaCookieManagerServiceTest, FailedMergeSession) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- EXPECT_CALL(helper, StartFetching());
+ EXPECT_CALL(helper, StartFetchingUbertoken());
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
error()));
@@ -160,7 +160,7 @@ TEST_F(GaiaCookieManagerServiceTest, FailedUbertoken) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- EXPECT_CALL(helper, StartFetching());
+ EXPECT_CALL(helper, StartFetchingUbertoken());
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
error()));
@@ -172,7 +172,7 @@ TEST_F(GaiaCookieManagerServiceTest, ContinueAfterSuccess) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- EXPECT_CALL(helper, StartFetching()).Times(2);
+ EXPECT_CALL(helper, StartFetchingUbertoken()).Times(2);
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
no_error()));
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc2@gmail.com",
@@ -188,7 +188,7 @@ TEST_F(GaiaCookieManagerServiceTest, ContinueAfterFailure1) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- EXPECT_CALL(helper, StartFetching()).Times(2);
+ EXPECT_CALL(helper, StartFetchingUbertoken()).Times(2);
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
error()));
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc2@gmail.com",
@@ -204,7 +204,7 @@ TEST_F(GaiaCookieManagerServiceTest, ContinueAfterFailure2) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- EXPECT_CALL(helper, StartFetching()).Times(2);
+ EXPECT_CALL(helper, StartFetchingUbertoken()).Times(2);
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
error()));
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc2@gmail.com",
@@ -220,7 +220,7 @@ TEST_F(GaiaCookieManagerServiceTest, AllRequestsInMultipleGoes) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- EXPECT_CALL(helper, StartFetching()).Times(4);
+ EXPECT_CALL(helper, StartFetchingUbertoken()).Times(4);
EXPECT_CALL(observer, OnAddAccountToCookieCompleted(_, no_error())).Times(4);
helper.AddAccountToCookie("acc1@gmail.com");
@@ -242,32 +242,23 @@ TEST_F(GaiaCookieManagerServiceTest, LogOut) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- std::vector<std::string> current_accounts;
- current_accounts.push_back("acc1@gmail.com");
- current_accounts.push_back("acc2@gmail.com");
- current_accounts.push_back("acc3@gmail.com");
-
EXPECT_CALL(helper, StartLogOutUrlFetch());
- EXPECT_CALL(helper, StartFetching()).Times(2);
- EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
- no_error()));
- EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc3@gmail.com",
+ EXPECT_CALL(helper, StartFetchingUbertoken());
+ EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc2@gmail.com",
no_error()));
- helper.LogOut("acc2@gmail.com", current_accounts);
- SimulateLogoutSuccess(&helper);
+
+ helper.AddAccountToCookie("acc2@gmail.com");
SimulateMergeSessionSuccess(&helper, "token1");
- SimulateMergeSessionSuccess(&helper, "token3");
+
+ helper.LogOutAllAccounts();
+ SimulateLogoutSuccess(&helper);
}
Roger Tawa OOO till Jul 10th 2015/03/30 18:57:23 You should write tests to cover more cases: 1/ ca
Mike Lerman 2015/04/01 16:39:35 I'll do the ListAccounts part once it's implemente
TEST_F(GaiaCookieManagerServiceTest, PendingSigninThenSignout) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
MockObserver observer(&helper);
- std::vector<std::string> current_accounts;
- current_accounts.push_back("acc2@gmail.com");
- current_accounts.push_back("acc3@gmail.com");
-
// From the first Signin.
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
no_error()));
@@ -278,13 +269,15 @@ TEST_F(GaiaCookieManagerServiceTest, PendingSigninThenSignout) {
no_error()));
// Total sign in 2 times, not enforcing ordered sequences.
- EXPECT_CALL(helper, StartFetching()).Times(2);
+ EXPECT_CALL(helper, StartFetchingUbertoken()).Times(2);
helper.AddAccountToCookie("acc1@gmail.com");
- helper.LogOut("acc2@gmail.com", current_accounts);
+ helper.LogOutAllAccounts();
SimulateMergeSessionSuccess(&helper, "token1");
SimulateLogoutSuccess(&helper);
+
+ helper.AddAccountToCookie("acc3@gmail.com");
SimulateMergeSessionSuccess(&helper, "token3");
}
@@ -294,7 +287,7 @@ TEST_F(GaiaCookieManagerServiceTest, CancelSignIn) {
std::vector<std::string> current_accounts;
- EXPECT_CALL(helper, StartFetching());
+ EXPECT_CALL(helper, StartFetchingUbertoken());
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc2@gmail.com",
canceled()));
EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
@@ -303,42 +296,12 @@ TEST_F(GaiaCookieManagerServiceTest, CancelSignIn) {
helper.AddAccountToCookie("acc1@gmail.com");
helper.AddAccountToCookie("acc2@gmail.com");
- helper.LogOut("acc2@gmail.com", current_accounts);
+ helper.LogOutAllAccounts();
SimulateMergeSessionSuccess(&helper, "token1");
SimulateLogoutSuccess(&helper);
}
-TEST_F(GaiaCookieManagerServiceTest, DoubleSignout) {
- InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
- MockObserver observer(&helper);
-
- std::vector<std::string> current_accounts1;
- current_accounts1.push_back("acc1@gmail.com");
- current_accounts1.push_back("acc2@gmail.com");
- current_accounts1.push_back("acc3@gmail.com");
-
- std::vector<std::string> current_accounts2;
- current_accounts2.push_back("acc1@gmail.com");
- current_accounts2.push_back("acc3@gmail.com");
-
- EXPECT_CALL(helper, StartFetching()).Times(2);
- EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc3@gmail.com",
- canceled()));
- EXPECT_CALL(observer, OnAddAccountToCookieCompleted("acc1@gmail.com",
- no_error()))
- .Times(2);
- EXPECT_CALL(helper, StartLogOutUrlFetch());
-
- helper.AddAccountToCookie("acc1@gmail.com");
- helper.LogOut("acc2@gmail.com", current_accounts1);
- helper.LogOut("acc3@gmail.com", current_accounts2);
-
- SimulateMergeSessionSuccess(&helper, "token1");
- SimulateLogoutSuccess(&helper);
- SimulateMergeSessionSuccess(&helper, "token1");
-}
-
TEST_F(GaiaCookieManagerServiceTest, ExternalCcResultFetcher) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
GaiaCookieManagerService::ExternalCcResultFetcher result_fetcher(&helper);

Powered by Google App Engine
This is Rietveld 408576698