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

Unified Diff: chrome/browser/extensions/app_notify_channel_setup_unittest.cc

Issue 8822006: Fix the app notify channel setup for the case where the user may have explicitly revoked permissi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
« no previous file with comments | « chrome/browser/extensions/app_notify_channel_setup.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/app_notify_channel_setup_unittest.cc
===================================================================
--- chrome/browser/extensions/app_notify_channel_setup_unittest.cc (revision 113112)
+++ chrome/browser/extensions/app_notify_channel_setup_unittest.cc (working copy)
@@ -182,13 +182,13 @@
delegate_.AsWeakPtr());
}
- virtual void SetupLogin(bool should_succeed) {
+ virtual void SetupLogin(bool should_prompt, bool should_succeed) {
if (should_succeed) {
SetLoggedInUser("user@gmail.com");
profile_.SetTokenServiceHasTokenResult(true);
- } else {
- ui_->SetSyncSetupResult(false);
}
+ if (should_prompt)
+ ui_->SetSyncSetupResult(should_succeed);
}
virtual void SetupFetchAccessToken(bool should_succeed) {
@@ -230,22 +230,24 @@
};
TEST_F(AppNotifyChannelSetupTest, LoginFailure) {
- SetupLogin(false);
+ SetupLogin(true, false);
scoped_refptr<AppNotifyChannelSetup> setup = CreateInstance();
RunServerTest(setup, "", "canceled_by_user");
}
-TEST_F(AppNotifyChannelSetupTest, FetchAccessTokenFailure) {
- SetupLogin(true);
+TEST_F(AppNotifyChannelSetupTest, DoubleFetchAccessTokenFailure) {
+ SetupLogin(false, true);
SetupFetchAccessToken(false);
+ SetupLogin(true, true);
+ SetupFetchAccessToken(false);
scoped_refptr<AppNotifyChannelSetup> setup = CreateInstance();
RunServerTest(setup, "", "internal_error");
}
TEST_F(AppNotifyChannelSetupTest, RecordGrantFailure) {
- SetupLogin(true);
+ SetupLogin(false, true);
SetupFetchAccessToken(true);
SetupRecordGrant(false);
@@ -254,7 +256,7 @@
}
TEST_F(AppNotifyChannelSetupTest, GetChannelIdFailure) {
- SetupLogin(true);
+ SetupLogin(false, true);
SetupFetchAccessToken(true);
SetupRecordGrant(true);
SetupGetChannelId(false);
@@ -263,8 +265,8 @@
RunServerTest(setup, "", "internal_error");
}
-TEST_F(AppNotifyChannelSetupTest, ServerSuccess) {
- SetupLogin(true);
+TEST_F(AppNotifyChannelSetupTest, FirstFetchAccessTokenSuccess) {
+ SetupLogin(false, true);
SetupFetchAccessToken(true);
SetupRecordGrant(true);
SetupGetChannelId(true);
@@ -272,3 +274,15 @@
scoped_refptr<AppNotifyChannelSetup> setup = CreateInstance();
RunServerTest(setup, "dummy_do_not_use", "");
}
+
+TEST_F(AppNotifyChannelSetupTest, SecondFetchAccessTokenSuccess) {
+ SetupLogin(false, true);
+ SetupFetchAccessToken(false);
+ SetupLogin(true, true);
+ SetupFetchAccessToken(true);
+ SetupRecordGrant(true);
+ SetupGetChannelId(true);
+
+ scoped_refptr<AppNotifyChannelSetup> setup = CreateInstance();
+ RunServerTest(setup, "dummy_do_not_use", "");
+}
« no previous file with comments | « chrome/browser/extensions/app_notify_channel_setup.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698