| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "base/threading/platform_thread.h" | 6 #include "base/threading/platform_thread.h" |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 8 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 9 #include "chrome/browser/sync/profile_sync_service.h" | 9 #include "chrome/browser/sync/profile_sync_service.h" |
| 10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 "}"; | 44 "}"; |
| 45 | 45 |
| 46 const char kEmptyOAuth2Token[] = ""; | 46 const char kEmptyOAuth2Token[] = ""; |
| 47 | 47 |
| 48 const char kMalformedOAuth2Token[] = "{ \"foo\": "; | 48 const char kMalformedOAuth2Token[] = "{ \"foo\": "; |
| 49 | 49 |
| 50 class TestForAuthError : public SingleClientStatusChangeChecker { | 50 class TestForAuthError : public SingleClientStatusChangeChecker { |
| 51 public: | 51 public: |
| 52 explicit TestForAuthError(ProfileSyncService* service); | 52 explicit TestForAuthError(ProfileSyncService* service); |
| 53 virtual ~TestForAuthError(); | 53 virtual ~TestForAuthError(); |
| 54 virtual bool IsExitConditionSatisfied() OVERRIDE; | 54 virtual bool IsExitConditionSatisfied() override; |
| 55 virtual std::string GetDebugMessage() const OVERRIDE; | 55 virtual std::string GetDebugMessage() const override; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 TestForAuthError::TestForAuthError(ProfileSyncService* service) | 58 TestForAuthError::TestForAuthError(ProfileSyncService* service) |
| 59 : SingleClientStatusChangeChecker(service) {} | 59 : SingleClientStatusChangeChecker(service) {} |
| 60 | 60 |
| 61 TestForAuthError::~TestForAuthError() {} | 61 TestForAuthError::~TestForAuthError() {} |
| 62 | 62 |
| 63 bool TestForAuthError::IsExitConditionSatisfied() { | 63 bool TestForAuthError::IsExitConditionSatisfied() { |
| 64 return !service()->HasUnsyncedItems() || | 64 return !service()->HasUnsyncedItems() || |
| 65 (service()->GetSyncTokenStatus().last_get_token_error.state() != | 65 (service()->GetSyncTokenStatus().last_get_token_error.state() != |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 GetFakeServer()->SetAuthenticated(); | 298 GetFakeServer()->SetAuthenticated(); |
| 299 SetOAuth2TokenResponse(kValidOAuth2Token, | 299 SetOAuth2TokenResponse(kValidOAuth2Token, |
| 300 net::HTTP_OK, | 300 net::HTTP_OK, |
| 301 net::URLRequestStatus::SUCCESS); | 301 net::URLRequestStatus::SUCCESS); |
| 302 | 302 |
| 303 // Verify that the next sync cycle is successful, and uses the new auth token. | 303 // Verify that the next sync cycle is successful, and uses the new auth token. |
| 304 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); | 304 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); |
| 305 std::string new_token = GetSyncService((0))->GetAccessTokenForTest(); | 305 std::string new_token = GetSyncService((0))->GetAccessTokenForTest(); |
| 306 ASSERT_NE(old_token, new_token); | 306 ASSERT_NE(old_token, new_token); |
| 307 } | 307 } |
| OLD | NEW |