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

Unified Diff: trunk/src/chrome/browser/sync/profile_sync_service_harness.cc

Issue 17610004: Revert 208315 "Make use of InvalidationService" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/sync/profile_sync_service_harness.cc
===================================================================
--- trunk/src/chrome/browser/sync/profile_sync_service_harness.cc (revision 208346)
+++ trunk/src/chrome/browser/sync/profile_sync_service_harness.cc (working copy)
@@ -21,7 +21,6 @@
#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
#include "base/prefs/pref_service.h"
-#include "chrome/browser/invalidation/p2p_invalidation_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager_base.h"
#include "chrome/browser/signin/token_service.h"
@@ -39,7 +38,6 @@
#include "sync/internal_api/public/util/sync_string_conversions.h"
using syncer::sessions::SyncSessionSnapshot;
-using invalidation::P2PInvalidationService;
// TODO(rsimha): Remove the following lines once crbug.com/91863 is fixed.
// The amount of time for which we wait for a live sync operation to complete.
@@ -108,36 +106,14 @@
return !did_timeout_;
}
-// static
-ProfileSyncServiceHarness* ProfileSyncServiceHarness::Create(
- Profile* profile,
- const std::string& username,
- const std::string& password) {
- return new ProfileSyncServiceHarness(profile, username, password, NULL);
-}
-
-// static
-ProfileSyncServiceHarness* ProfileSyncServiceHarness::CreateForIntegrationTest(
- Profile* profile,
- const std::string& username,
- const std::string& password,
- P2PInvalidationService* p2p_invalidation_service) {
- return new ProfileSyncServiceHarness(profile,
- username,
- password,
- p2p_invalidation_service);
-}
-
ProfileSyncServiceHarness::ProfileSyncServiceHarness(
Profile* profile,
const std::string& username,
- const std::string& password,
- P2PInvalidationService* p2p_invalidation_service)
+ const std::string& password)
: waiting_for_encryption_type_(syncer::UNSPECIFIED),
wait_state_(INITIAL_WAIT_STATE),
profile_(profile),
service_(NULL),
- p2p_invalidation_service_(p2p_invalidation_service),
progress_marker_partner_(NULL),
username_(username),
password_(password),
@@ -157,6 +133,17 @@
service_->RemoveObserver(this);
}
+// static
+ProfileSyncServiceHarness* ProfileSyncServiceHarness::CreateAndAttach(
+ Profile* profile) {
+ ProfileSyncServiceFactory* f = ProfileSyncServiceFactory::GetInstance();
+ if (!f->HasProfileSyncService(profile)) {
+ NOTREACHED() << "Profile has never signed into sync.";
+ return NULL;
+ }
+ return new ProfileSyncServiceHarness(profile, std::string(), std::string());
+}
+
void ProfileSyncServiceHarness::SetCredentials(const std::string& username,
const std::string& password) {
username_ = username;
@@ -495,21 +482,6 @@
RunStateChangeMachine();
}
-void ProfileSyncServiceHarness::OnSyncCycleCompleted() {
- // Integration tests still use p2p notifications.
- const SyncSessionSnapshot& snap = GetLastSessionSnapshot();
- bool is_notifiable_commit =
- (snap.model_neutral_state().num_successful_commits > 0);
- if (is_notifiable_commit && p2p_invalidation_service_) {
- const syncer::ObjectIdInvalidationMap& invalidation_map =
- ModelTypeInvalidationMapToObjectIdInvalidationMap(
- snap.source().types);
- p2p_invalidation_service_->SendInvalidation(invalidation_map);
- }
-
- OnStateChanged();
-}
-
void ProfileSyncServiceHarness::OnMigrationStateChange() {
// Update migration state.
if (HasPendingBackendMigration()) {

Powered by Google App Engine
This is Rietveld 408576698