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

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

Issue 5537002: Fixed minor atomicity issue in PrefProxyConfigService::GetLatestProxyConfig. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed comment by Eric Created 10 years 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
« no previous file with comments | « chrome/browser/net/pref_proxy_config_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/testing_profile.h" 5 #include "chrome/test/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 22 matching lines...) Expand all
33 #include "chrome/browser/search_engines/template_url_fetcher.h" 33 #include "chrome/browser/search_engines/template_url_fetcher.h"
34 #include "chrome/browser/search_engines/template_url_model.h" 34 #include "chrome/browser/search_engines/template_url_model.h"
35 #include "chrome/browser/sessions/session_service.h" 35 #include "chrome/browser/sessions/session_service.h"
36 #include "chrome/browser/sync/profile_sync_service_mock.h" 36 #include "chrome/browser/sync/profile_sync_service_mock.h"
37 #include "chrome/browser/themes/browser_theme_provider.h" 37 #include "chrome/browser/themes/browser_theme_provider.h"
38 #include "chrome/common/chrome_constants.h" 38 #include "chrome/common/chrome_constants.h"
39 #include "chrome/common/net/url_request_context_getter.h" 39 #include "chrome/common/net/url_request_context_getter.h"
40 #include "chrome/common/notification_service.h" 40 #include "chrome/common/notification_service.h"
41 #include "chrome/common/url_constants.h" 41 #include "chrome/common/url_constants.h"
42 #include "chrome/test/testing_pref_service.h" 42 #include "chrome/test/testing_pref_service.h"
43 #include "chrome/test/test_url_request_context_getter.h"
43 #include "chrome/test/ui_test_utils.h" 44 #include "chrome/test/ui_test_utils.h"
44 #include "net/base/cookie_monster.h" 45 #include "net/base/cookie_monster.h"
45 #include "net/url_request/url_request_context.h" 46 #include "net/url_request/url_request_context.h"
46 #include "net/url_request/url_request_unittest.h" 47 #include "net/url_request/url_request_unittest.h"
47 #include "testing/gmock/include/gmock/gmock.h" 48 #include "testing/gmock/include/gmock/gmock.h"
48 #include "webkit/database/database_tracker.h" 49 #include "webkit/database/database_tracker.h"
49 50
50 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) 51 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
51 #include "chrome/browser/gtk/gtk_theme_provider.h" 52 #include "chrome/browser/gtk/gtk_theme_provider.h"
52 #endif 53 #endif
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const BookmarkNode* node) {} 106 const BookmarkNode* node) {}
106 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, 107 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
107 const BookmarkNode* node) {} 108 const BookmarkNode* node) {}
108 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, 109 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
109 const BookmarkNode* node) {} 110 const BookmarkNode* node) {}
110 111
111 private: 112 private:
112 DISALLOW_COPY_AND_ASSIGN(BookmarkLoadObserver); 113 DISALLOW_COPY_AND_ASSIGN(BookmarkLoadObserver);
113 }; 114 };
114 115
115 // Used to return a dummy context (normally the context is on the IO thread).
116 // The one here can be run on the main test thread. Note that this can lead to
117 // a leak if your test does not have a BrowserThread::IO in it because
118 // URLRequestContextGetter is defined as a ReferenceCounted object with a
119 // special trait that deletes it on the IO thread.
120 class TestURLRequestContextGetter : public URLRequestContextGetter {
121 public:
122 virtual URLRequestContext* GetURLRequestContext() {
123 if (!context_)
124 context_ = new TestURLRequestContext();
125 return context_.get();
126 }
127 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
128 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
129 }
130
131 private:
132 scoped_refptr<URLRequestContext> context_;
133 };
134
135 class TestExtensionURLRequestContext : public URLRequestContext { 116 class TestExtensionURLRequestContext : public URLRequestContext {
136 public: 117 public:
137 TestExtensionURLRequestContext() { 118 TestExtensionURLRequestContext() {
138 net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL); 119 net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL);
139 const char* schemes[] = {chrome::kExtensionScheme}; 120 const char* schemes[] = {chrome::kExtensionScheme};
140 cookie_monster->SetCookieableSchemes(schemes, 1); 121 cookie_monster->SetCookieableSchemes(schemes, 1);
141 cookie_store_ = cookie_monster; 122 cookie_store_ = cookie_monster;
142 } 123 }
143 }; 124 };
144 125
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 511 }
531 return profile_sync_service_.get(); 512 return profile_sync_service_.get();
532 } 513 }
533 514
534 void TestingProfile::DestroyWebDataService() { 515 void TestingProfile::DestroyWebDataService() {
535 if (!web_data_service_.get()) 516 if (!web_data_service_.get())
536 return; 517 return;
537 518
538 web_data_service_->Shutdown(); 519 web_data_service_->Shutdown();
539 } 520 }
OLDNEW
« no previous file with comments | « chrome/browser/net/pref_proxy_config_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698