summaryrefslogtreecommitdiffstats
path: root/content/browser/mock_resource_context.cc
blob: 170b4e697b2a4848af571864d533eaea46c7e22e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/mock_resource_context.h"

#include "base/lazy_instance.h"
#include "net/url_request/url_request_test_util.h"

namespace content {

static base::LazyInstance<MockResourceContext>
    g_mock_resource_context = LAZY_INSTANCE_INITIALIZER;

MockResourceContext* MockResourceContext::GetInstance() {
  return &g_mock_resource_context.Get();
}

MockResourceContext::MockResourceContext()
    : test_request_context_(new TestURLRequestContext),
      media_observer_(NULL),
      media_stream_manager_(NULL),
      audio_manager_(NULL) {
}

MockResourceContext::MockResourceContext(net::URLRequestContext* context)
    : test_request_context_(context),
      media_observer_(NULL),
      media_stream_manager_(NULL),
      audio_manager_(NULL) {
}

MockResourceContext::~MockResourceContext() {}

net::HostResolver* MockResourceContext::GetHostResolver()  {
  return NULL;
}

net::URLRequestContext* MockResourceContext::GetRequestContext()  {
  return test_request_context_;
}

HostZoomMap* MockResourceContext::GetHostZoomMap()  {
  return NULL;
}

MediaObserver* MockResourceContext::GetMediaObserver()  {
  return media_observer_;
}

media_stream::MediaStreamManager*
    MockResourceContext::GetMediaStreamManager() {
  return media_stream_manager_;
}

AudioManager* MockResourceContext::GetAudioManager() {
  return audio_manager_;
}

}  // namespace content