Chromium Code Reviews

Side by Side Diff: chrome/browser/sync/engine/auth_watcher_unittest.cc

Issue 3078022: Unplumb AllStatus from SyncerThread. (Closed)
Patch Set: parens Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_ptr.h" 5 #include "base/scoped_ptr.h"
6 #include "base/scoped_temp_dir.h" 6 #include "base/scoped_temp_dir.h"
7 #include "base/test/test_file_util.h" 7 #include "base/test/test_file_util.h"
8 #include "base/waitable_event.h" 8 #include "base/waitable_event.h"
9 #include "chrome/browser/password_manager/encryptor.h" 9 #include "chrome/browser/password_manager/encryptor.h"
10 #include "chrome/browser/sync/engine/all_status.h"
11 #include "chrome/browser/sync/engine/auth_watcher.h" 10 #include "chrome/browser/sync/engine/auth_watcher.h"
11 #include "chrome/browser/sync/engine/syncer_thread.h"
12 #include "chrome/browser/sync/util/user_settings.h" 12 #include "chrome/browser/sync/util/user_settings.h"
13 #include "chrome/common/deprecated/event_sys-inl.h" 13 #include "chrome/common/deprecated/event_sys-inl.h"
14 #include "chrome/common/net/http_return.h" 14 #include "chrome/common/net/http_return.h"
15 #include "chrome/common/net/gaia/gaia_authenticator.h" 15 #include "chrome/common/net/gaia/gaia_authenticator.h"
16 #include "chrome/test/sync/engine/mock_connection_manager.h" 16 #include "chrome/test/sync/engine/mock_connection_manager.h"
17 #include "chrome/test/sync/engine/test_directory_setter_upper.h" 17 #include "chrome/test/sync/engine/test_directory_setter_upper.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 static FilePath::CharType kUserSettingsDB[] = 20 static FilePath::CharType kUserSettingsDB[] =
21 FILE_PATH_LITERAL("Settings.sqlite3"); 21 FILE_PATH_LITERAL("Settings.sqlite3");
(...skipping 14 matching lines...)
36 36
37 class GaiaAuthMockForAuthWatcher : public gaia::GaiaAuthenticator { 37 class GaiaAuthMockForAuthWatcher : public gaia::GaiaAuthenticator {
38 public: 38 public:
39 GaiaAuthMockForAuthWatcher() : GaiaAuthenticator( 39 GaiaAuthMockForAuthWatcher() : GaiaAuthenticator(
40 kTestUserAgent, kTestServiceId, kTestGaiaURL), 40 kTestUserAgent, kTestServiceId, kTestGaiaURL),
41 use_bad_auth_token_(false) {} 41 use_bad_auth_token_(false) {}
42 virtual ~GaiaAuthMockForAuthWatcher() {} 42 virtual ~GaiaAuthMockForAuthWatcher() {}
43 43
44 virtual int GetBackoffDelaySeconds( 44 virtual int GetBackoffDelaySeconds(
45 int current_backoff_delay) { 45 int current_backoff_delay) {
46 return AllStatus::GetRecommendedDelaySeconds(current_backoff_delay); 46 return SyncerThread::GetRecommendedDelaySeconds(current_backoff_delay);
47 } 47 }
48 48
49 void SendBadAuthTokenForNextRequest() { use_bad_auth_token_ = true; } 49 void SendBadAuthTokenForNextRequest() { use_bad_auth_token_ = true; }
50 50
51 std::string renewed_token() { 51 std::string renewed_token() {
52 return renewed_token_; 52 return renewed_token_;
53 } 53 }
54 54
55 protected: 55 protected:
56 bool PerformGaiaRequest(const AuthParams& params, AuthResults* results) { 56 bool PerformGaiaRequest(const AuthParams& params, AuthResults* results) {
(...skipping 169 matching lines...)
226 EXPECT_EQ(AuthWatcherEvent::AUTHENTICATION_ATTEMPT_START, ConsumeNextEvent()); 226 EXPECT_EQ(AuthWatcherEvent::AUTHENTICATION_ATTEMPT_START, ConsumeNextEvent());
227 EXPECT_EQ(AuthWatcherEvent::AUTH_SUCCEEDED, ConsumeNextEvent()); 227 EXPECT_EQ(AuthWatcherEvent::AUTH_SUCCEEDED, ConsumeNextEvent());
228 228
229 auth_watcher()->RenewAuthToken("updated_token"); 229 auth_watcher()->RenewAuthToken("updated_token");
230 EXPECT_EQ(AuthWatcherEvent::AUTH_RENEWED, ConsumeNextEvent()); 230 EXPECT_EQ(AuthWatcherEvent::AUTH_RENEWED, ConsumeNextEvent());
231 EXPECT_EQ(gaia_auth()->renewed_token(), "updated_token"); 231 EXPECT_EQ(gaia_auth()->renewed_token(), "updated_token");
232 EXPECT_EQ(connection()->auth_token(), "updated_token"); 232 EXPECT_EQ(connection()->auth_token(), "updated_token");
233 } 233 }
234 234
235 } // namespace browser_sync 235 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/all_status_unittest.cc ('k') | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »

Powered by Google App Engine