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

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

Issue 9004019: Cleanup: Removing FileSystemPathManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "content/browser/mock_resource_context.h" 52 #include "content/browser/mock_resource_context.h"
53 #include "content/public/browser/browser_thread.h" 53 #include "content/public/browser/browser_thread.h"
54 #include "content/public/browser/notification_service.h" 54 #include "content/public/browser/notification_service.h"
55 #include "net/base/cookie_monster.h" 55 #include "net/base/cookie_monster.h"
56 #include "net/url_request/url_request_context.h" 56 #include "net/url_request/url_request_context.h"
57 #include "net/url_request/url_request_context_getter.h" 57 #include "net/url_request/url_request_context_getter.h"
58 #include "net/url_request/url_request_test_util.h" 58 #include "net/url_request/url_request_test_util.h"
59 #include "testing/gmock/include/gmock/gmock.h" 59 #include "testing/gmock/include/gmock/gmock.h"
60 #include "webkit/database/database_tracker.h" 60 #include "webkit/database/database_tracker.h"
61 #include "webkit/fileapi/file_system_context.h" 61 #include "webkit/fileapi/file_system_context.h"
62 #include "webkit/fileapi/file_system_options.h"
62 #include "webkit/quota/mock_quota_manager.h" 63 #include "webkit/quota/mock_quota_manager.h"
63 #include "webkit/quota/quota_manager.h" 64 #include "webkit/quota/quota_manager.h"
64 65
65 #if defined(OS_CHROMEOS) 66 #if defined(OS_CHROMEOS)
66 #include "chrome/browser/chromeos/proxy_config_service_impl.h" 67 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
67 #endif // defined(OS_CHROMEOS) 68 #endif // defined(OS_CHROMEOS)
68 69
69 using base::Time; 70 using base::Time;
70 using content::BrowserThread; 71 using content::BrowserThread;
71 using testing::NiceMock; 72 using testing::NiceMock;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 119 }
119 120
120 private: 121 private:
121 scoped_refptr<net::URLRequestContext> context_; 122 scoped_refptr<net::URLRequestContext> context_;
122 }; 123 };
123 124
124 ProfileKeyedService* CreateTestDesktopNotificationService(Profile* profile) { 125 ProfileKeyedService* CreateTestDesktopNotificationService(Profile* profile) {
125 return new DesktopNotificationService(profile, NULL); 126 return new DesktopNotificationService(profile, NULL);
126 } 127 }
127 128
129 class TestingFileSystemOptions : public fileapi::FileSystemOptions {
130 public:
131 explicit TestingFileSystemOptions(bool is_incognito)
132 : is_incognito_(is_incognito) {}
133 virtual bool is_incognito() const OVERRIDE { return is_incognito_; }
134 virtual bool allow_file_access_from_files() const OVERRIDE { return true; }
135 private:
136 bool is_incognito_;
137 };
138
128 } // namespace 139 } // namespace
129 140
130 TestingProfile::TestingProfile() 141 TestingProfile::TestingProfile()
131 : start_time_(Time::Now()), 142 : start_time_(Time::Now()),
132 testing_prefs_(NULL), 143 testing_prefs_(NULL),
133 incognito_(false), 144 incognito_(false),
134 last_session_exited_cleanly_(true), 145 last_session_exited_cleanly_(true),
135 profile_dependency_manager_(ProfileDependencyManager::GetInstance()), 146 profile_dependency_manager_(ProfileDependencyManager::GetInstance()),
136 delegate_(NULL) { 147 delegate_(NULL) {
137 if (!temp_dir_.CreateUniqueTempDir()) { 148 if (!temp_dir_.CreateUniqueTempDir()) {
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 613 }
603 614
604 fileapi::FileSystemContext* TestingProfile::GetFileSystemContext() { 615 fileapi::FileSystemContext* TestingProfile::GetFileSystemContext() {
605 if (!file_system_context_) { 616 if (!file_system_context_) {
606 file_system_context_ = new fileapi::FileSystemContext( 617 file_system_context_ = new fileapi::FileSystemContext(
607 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 618 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
608 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 619 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
609 GetExtensionSpecialStoragePolicy(), 620 GetExtensionSpecialStoragePolicy(),
610 NULL, 621 NULL,
611 GetPath(), 622 GetPath(),
612 IsOffTheRecord(), 623 new TestingFileSystemOptions(IsOffTheRecord()));
613 true, // Allow file access from files.
614 NULL);
615 } 624 }
616 return file_system_context_.get(); 625 return file_system_context_.get();
617 } 626 }
618 627
619 void TestingProfile::SetQuotaManager(quota::QuotaManager* manager) { 628 void TestingProfile::SetQuotaManager(quota::QuotaManager* manager) {
620 quota_manager_ = manager; 629 quota_manager_ = manager;
621 } 630 }
622 631
623 quota::QuotaManager* TestingProfile::GetQuotaManager() { 632 quota::QuotaManager* TestingProfile::GetQuotaManager() {
624 return quota_manager_.get(); 633 return quota_manager_.get();
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { 861 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() {
853 return GetExtensionSpecialStoragePolicy(); 862 return GetExtensionSpecialStoragePolicy();
854 } 863 }
855 864
856 void TestingProfile::DestroyWebDataService() { 865 void TestingProfile::DestroyWebDataService() {
857 if (!web_data_service_.get()) 866 if (!web_data_service_.get())
858 return; 867 return;
859 868
860 web_data_service_->Shutdown(); 869 web_data_service_->Shutdown();
861 } 870 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698