Sync: store FakeServer as WeakPtr
[chromium-blink-merge.git] / sync / test / fake_server / fake_server_network_resources.cc
blobb6b573db3c494df95e9b6a9a9d16cb1b9e427e47
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "sync/test/fake_server/fake_server_network_resources.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop/message_loop.h"
10 #include "sync/internal_api/public/base/cancelation_signal.h"
11 #include "sync/internal_api/public/http_post_provider_factory.h"
12 #include "sync/internal_api/public/network_time_update_callback.h"
13 #include "sync/test/fake_server/fake_server.h"
14 #include "sync/test/fake_server/fake_server_http_post_provider.h"
16 using syncer::CancelationSignal;
17 using syncer::HttpPostProviderFactory;
18 using syncer::NetworkTimeUpdateCallback;
20 namespace fake_server {
22 FakeServerNetworkResources::FakeServerNetworkResources(
23 const base::WeakPtr<FakeServer>& fake_server)
24 : fake_server_(fake_server) { }
26 FakeServerNetworkResources::~FakeServerNetworkResources() {}
28 scoped_ptr<syncer::HttpPostProviderFactory>
29 FakeServerNetworkResources::GetHttpPostProviderFactory(
30 const scoped_refptr<net::URLRequestContextGetter>& baseline_context_getter,
31 const NetworkTimeUpdateCallback& network_time_update_callback,
32 CancelationSignal* cancelation_signal) {
33 return make_scoped_ptr<syncer::HttpPostProviderFactory>(
34 new FakeServerHttpPostProviderFactory(
35 fake_server_,
36 base::MessageLoop::current()->task_runner()));
39 } // namespace fake_server