summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/sync_manager_impl_unittest.cc
diff options
context:
space:
mode:
authorpavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-05 04:14:53 +0000
committerpavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-05 04:14:53 +0000
commit7e31df8fe2753863416731f29b37c01441afaee4 (patch)
tree3035a33d0950793f47f3ef543edd0fb44fbb2249 /sync/internal_api/sync_manager_impl_unittest.cc
parent8f7d908a8a0c0a91edc0dd3c93fa823a801f5439 (diff)
downloadchromium_src-7e31df8fe2753863416731f29b37c01441afaee4.zip
chromium_src-7e31df8fe2753863416731f29b37c01441afaee4.tar.gz
chromium_src-7e31df8fe2753863416731f29b37c01441afaee4.tar.bz2
Remove connection_code_ from SyncSchedulerImpl.
Removed connection_code_ from SyncSchedulerImpl since it essentially mirrors ServerConnectionManager::server_status_. One behavior changed as result of this change: Previously if SyncSchedulerImpl::OnConnectionStatusChange was called when connection_code_ is CONNECTION_UNAVAILABLE it would reset connection_code_ to SERVER_CONNECTION_OK and consecutive calls to SyncSchedulerImpl::OnConnectionStatusChange would not post canary job until current one is finished and updates server_status_. With this change it is no longer true. Also moved notification about auth error from SyncManagerImpl::OnInvalidatorStateChange to common code path. It no longer makes assumption about error code that connection manager is going to set in OnInvalidationCredentialsRejected. Also removed few references to get_time. BUG=177535 Review URL: https://chromiumcodereview.appspot.com/12390070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/sync_manager_impl_unittest.cc')
-rw-r--r--sync/internal_api/sync_manager_impl_unittest.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc
index f86b48b..37416c0 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -1343,7 +1343,7 @@ TEST_F(SyncManagerTest, OnInvalidatorStateChangeJsEvents) {
auth_error_details.SetString("status", "CONNECTION_AUTH_ERROR");
EXPECT_CALL(manager_observer_,
- OnConnectionStatusChange(CONNECTION_AUTH_ERROR)).Times(3);
+ OnConnectionStatusChange(CONNECTION_AUTH_ERROR));
EXPECT_CALL(
event_handler,
@@ -1357,12 +1357,21 @@ TEST_F(SyncManagerTest, OnInvalidatorStateChangeJsEvents) {
EXPECT_CALL(
event_handler,
HandleJsEvent("onNotificationStateChange",
- HasDetailsAsDictionary(credentials_rejected_details)));
+ HasDetailsAsDictionary(credentials_rejected_details)))
+ .Times(2);
EXPECT_CALL(event_handler,
HandleJsEvent("onNotificationStateChange",
HasDetailsAsDictionary(transient_error_details)));
+ // Test needs to simulate INVALIDATION_CREDENTIALS_REJECTED with event handler
+ // attached because this is the only time when CONNECTION_AUTH_ERROR
+ // notification will be generated, therefore the only chance to verify that
+ // "onConnectionStatusChange" event is delivered
+ SetJsEventHandler(event_handler.AsWeakHandle());
+ SimulateInvalidatorStateChangeForTest(INVALIDATION_CREDENTIALS_REJECTED);
+ SetJsEventHandler(WeakHandle<JsEventHandler>());
+
SimulateInvalidatorStateChangeForTest(INVALIDATIONS_ENABLED);
SimulateInvalidatorStateChangeForTest(INVALIDATION_CREDENTIALS_REJECTED);
SimulateInvalidatorStateChangeForTest(TRANSIENT_INVALIDATION_ERROR);