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

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: More fixes 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 } 709 }
711 710
712 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { 711 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
713 return true; 712 return true;
714 } 713 }
715 714
716 base::Callback<ChromeURLDataManagerBackend*(void)> 715 base::Callback<ChromeURLDataManagerBackend*(void)>
717 TestingProfile::GetChromeURLDataManagerBackendGetter() const { 716 TestingProfile::GetChromeURLDataManagerBackendGetter() const {
718 return base::Callback<ChromeURLDataManagerBackend*(void)>(); 717 return base::Callback<ChromeURLDataManagerBackend*(void)>();
719 } 718 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698