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

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

Issue 2461463002: [Sync] Replacing NULL with nullptr/null throughout sync code. (Closed)
Patch Set: Reverted PROFILE_nullptr mistake. Created 4 years, 1 month 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 SyncAuthTest() : SyncTest(SINGLE_CLIENT), bookmark_index_(0) {} 74 SyncAuthTest() : SyncTest(SINGLE_CLIENT), bookmark_index_(0) {}
75 ~SyncAuthTest() override {} 75 ~SyncAuthTest() override {}
76 76
77 // Helper function that adds a bookmark and waits for either an auth error, or 77 // Helper function that adds a bookmark and waits for either an auth error, or
78 // for the bookmark to be committed. Returns true if it detects an auth 78 // for the bookmark to be committed. Returns true if it detects an auth
79 // error, false if the bookmark is committed successfully. 79 // error, false if the bookmark is committed successfully.
80 bool AttemptToTriggerAuthError() { 80 bool AttemptToTriggerAuthError() {
81 int bookmark_index = GetNextBookmarkIndex(); 81 int bookmark_index = GetNextBookmarkIndex();
82 std::string title = base::StringPrintf("Bookmark %d", bookmark_index); 82 std::string title = base::StringPrintf("Bookmark %d", bookmark_index);
83 GURL url = GURL(base::StringPrintf("http://www.foo%d.com", bookmark_index)); 83 GURL url = GURL(base::StringPrintf("http://www.foo%d.com", bookmark_index));
84 EXPECT_TRUE(AddURL(0, title, url) != NULL); 84 EXPECT_TRUE(AddURL(0, title, url) != nullptr);
85 85
86 // Run until the bookmark is committed or an auth error is encountered. 86 // Run until the bookmark is committed or an auth error is encountered.
87 TestForAuthError(GetSyncService(0)).Wait(); 87 TestForAuthError(GetSyncService(0)).Wait();
88 88
89 GoogleServiceAuthError oauth_error = 89 GoogleServiceAuthError oauth_error =
90 GetSyncService(0)->GetSyncTokenStatus().last_get_token_error; 90 GetSyncService(0)->GetSyncTokenStatus().last_get_token_error;
91 91
92 return oauth_error.state() != GoogleServiceAuthError::NONE; 92 return oauth_error.state() != GoogleServiceAuthError::NONE;
93 } 93 }
94 94
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 GetFakeServer()->SetAuthenticated(); 290 GetFakeServer()->SetAuthenticated();
291 SetOAuth2TokenResponse(kValidOAuth2Token, 291 SetOAuth2TokenResponse(kValidOAuth2Token,
292 net::HTTP_OK, 292 net::HTTP_OK,
293 net::URLRequestStatus::SUCCESS); 293 net::URLRequestStatus::SUCCESS);
294 294
295 // Verify that the next sync cycle is successful, and uses the new auth token. 295 // Verify that the next sync cycle is successful, and uses the new auth token.
296 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); 296 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
297 std::string new_token = GetSyncService(0)->GetAccessTokenForTest(); 297 std::string new_token = GetSyncService(0)->GetAccessTokenForTest();
298 ASSERT_NE(old_token, new_token); 298 ASSERT_NE(old_token, new_token);
299 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698