summaryrefslogtreecommitdiff
path: root/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:20:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:28:57 +0000
commitd17ea114e5ef69ad5d5d7413280a13e6428098aa (patch)
tree2c01a75df69f30d27b1432467cfe7c1467a498da /chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc
parent8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (diff)
downloadqtwebengine-chromium-d17ea114e5ef69ad5d5d7413280a13e6428098aa.tar.gz
BASELINE: Update Chromium to 67.0.3396.47
Change-Id: Idcb1341782e417561a2473eeecc82642dafda5b7 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc')
-rw-r--r--chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc b/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc
index e8a19250234..9710636cf6e 100644
--- a/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc
+++ b/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc
@@ -35,6 +35,7 @@ void FakeProfileOAuth2TokenService::IssueAllTokensForAccount(
const std::string& account_id,
const std::string& access_token,
const base::Time& expiration) {
+ DCHECK(!auto_post_fetch_response_on_message_loop_);
CompleteRequests(account_id, true, ScopeSet(),
GoogleServiceAuthError::AuthErrorNone(), access_token,
expiration);
@@ -43,6 +44,7 @@ void FakeProfileOAuth2TokenService::IssueAllTokensForAccount(
void FakeProfileOAuth2TokenService::IssueErrorForAllPendingRequestsForAccount(
const std::string& account_id,
const GoogleServiceAuthError& error) {
+ DCHECK(!auto_post_fetch_response_on_message_loop_);
CompleteRequests(account_id, true, ScopeSet(), error, std::string(),
base::Time());
}
@@ -51,6 +53,7 @@ void FakeProfileOAuth2TokenService::IssueTokenForScope(
const ScopeSet& scope,
const std::string& access_token,
const base::Time& expiration) {
+ DCHECK(!auto_post_fetch_response_on_message_loop_);
CompleteRequests("", false, scope, GoogleServiceAuthError::AuthErrorNone(),
access_token, expiration);
}
@@ -58,22 +61,31 @@ void FakeProfileOAuth2TokenService::IssueTokenForScope(
void FakeProfileOAuth2TokenService::IssueErrorForScope(
const ScopeSet& scope,
const GoogleServiceAuthError& error) {
+ DCHECK(!auto_post_fetch_response_on_message_loop_);
CompleteRequests("", false, scope, error, std::string(), base::Time());
}
void FakeProfileOAuth2TokenService::IssueErrorForAllPendingRequests(
const GoogleServiceAuthError& error) {
+ DCHECK(!auto_post_fetch_response_on_message_loop_);
CompleteRequests("", true, ScopeSet(), error, std::string(), base::Time());
}
void FakeProfileOAuth2TokenService::IssueTokenForAllPendingRequests(
const std::string& access_token,
const base::Time& expiration) {
+ DCHECK(!auto_post_fetch_response_on_message_loop_);
CompleteRequests("", true, ScopeSet(),
GoogleServiceAuthError::AuthErrorNone(), access_token,
expiration);
}
+void FakeProfileOAuth2TokenService::UpdateAuthErrorForTesting(
+ const std::string& account_id,
+ const GoogleServiceAuthError& error) {
+ ProfileOAuth2TokenService::UpdateAuthError(account_id, error);
+}
+
void FakeProfileOAuth2TokenService::CompleteRequests(
const std::string& account_id,
bool all_scopes,
@@ -125,9 +137,11 @@ void FakeProfileOAuth2TokenService::FetchOAuth2Token(
if (auto_post_fetch_response_on_message_loop_) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
- base::Bind(&FakeProfileOAuth2TokenService::IssueAllTokensForAccount,
- weak_ptr_factory_.GetWeakPtr(), account_id, "access_token",
- base::Time::Max()));
+ base::BindOnce(&FakeProfileOAuth2TokenService::CompleteRequests,
+ weak_ptr_factory_.GetWeakPtr(), account_id,
+ /*all_scoped=*/true, ScopeSet(),
+ GoogleServiceAuthError::AuthErrorNone(), "access_token",
+ base::Time::Max()));
}
}