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

Side by Side Diff: chrome/test/base/testing_profile.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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 (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 "chrome/test/base/testing_profile.h" 5 #include "chrome/test/base/testing_profile.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 class TestExtensionURLRequestContext : public net::URLRequestContext { 93 class TestExtensionURLRequestContext : public net::URLRequestContext {
94 public: 94 public:
95 TestExtensionURLRequestContext() { 95 TestExtensionURLRequestContext() {
96 net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL); 96 net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL);
97 const char* schemes[] = {chrome::kExtensionScheme}; 97 const char* schemes[] = {chrome::kExtensionScheme};
98 cookie_monster->SetCookieableSchemes(schemes, 1); 98 cookie_monster->SetCookieableSchemes(schemes, 1);
99 set_cookie_store(cookie_monster); 99 set_cookie_store(cookie_monster);
100 } 100 }
101 101
102 private:
103 virtual ~TestExtensionURLRequestContext() {} 102 virtual ~TestExtensionURLRequestContext() {}
104 }; 103 };
105 104
106 class TestExtensionURLRequestContextGetter 105 class TestExtensionURLRequestContextGetter
107 : public net::URLRequestContextGetter { 106 : public net::URLRequestContextGetter {
108 public: 107 public:
109 virtual net::URLRequestContext* GetURLRequestContext() { 108 virtual net::URLRequestContext* GetURLRequestContext() {
110 if (!context_) 109 if (!context_.get())
111 context_ = new TestExtensionURLRequestContext(); 110 context_.reset(new TestExtensionURLRequestContext());
112 return context_.get(); 111 return context_.get();
113 } 112 }
114 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { 113 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
115 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 114 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
116 } 115 }
117 116
118 protected: 117 protected:
119 virtual ~TestExtensionURLRequestContextGetter() {} 118 virtual ~TestExtensionURLRequestContextGetter() {}
120 119
121 private: 120 private:
122 scoped_refptr<net::URLRequestContext> context_; 121 scoped_ptr<net::URLRequestContext> context_;
123 }; 122 };
124 123
125 ProfileKeyedService* CreateTestDesktopNotificationService(Profile* profile) { 124 ProfileKeyedService* CreateTestDesktopNotificationService(Profile* profile) {
126 return new DesktopNotificationService(profile, NULL); 125 return new DesktopNotificationService(profile, NULL);
127 } 126 }
128 127
129 } // namespace 128 } // namespace
130 129
131 TestingProfile::TestingProfile() 130 TestingProfile::TestingProfile()
132 : start_time_(Time::Now()), 131 : start_time_(Time::Now()),
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 } 712 }
714 713
715 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { 714 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
716 return true; 715 return true;
717 } 716 }
718 717
719 base::Callback<ChromeURLDataManagerBackend*(void)> 718 base::Callback<ChromeURLDataManagerBackend*(void)>
720 TestingProfile::GetChromeURLDataManagerBackendGetter() const { 719 TestingProfile::GetChromeURLDataManagerBackendGetter() const {
721 return base::Callback<ChromeURLDataManagerBackend*(void)>(); 720 return base::Callback<ChromeURLDataManagerBackend*(void)>();
722 } 721 }
OLDNEW
« no previous file with comments | « chrome/service/net/service_url_request_context.cc ('k') | content/browser/browser_process_sub_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698