| Index: chrome/browser/sync/test_profile_sync_service.h
 | 
| ===================================================================
 | 
| --- chrome/browser/sync/test_profile_sync_service.h	(revision 71392)
 | 
| +++ chrome/browser/sync/test_profile_sync_service.h	(working copy)
 | 
| @@ -20,9 +20,11 @@
 | 
|  #include "chrome/browser/sync/syncable/syncable.h"
 | 
|  #include "chrome/test/profile_mock.h"
 | 
|  #include "chrome/test/sync/test_http_bridge_factory.h"
 | 
| +#include "chrome/test/sync/engine/test_id_factory.h"
 | 
|  #include "testing/gmock/include/gmock/gmock.h"
 | 
|  
 | 
|  class Profile;
 | 
| +class TestProfileSyncService;
 | 
|  
 | 
|  using browser_sync::ModelSafeRoutingInfo;
 | 
|  using browser_sync::sessions::ErrorCounters;
 | 
| @@ -60,7 +62,8 @@
 | 
|    //     this is false, configuring data types will require a syncer nudge.
 | 
|    // |synchronous_init| causes initialization to block until the syncapi has
 | 
|    //     completed setting itself up and called us back.
 | 
| -  SyncBackendHostForProfileSyncTest(SyncFrontend* frontend,
 | 
| +  SyncBackendHostForProfileSyncTest(
 | 
| +      TestProfileSyncService* service,
 | 
|        Profile* profile,
 | 
|        const FilePath& profile_path,
 | 
|        const DataTypeController::TypeMap& data_type_controllers,
 | 
| @@ -68,30 +71,8 @@
 | 
|        int num_expected_resumes,
 | 
|        int num_expected_pauses,
 | 
|        bool set_initial_sync_ended_on_init,
 | 
| -      bool synchronous_init)
 | 
| -      : browser_sync::SyncBackendHost(frontend, profile, profile_path,
 | 
| -                                      data_type_controllers),
 | 
| -        initial_condition_setup_task_(initial_condition_setup_task),
 | 
| -        set_initial_sync_ended_on_init_(set_initial_sync_ended_on_init),
 | 
| -        synchronous_init_(synchronous_init) {
 | 
| -    // By default, the RequestPause and RequestResume methods will
 | 
| -    // send the confirmation notification and return true.
 | 
| -    ON_CALL(*this, RequestPause()).
 | 
| -        WillByDefault(testing::DoAll(CallOnPaused(core_),
 | 
| -                                     testing::Return(true)));
 | 
| -    ON_CALL(*this, RequestResume()).
 | 
| -        WillByDefault(testing::DoAll(CallOnResumed(core_),
 | 
| -                                     testing::Return(true)));
 | 
| -    ON_CALL(*this, RequestNudge()).WillByDefault(testing::Invoke(this,
 | 
| -         &SyncBackendHostForProfileSyncTest::
 | 
| -             SimulateSyncCycleCompletedInitialSyncEnded));
 | 
| +      bool synchronous_init);
 | 
|  
 | 
| -    EXPECT_CALL(*this, RequestPause()).Times(num_expected_pauses);
 | 
| -    EXPECT_CALL(*this, RequestResume()).Times(num_expected_resumes);
 | 
| -    EXPECT_CALL(*this, RequestNudge()).
 | 
| -        Times(set_initial_sync_ended_on_init ? 0 : 1);
 | 
| -  }
 | 
| -
 | 
|    MOCK_METHOD0(RequestPause, bool());
 | 
|    MOCK_METHOD0(RequestResume, bool());
 | 
|    MOCK_METHOD0(RequestNudge, void());
 | 
| @@ -118,22 +99,6 @@
 | 
|      SyncBackendHost::ConfigureDataTypes(types, ready_task);
 | 
|    }
 | 
|  
 | 
| -  virtual void HandleInitializationCompletedOnFrontendLoop() {
 | 
| -    set_syncapi_initialized();  // Need to do this asap so task below works.
 | 
| -
 | 
| -    // Set up any nodes the test wants around before model association.
 | 
| -    if (initial_condition_setup_task_) {
 | 
| -      initial_condition_setup_task_->Run();
 | 
| -    }
 | 
| -
 | 
| -    // Pretend we downloaded initial updates and set initial sync ended bits
 | 
| -    // if we were asked to.
 | 
| -    if (set_initial_sync_ended_on_init_)
 | 
| -      SetInitialSyncEndedForEnabledTypes();
 | 
| -
 | 
| -    SyncBackendHost::HandleInitializationCompletedOnFrontendLoop();
 | 
| -  }
 | 
| -
 | 
|    // Called when a nudge comes in.
 | 
|    void SimulateSyncCycleCompletedInitialSyncEnded() {
 | 
|      syncable::ModelTypeBitSet sync_ended;
 | 
| @@ -149,6 +114,8 @@
 | 
|          sync_ended, download_progress_markers, false, false, 0, 0, false));
 | 
|    }
 | 
|  
 | 
| +  virtual void HandleInitializationCompletedOnFrontendLoop();
 | 
| +
 | 
|    virtual sync_api::HttpPostProviderFactory* MakeHttpBridgeFactory(
 | 
|        URLRequestContextGetter* getter) {
 | 
|      return new browser_sync::TestHttpBridgeFactory;
 | 
| @@ -185,6 +152,7 @@
 | 
|    Task* initial_condition_setup_task_;
 | 
|    bool set_initial_sync_ended_on_init_;
 | 
|    bool synchronous_init_;
 | 
| +  TestProfileSyncService* test_service_;
 | 
|  };
 | 
|  
 | 
|  }  // namespace browser_sync
 | 
| @@ -252,6 +220,8 @@
 | 
|      synchronous_sync_configuration_ = true;
 | 
|    }
 | 
|  
 | 
| +  browser_sync::TestIdFactory* id_factory() { return &id_factory_; }
 | 
| +
 | 
|   private:
 | 
|    // When testing under ChromiumOS, this method must not return an empty
 | 
|    // value value in order for the profile sync service to start.
 | 
| @@ -270,6 +240,9 @@
 | 
|  
 | 
|    scoped_ptr<Task> initial_condition_setup_task_;
 | 
|    bool set_initial_sync_ended_on_init_;
 | 
| +  browser_sync::TestIdFactory id_factory_;
 | 
|  };
 | 
|  
 | 
| +
 | 
| +
 | 
|  #endif  // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_
 | 
| 
 |