Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: chrome/browser/sync/test/integration/single_client_extensions_sync_test.cc

Issue 2969643002: Reland - Replace FakeServer's implementation with LoopbackServer invocations. (Closed)
Patch Set: Rebased on master. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_test.h" 8 #include "chrome/browser/sync/test/integration/sync_test.h"
9 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h " 9 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h "
10 #include "components/browser_sync/profile_sync_service.h" 10 #include "components/browser_sync/profile_sync_service.h"
11 #include "components/sync/test/fake_server/tombstone_entity.h" 11 #include "components/sync/test/fake_server/fake_server.h"
12 12
13 using extensions_helper::AllProfilesHaveSameExtensionsAsVerifier; 13 using extensions_helper::AllProfilesHaveSameExtensionsAsVerifier;
14 using extensions_helper::DisableExtension; 14 using extensions_helper::DisableExtension;
15 using extensions_helper::GetInstalledExtensions; 15 using extensions_helper::GetInstalledExtensions;
16 using extensions_helper::InstallExtension; 16 using extensions_helper::InstallExtension;
17 using extensions_helper::InstallExtensionForAllProfiles; 17 using extensions_helper::InstallExtensionForAllProfiles;
18 18
19 class SingleClientExtensionsSyncTest : public SyncTest { 19 class SingleClientExtensionsSyncTest : public SyncTest {
20 public: 20 public:
21 SingleClientExtensionsSyncTest() : SyncTest(SINGLE_CLIENT) {} 21 SingleClientExtensionsSyncTest() : SyncTest(SINGLE_CLIENT) {}
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Start with an extension installed, and setup sync. 72 // Start with an extension installed, and setup sync.
73 InstallExtensionForAllProfiles(0); 73 InstallExtensionForAllProfiles(0);
74 ASSERT_TRUE(SetupSync()); 74 ASSERT_TRUE(SetupSync());
75 EXPECT_TRUE(AllProfilesHaveSameExtensionsAsVerifier()); 75 EXPECT_TRUE(AllProfilesHaveSameExtensionsAsVerifier());
76 76
77 // Simulate a delete at the server. 77 // Simulate a delete at the server.
78 std::vector<sync_pb::SyncEntity> server_extensions = 78 std::vector<sync_pb::SyncEntity> server_extensions =
79 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS); 79 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS);
80 ASSERT_EQ(1ul, server_extensions.size()); 80 ASSERT_EQ(1ul, server_extensions.size());
81 std::unique_ptr<fake_server::FakeServerEntity> tombstone( 81 std::unique_ptr<syncer::LoopbackServerEntity> tombstone(
82 fake_server::TombstoneEntity::Create( 82 syncer::PersistentTombstoneEntity::CreateNew(
83 server_extensions[0].id_string(), 83 server_extensions[0].id_string(),
84 server_extensions[0].client_defined_unique_tag())); 84 server_extensions[0].client_defined_unique_tag()));
85 GetFakeServer()->InjectEntity(std::move(tombstone)); 85 GetFakeServer()->InjectEntity(std::move(tombstone));
86 86
87 // Modify the extension in the local profile to cause a conflict. 87 // Modify the extension in the local profile to cause a conflict.
88 DisableExtension(GetProfile(0), 0); 88 DisableExtension(GetProfile(0), 0);
89 EXPECT_EQ(1u, GetInstalledExtensions(GetProfile(0)).size()); 89 EXPECT_EQ(1u, GetInstalledExtensions(GetProfile(0)).size());
90 90
91 // Trigger sync, and expect the extension to remain uninstalled at the server 91 // Trigger sync, and expect the extension to remain uninstalled at the server
92 // and get uninstalled locally. 92 // and get uninstalled locally.
93 const syncer::ModelTypeSet kExtensionsType(syncer::EXTENSIONS); 93 const syncer::ModelTypeSet kExtensionsType(syncer::EXTENSIONS);
94 TriggerSyncForModelTypes(0, kExtensionsType); 94 TriggerSyncForModelTypes(0, kExtensionsType);
95 server_extensions = 95 server_extensions =
96 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS); 96 GetFakeServer()->GetSyncEntitiesByModelType(syncer::EXTENSIONS);
97 EXPECT_EQ(0ul, server_extensions.size()); 97 EXPECT_EQ(0ul, server_extensions.size());
98 98
99 AwaitMatchStatusChangeChecker checker( 99 AwaitMatchStatusChangeChecker checker(
100 base::Bind(&ExtensionCountCheck, GetProfile(0), 0u), 100 base::Bind(&ExtensionCountCheck, GetProfile(0), 0u),
101 "Waiting for profile to have no extensions"); 101 "Waiting for profile to have no extensions");
102 EXPECT_TRUE(checker.Wait()); 102 EXPECT_TRUE(checker.Wait());
103 EXPECT_TRUE(GetInstalledExtensions(GetProfile(0)).empty()); 103 EXPECT_TRUE(GetInstalledExtensions(GetProfile(0)).empty());
104 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698