| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 namespace content { | 39 namespace content { |
| 40 class BrowserContext; | 40 class BrowserContext; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace browser_sync { | 43 namespace browser_sync { |
| 44 | 44 |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 ACTION(ReturnNewDataTypeManager) { | 47 ACTION(ReturnNewDataTypeManager) { |
| 48 return new browser_sync::DataTypeManagerImpl(base::Closure(), | 48 return new sync_driver::DataTypeManagerImpl(base::Closure(), |
| 49 arg0, | 49 arg0, |
| 50 arg1, | 50 arg1, |
| 51 arg2, | 51 arg2, |
| 52 arg3, | 52 arg3, |
| 53 arg4, | 53 arg4, |
| 54 arg5); | 54 arg5); |
| 55 } | 55 } |
| 56 | 56 |
| 57 using testing::Return; | 57 using testing::Return; |
| 58 using testing::StrictMock; | 58 using testing::StrictMock; |
| 59 using testing::_; | 59 using testing::_; |
| 60 | 60 |
| 61 class TestProfileSyncServiceObserver : public ProfileSyncServiceObserver { | 61 class TestProfileSyncServiceObserver : public ProfileSyncServiceObserver { |
| 62 public: | 62 public: |
| 63 explicit TestProfileSyncServiceObserver(ProfileSyncService* service) | 63 explicit TestProfileSyncServiceObserver(ProfileSyncService* service) |
| 64 : service_(service), first_setup_in_progress_(false) {} | 64 : service_(service), first_setup_in_progress_(false) {} |
| 65 virtual void OnStateChanged() OVERRIDE { | 65 virtual void OnStateChanged() OVERRIDE { |
| 66 first_setup_in_progress_ = service_->FirstSetupInProgress(); | 66 first_setup_in_progress_ = service_->FirstSetupInProgress(); |
| 67 } | 67 } |
| 68 bool first_setup_in_progress() const { return first_setup_in_progress_; } | 68 bool first_setup_in_progress() const { return first_setup_in_progress_; } |
| 69 private: | 69 private: |
| 70 ProfileSyncService* service_; | 70 ProfileSyncService* service_; |
| 71 bool first_setup_in_progress_; | 71 bool first_setup_in_progress_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // A variant of the SyncBackendHostMock that won't automatically | 74 // A variant of the SyncBackendHostMock that won't automatically |
| 75 // call back when asked to initialized. Allows us to test things | 75 // call back when asked to initialized. Allows us to test things |
| 76 // that could happen while backend init is in progress. | 76 // that could happen while backend init is in progress. |
| 77 class SyncBackendHostNoReturn : public SyncBackendHostMock { | 77 class SyncBackendHostNoReturn : public SyncBackendHostMock { |
| 78 virtual void Initialize( | 78 virtual void Initialize( |
| 79 SyncFrontend* frontend, | 79 sync_driver::SyncFrontend* frontend, |
| 80 scoped_ptr<base::Thread> sync_thread, | 80 scoped_ptr<base::Thread> sync_thread, |
| 81 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 81 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
| 82 const GURL& service_url, | 82 const GURL& service_url, |
| 83 const syncer::SyncCredentials& credentials, | 83 const syncer::SyncCredentials& credentials, |
| 84 bool delete_sync_data_folder, | 84 bool delete_sync_data_folder, |
| 85 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 85 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 86 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, | 86 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, |
| 87 syncer::ReportUnrecoverableErrorFunction | 87 syncer::ReportUnrecoverableErrorFunction |
| 88 report_unrecoverable_error_function, | 88 report_unrecoverable_error_function, |
| 89 syncer::NetworkResources* network_resources) OVERRIDE {} | 89 syncer::NetworkResources* network_resources) OVERRIDE {} |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 class SyncBackendHostMockCollectDeleteDirParam : public SyncBackendHostMock { | 92 class SyncBackendHostMockCollectDeleteDirParam : public SyncBackendHostMock { |
| 93 public: | 93 public: |
| 94 explicit SyncBackendHostMockCollectDeleteDirParam( | 94 explicit SyncBackendHostMockCollectDeleteDirParam( |
| 95 std::vector<bool>* delete_dir_param) | 95 std::vector<bool>* delete_dir_param) |
| 96 : delete_dir_param_(delete_dir_param) {} | 96 : delete_dir_param_(delete_dir_param) {} |
| 97 | 97 |
| 98 virtual void Initialize( | 98 virtual void Initialize( |
| 99 SyncFrontend* frontend, | 99 sync_driver::SyncFrontend* frontend, |
| 100 scoped_ptr<base::Thread> sync_thread, | 100 scoped_ptr<base::Thread> sync_thread, |
| 101 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 101 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
| 102 const GURL& service_url, | 102 const GURL& service_url, |
| 103 const syncer::SyncCredentials& credentials, | 103 const syncer::SyncCredentials& credentials, |
| 104 bool delete_sync_data_folder, | 104 bool delete_sync_data_folder, |
| 105 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 105 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 106 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, | 106 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, |
| 107 syncer::ReportUnrecoverableErrorFunction | 107 syncer::ReportUnrecoverableErrorFunction |
| 108 report_unrecoverable_error_function, | 108 report_unrecoverable_error_function, |
| 109 syncer::NetworkResources* network_resources) OVERRIDE { | 109 syncer::NetworkResources* network_resources) OVERRIDE { |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 // See that we can override the URL with a flag. | 615 // See that we can override the URL with a flag. |
| 616 CommandLine command_line( | 616 CommandLine command_line( |
| 617 base::FilePath(base::FilePath(FILE_PATH_LITERAL("chrome.exe")))); | 617 base::FilePath(base::FilePath(FILE_PATH_LITERAL("chrome.exe")))); |
| 618 command_line.AppendSwitchASCII(switches::kSyncServiceURL, "https://foo/bar"); | 618 command_line.AppendSwitchASCII(switches::kSyncServiceURL, "https://foo/bar"); |
| 619 EXPECT_EQ("https://foo/bar", | 619 EXPECT_EQ("https://foo/bar", |
| 620 ProfileSyncService::GetSyncServiceURL(command_line).spec()); | 620 ProfileSyncService::GetSyncServiceURL(command_line).spec()); |
| 621 } | 621 } |
| 622 | 622 |
| 623 } // namespace | 623 } // namespace |
| 624 } // namespace browser_sync | 624 } // namespace browser_sync |
| OLD | NEW |