Chromium Code Reviews| 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| 9 #include "chrome/browser/sync/test/integration/passwords_helper.h" | 9 #include "chrome/browser/sync/test/integration/passwords_helper.h" |
| 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 : SingleClientStatusChangeChecker(service) {} | 31 : SingleClientStatusChangeChecker(service) {} |
| 32 | 32 |
| 33 bool IsExitConditionSatisfied() override { | 33 bool IsExitConditionSatisfied() override { |
| 34 return !service()->IsSetupInProgress() && | 34 return !service()->IsSetupInProgress() && |
| 35 !service()->IsFirstSetupComplete(); | 35 !service()->IsFirstSetupComplete(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 std::string GetDebugMessage() const override { return "Sync Disabled"; } | 38 std::string GetDebugMessage() const override { return "Sync Disabled"; } |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 class SyncBackendStoppedChecker : public SingleClientStatusChangeChecker { | 41 class SyncBackendStoppedChecker : public SingleClientStatusChangeChecker { |
|
skym
2016/12/05 19:38:56
backend
maxbogue
2016/12/05 22:17:11
Done.
| |
| 42 public: | 42 public: |
| 43 explicit SyncBackendStoppedChecker(ProfileSyncService* service) | 43 explicit SyncBackendStoppedChecker(ProfileSyncService* service) |
| 44 : SingleClientStatusChangeChecker(service) {} | 44 : SingleClientStatusChangeChecker(service) {} |
| 45 | 45 |
| 46 // StatusChangeChecker implementation. | 46 // StatusChangeChecker implementation. |
| 47 bool IsExitConditionSatisfied() override { | 47 bool IsExitConditionSatisfied() override { |
| 48 return !service()->IsBackendInitialized(); | 48 return !service()->IsEngineInitialized(); |
| 49 } | 49 } |
| 50 std::string GetDebugMessage() const override { return "Sync stopped"; } | 50 std::string GetDebugMessage() const override { return "Sync stopped"; } |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class TypeDisabledChecker : public SingleClientStatusChangeChecker { | 53 class TypeDisabledChecker : public SingleClientStatusChangeChecker { |
| 54 public: | 54 public: |
| 55 explicit TypeDisabledChecker(ProfileSyncService* service, | 55 explicit TypeDisabledChecker(ProfileSyncService* service, |
| 56 syncer::ModelType type) | 56 syncer::ModelType type) |
| 57 : SingleClientStatusChangeChecker(service), type_(type) {} | 57 : SingleClientStatusChangeChecker(service), type_(type) {} |
| 58 | 58 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 SetTitle(0, node2, "new_title2"); | 193 SetTitle(0, node2, "new_title2"); |
| 194 ASSERT_TRUE(SyncDisabledChecker(GetSyncService(0)).Wait()); | 194 ASSERT_TRUE(SyncDisabledChecker(GetSyncService(0)).Wait()); |
| 195 ProfileSyncService::Status status; | 195 ProfileSyncService::Status status; |
| 196 GetSyncService(0)->QueryDetailedSyncStatus(&status); | 196 GetSyncService(0)->QueryDetailedSyncStatus(&status); |
| 197 ASSERT_EQ(status.sync_protocol_error.error_type, syncer::NOT_MY_BIRTHDAY); | 197 ASSERT_EQ(status.sync_protocol_error.error_type, syncer::NOT_MY_BIRTHDAY); |
| 198 ASSERT_EQ(status.sync_protocol_error.action, syncer::DISABLE_SYNC_ON_CLIENT); | 198 ASSERT_EQ(status.sync_protocol_error.action, syncer::DISABLE_SYNC_ON_CLIENT); |
| 199 ASSERT_EQ(status.sync_protocol_error.url, url); | 199 ASSERT_EQ(status.sync_protocol_error.url, url); |
| 200 ASSERT_EQ(status.sync_protocol_error.error_description, description); | 200 ASSERT_EQ(status.sync_protocol_error.error_description, description); |
| 201 } | 201 } |
| 202 | 202 |
| 203 // Tests that on receiving CLIENT_DATA_OBSOLETE sync backend gets restarted and | 203 // Tests that on receiving CLIENT_DATA_OBSOLETE sync backend gets restarted and |
|
skym
2016/12/05 19:38:56
backend
maxbogue
2016/12/05 22:17:11
Done.
| |
| 204 // initialized with different cache_guld. | 204 // initialized with different cache_guld. |
| 205 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ClientDataObsoleteTest) { | 205 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ClientDataObsoleteTest) { |
| 206 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 206 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 207 | 207 |
| 208 const BookmarkNode* node1 = AddFolder(0, 0, "title1"); | 208 const BookmarkNode* node1 = AddFolder(0, 0, "title1"); |
| 209 SetTitle(0, node1, "new_title1"); | 209 SetTitle(0, node1, "new_title1"); |
| 210 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); | 210 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); |
| 211 | 211 |
| 212 std::string description = "Not My Fault"; | 212 std::string description = "Not My Fault"; |
| 213 std::string url = "www.google.com"; | 213 std::string url = "www.google.com"; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 TypeDisabledChecker(GetSyncService(0), syncer::TYPED_URLS).Wait()); | 250 TypeDisabledChecker(GetSyncService(0), syncer::TYPED_URLS).Wait()); |
| 251 ASSERT_TRUE(TypeDisabledChecker(GetSyncService(0), syncer::SESSIONS).Wait()); | 251 ASSERT_TRUE(TypeDisabledChecker(GetSyncService(0), syncer::SESSIONS).Wait()); |
| 252 | 252 |
| 253 const BookmarkNode* node1 = AddFolder(0, 0, "title1"); | 253 const BookmarkNode* node1 = AddFolder(0, 0, "title1"); |
| 254 SetTitle(0, node1, "new_title1"); | 254 SetTitle(0, node1, "new_title1"); |
| 255 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); | 255 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); |
| 256 // TODO(lipalani): Verify initial sync ended for typed url is false. | 256 // TODO(lipalani): Verify initial sync ended for typed url is false. |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace | 259 } // namespace |
| OLD | NEW |