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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc

Issue 1410013008: [Sync] Remove some http-related chrome deps from SyncBackendHostImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync/glue/sync_backend_host_impl.h" 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/test/test_timeouts.h" 14 #include "base/test/test_timeouts.h"
15 #include "base/time/time.h"
15 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" 17 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
18 #include "chrome/browser/sync/profile_sync_test_util.h"
17 #include "chrome/test/base/testing_browser_process.h" 19 #include "chrome/test/base/testing_browser_process.h"
18 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
19 #include "chrome/test/base/testing_profile_manager.h" 21 #include "chrome/test/base/testing_profile_manager.h"
20 #include "components/invalidation/impl/invalidator_storage.h" 22 #include "components/invalidation/impl/invalidator_storage.h"
21 #include "components/invalidation/impl/profile_invalidation_provider.h" 23 #include "components/invalidation/impl/profile_invalidation_provider.h"
22 #include "components/invalidation/public/invalidator_state.h" 24 #include "components/invalidation/public/invalidator_state.h"
23 #include "components/invalidation/public/object_id_invalidation_map.h" 25 #include "components/invalidation/public/object_id_invalidation_map.h"
24 #include "components/sync_driver/device_info.h" 26 #include "components/sync_driver/device_info.h"
25 #include "components/sync_driver/fake_sync_client.h" 27 #include "components/sync_driver/fake_sync_client.h"
26 #include "components/sync_driver/sync_frontend.h" 28 #include "components/sync_driver/sync_frontend.h"
27 #include "components/sync_driver/sync_prefs.h" 29 #include "components/sync_driver/sync_prefs.h"
28 #include "components/syncable_prefs/pref_service_syncable.h" 30 #include "components/syncable_prefs/pref_service_syncable.h"
29 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
30 #include "content/public/test/test_browser_thread_bundle.h" 32 #include "content/public/test/test_browser_thread_bundle.h"
31 #include "content/public/test/test_utils.h" 33 #include "content/public/test/test_utils.h"
32 #include "google/cacheinvalidation/include/types.h" 34 #include "google/cacheinvalidation/include/types.h"
33 #include "google_apis/gaia/gaia_constants.h" 35 #include "google_apis/gaia/gaia_constants.h"
34 #include "net/url_request/test_url_fetcher_factory.h" 36 #include "net/url_request/test_url_fetcher_factory.h"
37 #include "net/url_request/url_request_context_getter.h"
35 #include "sync/internal_api/public/base/model_type.h" 38 #include "sync/internal_api/public/base/model_type.h"
36 #include "sync/internal_api/public/engine/model_safe_worker.h" 39 #include "sync/internal_api/public/engine/model_safe_worker.h"
37 #include "sync/internal_api/public/engine/passive_model_worker.h" 40 #include "sync/internal_api/public/engine/passive_model_worker.h"
38 #include "sync/internal_api/public/http_bridge_network_resources.h" 41 #include "sync/internal_api/public/http_bridge_network_resources.h"
39 #include "sync/internal_api/public/network_resources.h" 42 #include "sync/internal_api/public/network_resources.h"
40 #include "sync/internal_api/public/sessions/commit_counters.h" 43 #include "sync/internal_api/public/sessions/commit_counters.h"
41 #include "sync/internal_api/public/sessions/status_counters.h" 44 #include "sync/internal_api/public/sessions/status_counters.h"
42 #include "sync/internal_api/public/sessions/update_counters.h" 45 #include "sync/internal_api/public/sessions/update_counters.h"
43 #include "sync/internal_api/public/sync_manager_factory.h" 46 #include "sync/internal_api/public/sync_manager_factory.h"
44 #include "sync/internal_api/public/test/fake_sync_manager.h" 47 #include "sync/internal_api/public/test/fake_sync_manager.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 base::RunLoop().RunUntilIdle(); 223 base::RunLoop().RunUntilIdle();
221 content::RunAllPendingInMessageLoop(BrowserThread::IO); 224 content::RunAllPendingInMessageLoop(BrowserThread::IO);
222 // Pump any messages posted by the IO thread. 225 // Pump any messages posted by the IO thread.
223 base::RunLoop().RunUntilIdle(); 226 base::RunLoop().RunUntilIdle();
224 } 227 }
225 228
226 // Synchronously initializes the backend. 229 // Synchronously initializes the backend.
227 void InitializeBackend(bool expect_success) { 230 void InitializeBackend(bool expect_success) {
228 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, _, expect_success)). 231 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, _, expect_success)).
229 WillOnce(InvokeWithoutArgs(QuitMessageLoop)); 232 WillOnce(InvokeWithoutArgs(QuitMessageLoop));
233 SyncBackendHost::HttpPostProviderFactoryGetter
234 http_post_provider_factory_getter =
235 base::Bind(&syncer::NetworkResources::GetHttpPostProviderFactory,
236 base::Unretained(network_resources_.get()),
237 make_scoped_refptr(profile_->GetRequestContext()),
238 base::Bind(&EmptyNetworkTimeUpdate));
230 backend_->Initialize( 239 backend_->Initialize(
231 &mock_frontend_, scoped_ptr<base::Thread>(), 240 &mock_frontend_, scoped_ptr<base::Thread>(),
232 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 241 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
233 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 242 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
234 syncer::WeakHandle<syncer::JsEventHandler>(), GURL(std::string()), 243 syncer::WeakHandle<syncer::JsEventHandler>(), GURL(std::string()),
235 std::string(), credentials_, true, fake_manager_factory_.Pass(), 244 std::string(), credentials_, true, fake_manager_factory_.Pass(),
236 MakeWeakHandle(test_unrecoverable_error_handler_.GetWeakPtr()), 245 MakeWeakHandle(test_unrecoverable_error_handler_.GetWeakPtr()),
237 base::Closure(), network_resources_.get(), saved_nigori_state_.Pass()); 246 base::Closure(), http_post_provider_factory_getter,
247 saved_nigori_state_.Pass());
238 base::RunLoop run_loop; 248 base::RunLoop run_loop;
239 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, 249 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE,
240 run_loop.QuitClosure(), 250 run_loop.QuitClosure(),
241 TestTimeouts::action_timeout()); 251 TestTimeouts::action_timeout());
242 run_loop.Run(); 252 run_loop.Run();
243 // |fake_manager_factory_|'s fake_manager() is set on the sync 253 // |fake_manager_factory_|'s fake_manager() is set on the sync
244 // thread, but we can rely on the message loop barriers to 254 // thread, but we can rely on the message loop barriers to
245 // guarantee that we see the updated value. 255 // guarantee that we see the updated value.
246 DCHECK(fake_manager_); 256 DCHECK(fake_manager_);
247 } 257 }
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 EXPECT_EQ(invalidation_versions.size(), 892 EXPECT_EQ(invalidation_versions.size(),
883 persisted_invalidation_versions.size()); 893 persisted_invalidation_versions.size());
884 for (auto iter : persisted_invalidation_versions) { 894 for (auto iter : persisted_invalidation_versions) {
885 EXPECT_EQ(invalidation_versions[iter.first], iter.second); 895 EXPECT_EQ(invalidation_versions[iter.first], iter.second);
886 } 896 }
887 } 897 }
888 898
889 } // namespace 899 } // namespace
890 900
891 } // namespace browser_sync 901 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_impl.cc ('k') | chrome/browser/sync/glue/sync_backend_host_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698