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

Side by Side Diff: chrome/browser/sync/test/integration/sync_auth_test.cc

Issue 2354613002: [Sync] Fix namespaces for the browser_sync component. (Closed)
Patch Set: Address comments. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/threading/platform_thread.h" 7 #include "base/threading/platform_thread.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const char kInvalidClientOAuth2Token[] = "{" 43 const char kInvalidClientOAuth2Token[] = "{"
44 " \"error\": \"invalid_client\"" 44 " \"error\": \"invalid_client\""
45 "}"; 45 "}";
46 46
47 const char kEmptyOAuth2Token[] = ""; 47 const char kEmptyOAuth2Token[] = "";
48 48
49 const char kMalformedOAuth2Token[] = "{ \"foo\": "; 49 const char kMalformedOAuth2Token[] = "{ \"foo\": ";
50 50
51 class TestForAuthError : public SingleClientStatusChangeChecker { 51 class TestForAuthError : public SingleClientStatusChangeChecker {
52 public: 52 public:
53 explicit TestForAuthError(ProfileSyncService* service); 53 explicit TestForAuthError(browser_sync::ProfileSyncService* service);
54 ~TestForAuthError() override; 54 ~TestForAuthError() override;
55 bool IsExitConditionSatisfied() override; 55 bool IsExitConditionSatisfied() override;
56 std::string GetDebugMessage() const override; 56 std::string GetDebugMessage() const override;
57 }; 57 };
58 58
59 TestForAuthError::TestForAuthError(ProfileSyncService* service) 59 TestForAuthError::TestForAuthError(browser_sync::ProfileSyncService* service)
60 : SingleClientStatusChangeChecker(service) {} 60 : SingleClientStatusChangeChecker(service) {}
61 61
62 TestForAuthError::~TestForAuthError() {} 62 TestForAuthError::~TestForAuthError() {}
63 63
64 bool TestForAuthError::IsExitConditionSatisfied() { 64 bool TestForAuthError::IsExitConditionSatisfied() {
65 return !service()->HasUnsyncedItems() || 65 return !service()->HasUnsyncedItems() ||
66 (service()->GetSyncTokenStatus().last_get_token_error.state() != 66 (service()->GetSyncTokenStatus().last_get_token_error.state() !=
67 GoogleServiceAuthError::NONE); 67 GoogleServiceAuthError::NONE);
68 } 68 }
69 69
70 std::string TestForAuthError::GetDebugMessage() const { 70 std::string TestForAuthError::GetDebugMessage() const {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 GetFakeServer()->SetAuthenticated(); 299 GetFakeServer()->SetAuthenticated();
300 SetOAuth2TokenResponse(kValidOAuth2Token, 300 SetOAuth2TokenResponse(kValidOAuth2Token,
301 net::HTTP_OK, 301 net::HTTP_OK,
302 net::URLRequestStatus::SUCCESS); 302 net::URLRequestStatus::SUCCESS);
303 303
304 // Verify that the next sync cycle is successful, and uses the new auth token. 304 // Verify that the next sync cycle is successful, and uses the new auth token.
305 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); 305 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
306 std::string new_token = GetSyncService((0))->GetAccessTokenForTest(); 306 std::string new_token = GetSyncService((0))->GetAccessTokenForTest();
307 ASSERT_NE(old_token, new_token); 307 ASSERT_NE(old_token, new_token);
308 } 308 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698