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

Side by Side Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 442403003: Update SyncManager::Init to use a GURL for the sync server URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix sync_client.cc too. Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Unit tests for the SyncApi. Note that a lot of the underlying 5 // Unit tests for the SyncApi. Note that a lot of the underlying
6 // functionality is provided by the Syncable layer, which has its own 6 // functionality is provided by the Syncable layer, which has its own
7 // unit tests. We'll test SyncApi specific things in this harness. 7 // unit tests. We'll test SyncApi specific things in this harness.
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "sync/test/engine/fake_model_worker.h" 66 #include "sync/test/engine/fake_model_worker.h"
67 #include "sync/test/engine/fake_sync_scheduler.h" 67 #include "sync/test/engine/fake_sync_scheduler.h"
68 #include "sync/test/engine/test_id_factory.h" 68 #include "sync/test/engine/test_id_factory.h"
69 #include "sync/test/fake_encryptor.h" 69 #include "sync/test/fake_encryptor.h"
70 #include "sync/util/cryptographer.h" 70 #include "sync/util/cryptographer.h"
71 #include "sync/util/extensions_activity.h" 71 #include "sync/util/extensions_activity.h"
72 #include "sync/util/test_unrecoverable_error_handler.h" 72 #include "sync/util/test_unrecoverable_error_handler.h"
73 #include "sync/util/time.h" 73 #include "sync/util/time.h"
74 #include "testing/gmock/include/gmock/gmock.h" 74 #include "testing/gmock/include/gmock/gmock.h"
75 #include "testing/gtest/include/gtest/gtest.h" 75 #include "testing/gtest/include/gtest/gtest.h"
76 #include "url/gurl.h"
76 77
77 using base::ExpectDictStringValue; 78 using base::ExpectDictStringValue;
78 using testing::_; 79 using testing::_;
79 using testing::DoAll; 80 using testing::DoAll;
80 using testing::InSequence; 81 using testing::InSequence;
81 using testing::Return; 82 using testing::Return;
82 using testing::SaveArg; 83 using testing::SaveArg;
83 using testing::StrictMock; 84 using testing::StrictMock;
84 85
85 namespace syncer { 86 namespace syncer {
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 // This works only because all routing info types are GROUP_PASSIVE. 812 // This works only because all routing info types are GROUP_PASSIVE.
812 // If we had types in other groups, we would need additional workers 813 // If we had types in other groups, we would need additional workers
813 // to support them. 814 // to support them.
814 scoped_refptr<ModelSafeWorker> worker = new FakeModelWorker(GROUP_PASSIVE); 815 scoped_refptr<ModelSafeWorker> worker = new FakeModelWorker(GROUP_PASSIVE);
815 workers.push_back(worker); 816 workers.push_back(worker);
816 817
817 // Takes ownership of |fake_invalidator_|. 818 // Takes ownership of |fake_invalidator_|.
818 sync_manager_.Init( 819 sync_manager_.Init(
819 temp_dir_.path(), 820 temp_dir_.path(),
820 WeakHandle<JsEventHandler>(), 821 WeakHandle<JsEventHandler>(),
821 "bogus", 822 GURL("https://example.com/"),
822 0,
823 false,
824 scoped_ptr<HttpPostProviderFactory>(new TestHttpPostProviderFactory()), 823 scoped_ptr<HttpPostProviderFactory>(new TestHttpPostProviderFactory()),
825 workers, 824 workers,
826 extensions_activity_.get(), 825 extensions_activity_.get(),
827 this, 826 this,
828 credentials, 827 credentials,
829 "fake_invalidator_client_id", 828 "fake_invalidator_client_id",
830 std::string(), 829 std::string(),
831 std::string(), // bootstrap tokens 830 std::string(), // bootstrap tokens
832 scoped_ptr<InternalComponentsFactory>(GetFactory()).get(), 831 scoped_ptr<InternalComponentsFactory>(GetFactory()).get(),
833 &encryptor_, 832 &encryptor_,
834 scoped_ptr<UnrecoverableErrorHandler>( 833 scoped_ptr<UnrecoverableErrorHandler>(new TestUnrecoverableErrorHandler)
835 new TestUnrecoverableErrorHandler).Pass(), 834 .Pass(),
836 NULL, 835 NULL,
837 &cancelation_signal_); 836 &cancelation_signal_);
838 837
839 sync_manager_.GetEncryptionHandler()->AddObserver(&encryption_observer_); 838 sync_manager_.GetEncryptionHandler()->AddObserver(&encryption_observer_);
840 839
841 EXPECT_TRUE(js_backend_.IsInitialized()); 840 EXPECT_TRUE(js_backend_.IsInitialized());
842 841
843 if (initialization_succeeded_) { 842 if (initialization_succeeded_) {
844 for (ModelSafeRoutingInfo::iterator i = routing_info.begin(); 843 for (ModelSafeRoutingInfo::iterator i = routing_info.begin();
845 i != routing_info.end(); ++i) { 844 i != routing_info.end(); ++i) {
(...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3189 // SyncManagerInitInvalidStorageTest::GetFactory will return 3188 // SyncManagerInitInvalidStorageTest::GetFactory will return
3190 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. 3189 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails.
3191 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's 3190 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's
3192 // task is to ensure that SyncManagerImpl reported initialization failure in 3191 // task is to ensure that SyncManagerImpl reported initialization failure in
3193 // OnInitializationComplete callback. 3192 // OnInitializationComplete callback.
3194 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { 3193 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) {
3195 EXPECT_FALSE(initialization_succeeded_); 3194 EXPECT_FALSE(initialization_succeeded_);
3196 } 3195 }
3197 3196
3198 } // namespace syncer 3197 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698