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

Unified Diff: chrome/browser/ui/webui/sync_setup_handler_unittest.cc

Issue 15421011: Use OAuth2 token for sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove token prefetch. Move UMA counters. Fix some tests. Etc. Created 7 years, 7 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/ui/webui/sync_setup_handler_unittest.cc
diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
index 0c16c3ee27c12ea7d7ae53549a4ff8df95e3c9cb..69048c9827f90ccc6d808e63c12533c759f44e66 100644
--- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
@@ -28,6 +28,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/scoped_testing_local_state.h"
#include "content/public/browser/web_ui.h"
+#include "content/public/test/test_browser_thread.h"
#include "grit/generated_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
@@ -392,7 +393,7 @@ class SyncSetupHandlerTest : public testing::TestWithParam<bool> {
}
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(true));
EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted())
.WillRepeatedly(Return(true));
@@ -453,7 +454,7 @@ TEST_P(SyncSetupHandlerTest, Basic) {
TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) {
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(false));
const GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error));
@@ -495,7 +496,7 @@ TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) {
TEST_P(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn) {
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(false));
EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted())
.WillRepeatedly(Return(false));
@@ -526,7 +527,7 @@ TEST_P(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) {
.WillRepeatedly(Return(true));
profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, kTestUser);
mock_signin_->Initialize(profile_.get(), NULL);
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(true));
EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted())
.WillRepeatedly(Return(false));
@@ -556,7 +557,7 @@ TEST_P(SyncSetupHandlerTest,
.WillRepeatedly(Return(true));
profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, kTestUser);
mock_signin_->Initialize(profile_.get(), NULL);
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(true));
EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted())
.WillRepeatedly(Return(false));
@@ -614,7 +615,7 @@ TEST_P(SyncSetupHandlerTest,
.WillRepeatedly(Return(true));
profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, kTestUser);
mock_signin_->Initialize(profile_.get(), NULL);
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(true));
EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted())
.WillRepeatedly(Return(false));
@@ -645,7 +646,7 @@ TEST_P(SyncSetupHandlerTest,
.WillRepeatedly(Return(true));
profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, kTestUser);
mock_signin_->Initialize(profile_.get(), NULL);
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(true));
EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted())
.WillRepeatedly(Return(false));
@@ -684,7 +685,7 @@ class SyncSetupHandlerNonCrosTest : public SyncSetupHandlerTest {
TEST_P(SyncSetupHandlerNonCrosTest, HandleGaiaAuthFailure) {
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(false));
EXPECT_CALL(*mock_pss_, HasUnrecoverableError())
.WillRepeatedly(Return(false));
@@ -727,7 +728,7 @@ TEST_P(SyncSetupHandlerNonCrosTest, HandleGaiaAuthFailure) {
TEST_P(SyncSetupHandlerNonCrosTest, HandleCaptcha) {
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(false));
EXPECT_CALL(*mock_pss_, HasUnrecoverableError())
.WillRepeatedly(Return(false));
@@ -771,7 +772,7 @@ TEST_P(SyncSetupHandlerNonCrosTest, HandleCaptcha) {
TEST_P(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) {
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(false));
EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted())
.WillRepeatedly(Return(false));
@@ -821,7 +822,7 @@ TEST_P(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) {
TEST_P(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) {
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(false));
EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted())
.WillRepeatedly(Return(false));
@@ -1156,7 +1157,7 @@ TEST_P(SyncSetupHandlerTest, ShowSigninOnAuthError) {
provider.SetAuthError(error_);
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable())
+ EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable())
.WillRepeatedly(Return(true));
EXPECT_CALL(*mock_pss_, IsPassphraseRequired())
.WillRepeatedly(Return(false));

Powered by Google App Engine
This is Rietveld 408576698