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

Unified Diff: chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc

Issue 2630023002: Do not fetch tokens for telemetry tests. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc
diff --git a/chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc b/chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc
index a656291564b206988b03532ac63df0051bdfb7b6..077b3b95d0d8a81d6e4f28dc40c64f0413dc7638 100644
--- a/chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc
+++ b/chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.cc
@@ -8,9 +8,11 @@
#include <vector>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_util.h"
+#include "chromeos/chromeos_switches.h"
#include "content/public/browser/browser_thread.h"
#include "google_apis/gaia/gaia_auth_fetcher.h"
#include "google_apis/gaia/gaia_constants.h"
@@ -164,6 +166,16 @@ void PolicyOAuth2TokenFetcherImpl::StartWithRefreshToken(
}
void PolicyOAuth2TokenFetcherImpl::StartFetchingRefreshToken() {
+ // Don't fetch tokens for test.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ chromeos::switches::kDisableGaiaServices)) {
+ failed_ = true;
+ ForwardPolicyToken(
+ std::string(),
+ GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED));
+ return;
+ }
+
if (auth_code_.empty()) {
refresh_token_fetcher_.reset(new GaiaAuthFetcher(
this, GaiaConstants::kChromeSource, auth_context_getter_.get()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698