| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/test/integration/await_match_status_change_checker
.h" | 6 #include "chrome/browser/sync/test/integration/await_match_status_change_checker
.h" |
| 7 #include "chrome/browser/sync/test/integration/extensions_helper.h" | 7 #include "chrome/browser/sync/test/integration/extensions_helper.h" |
| 8 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" | 8 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
| 9 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 10 #include "components/browser_sync/browser/profile_sync_service.h" | 10 #include "components/browser_sync/browser/profile_sync_service.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Start with an extension installed, and setup sync. | 76 // Start with an extension installed, and setup sync. |
| 77 InstallExtensionForAllProfiles(0); | 77 InstallExtensionForAllProfiles(0); |
| 78 ASSERT_TRUE(SetupSync()); | 78 ASSERT_TRUE(SetupSync()); |
| 79 EXPECT_TRUE(AllProfilesHaveSameExtensionsAsVerifier()); | 79 EXPECT_TRUE(AllProfilesHaveSameExtensionsAsVerifier()); |
| 80 | 80 |
| 81 // Simulate a delete at the server. | 81 // Simulate a delete at the server. |
| 82 std::vector<sync_pb::SyncEntity> server_extensions = | 82 std::vector<sync_pb::SyncEntity> server_extensions = |
| 83 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS); | 83 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS); |
| 84 ASSERT_EQ(1ul, server_extensions.size()); | 84 ASSERT_EQ(1ul, server_extensions.size()); |
| 85 std::string entity_id = server_extensions[0].id_string(); | |
| 86 std::unique_ptr<fake_server::FakeServerEntity> tombstone( | 85 std::unique_ptr<fake_server::FakeServerEntity> tombstone( |
| 87 fake_server::TombstoneEntity::Create(entity_id)); | 86 fake_server::TombstoneEntity::Create( |
| 87 server_extensions[0].id_string(), |
| 88 server_extensions[0].client_defined_unique_tag())); |
| 88 GetFakeServer()->InjectEntity(std::move(tombstone)); | 89 GetFakeServer()->InjectEntity(std::move(tombstone)); |
| 89 | 90 |
| 90 // Modify the extension in the local profile to cause a conflict. | 91 // Modify the extension in the local profile to cause a conflict. |
| 91 DisableExtension(GetProfile(0), 0); | 92 DisableExtension(GetProfile(0), 0); |
| 92 EXPECT_EQ(1u, GetInstalledExtensions(GetProfile(0)).size()); | 93 EXPECT_EQ(1u, GetInstalledExtensions(GetProfile(0)).size()); |
| 93 | 94 |
| 94 // Trigger sync, and expect the extension to remain uninstalled at the server | 95 // Trigger sync, and expect the extension to remain uninstalled at the server |
| 95 // and get uninstalled locally. | 96 // and get uninstalled locally. |
| 96 const syncer::ModelTypeSet kExtensionsType(syncer::EXTENSIONS); | 97 const syncer::ModelTypeSet kExtensionsType(syncer::EXTENSIONS); |
| 97 TriggerSyncForModelTypes(0, kExtensionsType); | 98 TriggerSyncForModelTypes(0, kExtensionsType); |
| 98 server_extensions = | 99 server_extensions = |
| 99 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS); | 100 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS); |
| 100 EXPECT_EQ(0ul, server_extensions.size()); | 101 EXPECT_EQ(0ul, server_extensions.size()); |
| 101 | 102 |
| 102 AwaitMatchStatusChangeChecker checker( | 103 AwaitMatchStatusChangeChecker checker( |
| 103 base::Bind(&ExtensionCountCheck, GetProfile(0), 0u), | 104 base::Bind(&ExtensionCountCheck, GetProfile(0), 0u), |
| 104 "Waiting for profile to have no extensions"); | 105 "Waiting for profile to have no extensions"); |
| 105 checker.Wait(); | 106 checker.Wait(); |
| 106 EXPECT_TRUE(!checker.TimedOut()); | 107 EXPECT_TRUE(!checker.TimedOut()); |
| 107 EXPECT_TRUE(GetInstalledExtensions(GetProfile(0)).empty()); | 108 EXPECT_TRUE(GetInstalledExtensions(GetProfile(0)).empty()); |
| 108 } | 109 } |
| OLD | NEW |