OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 #include "chrome/browser/sync/profile_sync_service_harness.h" | 6 #include "chrome/browser/sync/profile_sync_service_harness.h" |
7 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 7 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
8 #include "chrome/browser/sync/test/integration/sync_test.h" | 8 #include "chrome/browser/sync/test/integration/sync_test.h" |
9 | 9 |
10 using bookmarks_helper::AddFolder; | 10 using bookmarks_helper::AddFolder; |
(...skipping 13 matching lines...) Expand all Loading... |
24 private: | 24 private: |
25 DISALLOW_COPY_AND_ASSIGN(SingleClientBookmarksSyncTest); | 25 DISALLOW_COPY_AND_ASSIGN(SingleClientBookmarksSyncTest); |
26 }; | 26 }; |
27 | 27 |
28 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, OfflineToOnline) { | 28 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, OfflineToOnline) { |
29 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 29 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
30 | 30 |
31 DisableNetwork(GetProfile(0)); | 31 DisableNetwork(GetProfile(0)); |
32 const BookmarkNode* node = AddFolder(0, L"title"); | 32 const BookmarkNode* node = AddFolder(0, L"title"); |
33 SetTitle(0, node, L"new_title"); | 33 SetTitle(0, node, L"new_title"); |
34 ASSERT_FALSE(GetClient(0)->AwaitFullSyncCompletion("Offline state change.")); | 34 // Expect that we backoff exponentially while we are unable to contact the |
35 ProfileSyncService::Status status = GetClient(0)->GetStatus(); | 35 // server. |
36 | 36 ASSERT_TRUE(GetClient(0)->AwaitExponentialBackoffVerification()); |
37 // Depending on when exactly the network change notification occurs the | |
38 // client could go to OFFLINE_UNSYNCED or OFFLINE. OFFLINE_UNSYNCED indicates | |
39 // client tried to sync a local change and could not connect to the server. | |
40 // OFFLINE indicates client received a network change notification of | |
41 // the disconnection even before it tried to sync. | |
42 ASSERT_TRUE(ProfileSyncService::Status::OFFLINE_UNSYNCED == status.summary || | |
43 ProfileSyncService::Status::OFFLINE == status.summary); | |
44 | 37 |
45 EnableNetwork(GetProfile(0)); | 38 EnableNetwork(GetProfile(0)); |
46 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Commit changes.")); | 39 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Commit changes.")); |
47 ASSERT_EQ(ProfileSyncService::Status::READY, | 40 ASSERT_EQ(ProfileSyncService::Status::READY, |
48 GetClient(0)->GetStatus().summary); | 41 GetClient(0)->GetStatus().summary); |
49 ASSERT_TRUE(ModelMatchesVerifier(0)); | 42 ASSERT_TRUE(ModelMatchesVerifier(0)); |
50 } | 43 } |
51 | 44 |
52 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { | 45 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { |
53 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 46 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 ASSERT_EQ(ProfileSyncService::Status::READY, | 159 ASSERT_EQ(ProfileSyncService::Status::READY, |
167 GetClient(0)->GetStatus().summary); | 160 GetClient(0)->GetStatus().summary); |
168 | 161 |
169 RestartSyncService(0); | 162 RestartSyncService(0); |
170 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Restarted sync.")); | 163 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Restarted sync.")); |
171 ASSERT_TRUE(ModelMatchesVerifier(0)); | 164 ASSERT_TRUE(ModelMatchesVerifier(0)); |
172 ASSERT_EQ(ProfileSyncService::Status::READY, | 165 ASSERT_EQ(ProfileSyncService::Status::READY, |
173 GetClient(0)->GetStatus().summary); | 166 GetClient(0)->GetStatus().summary); |
174 ASSERT_EQ(0, GetClient(0)->GetStatus().unsynced_count); | 167 ASSERT_EQ(0, GetClient(0)->GetStatus().unsynced_count); |
175 } | 168 } |
OLD | NEW |