| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); | 85 std::string entity_id = server_extensions[0].id_string(); |
| 86 scoped_ptr<fake_server::FakeServerEntity> tombstone( | 86 std::unique_ptr<fake_server::FakeServerEntity> tombstone( |
| 87 fake_server::TombstoneEntity::Create(entity_id)); | 87 fake_server::TombstoneEntity::Create(entity_id)); |
| 88 GetFakeServer()->InjectEntity(std::move(tombstone)); | 88 GetFakeServer()->InjectEntity(std::move(tombstone)); |
| 89 | 89 |
| 90 // Modify the extension in the local profile to cause a conflict. | 90 // Modify the extension in the local profile to cause a conflict. |
| 91 DisableExtension(GetProfile(0), 0); | 91 DisableExtension(GetProfile(0), 0); |
| 92 EXPECT_EQ(1u, GetInstalledExtensions(GetProfile(0)).size()); | 92 EXPECT_EQ(1u, GetInstalledExtensions(GetProfile(0)).size()); |
| 93 | 93 |
| 94 // Trigger sync, and expect the extension to remain uninstalled at the server | 94 // Trigger sync, and expect the extension to remain uninstalled at the server |
| 95 // and get uninstalled locally. | 95 // and get uninstalled locally. |
| 96 const syncer::ModelTypeSet kExtensionsType(syncer::EXTENSIONS); | 96 const syncer::ModelTypeSet kExtensionsType(syncer::EXTENSIONS); |
| 97 TriggerSyncForModelTypes(0, kExtensionsType); | 97 TriggerSyncForModelTypes(0, kExtensionsType); |
| 98 server_extensions = | 98 server_extensions = |
| 99 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS); | 99 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS); |
| 100 EXPECT_EQ(0ul, server_extensions.size()); | 100 EXPECT_EQ(0ul, server_extensions.size()); |
| 101 | 101 |
| 102 AwaitMatchStatusChangeChecker checker( | 102 AwaitMatchStatusChangeChecker checker( |
| 103 base::Bind(&ExtensionCountCheck, GetProfile(0), 0u), | 103 base::Bind(&ExtensionCountCheck, GetProfile(0), 0u), |
| 104 "Waiting for profile to have no extensions"); | 104 "Waiting for profile to have no extensions"); |
| 105 checker.Wait(); | 105 checker.Wait(); |
| 106 EXPECT_TRUE(!checker.TimedOut()); | 106 EXPECT_TRUE(!checker.TimedOut()); |
| 107 EXPECT_TRUE(GetInstalledExtensions(GetProfile(0)).empty()); | 107 EXPECT_TRUE(GetInstalledExtensions(GetProfile(0)).empty()); |
| 108 } | 108 } |
| OLD | NEW |