| OLD | NEW |
| 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 Loading... |
| 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 content::DownloadManager; | 72 using content::DownloadManager; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 120 } |
| 120 | 121 |
| 121 private: | 122 private: |
| 122 scoped_refptr<net::URLRequestContext> context_; | 123 scoped_refptr<net::URLRequestContext> context_; |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 ProfileKeyedService* CreateTestDesktopNotificationService(Profile* profile) { | 126 ProfileKeyedService* CreateTestDesktopNotificationService(Profile* profile) { |
| 126 return new DesktopNotificationService(profile, NULL); | 127 return new DesktopNotificationService(profile, NULL); |
| 127 } | 128 } |
| 128 | 129 |
| 130 fileapi::FileSystemOptions CreateTestingFileSystemOptions(bool is_incognito) { |
| 131 return fileapi::FileSystemOptions( |
| 132 is_incognito |
| 133 ? fileapi::FileSystemOptions::PROFILE_MODE_INCOGNITO |
| 134 : fileapi::FileSystemOptions::PROFILE_MODE_NORMAL, |
| 135 std::vector<std::string>()); |
| 136 } |
| 137 |
| 129 } // namespace | 138 } // namespace |
| 130 | 139 |
| 131 TestingProfile::TestingProfile() | 140 TestingProfile::TestingProfile() |
| 132 : start_time_(Time::Now()), | 141 : start_time_(Time::Now()), |
| 133 testing_prefs_(NULL), | 142 testing_prefs_(NULL), |
| 134 incognito_(false), | 143 incognito_(false), |
| 135 last_session_exited_cleanly_(true), | 144 last_session_exited_cleanly_(true), |
| 136 profile_dependency_manager_(ProfileDependencyManager::GetInstance()), | 145 profile_dependency_manager_(ProfileDependencyManager::GetInstance()), |
| 137 delegate_(NULL) { | 146 delegate_(NULL) { |
| 138 if (!temp_dir_.CreateUniqueTempDir()) { | 147 if (!temp_dir_.CreateUniqueTempDir()) { |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } | 612 } |
| 604 | 613 |
| 605 fileapi::FileSystemContext* TestingProfile::GetFileSystemContext() { | 614 fileapi::FileSystemContext* TestingProfile::GetFileSystemContext() { |
| 606 if (!file_system_context_) { | 615 if (!file_system_context_) { |
| 607 file_system_context_ = new fileapi::FileSystemContext( | 616 file_system_context_ = new fileapi::FileSystemContext( |
| 608 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 617 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
| 609 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 618 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 610 GetExtensionSpecialStoragePolicy(), | 619 GetExtensionSpecialStoragePolicy(), |
| 611 NULL, | 620 NULL, |
| 612 GetPath(), | 621 GetPath(), |
| 613 IsOffTheRecord(), | 622 CreateTestingFileSystemOptions(IsOffTheRecord())); |
| 614 true, // Allow file access from files. | |
| 615 NULL); | |
| 616 } | 623 } |
| 617 return file_system_context_.get(); | 624 return file_system_context_.get(); |
| 618 } | 625 } |
| 619 | 626 |
| 620 void TestingProfile::SetQuotaManager(quota::QuotaManager* manager) { | 627 void TestingProfile::SetQuotaManager(quota::QuotaManager* manager) { |
| 621 quota_manager_ = manager; | 628 quota_manager_ = manager; |
| 622 } | 629 } |
| 623 | 630 |
| 624 quota::QuotaManager* TestingProfile::GetQuotaManager() { | 631 quota::QuotaManager* TestingProfile::GetQuotaManager() { |
| 625 return quota_manager_.get(); | 632 return quota_manager_.get(); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { | 855 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { |
| 849 return GetExtensionSpecialStoragePolicy(); | 856 return GetExtensionSpecialStoragePolicy(); |
| 850 } | 857 } |
| 851 | 858 |
| 852 void TestingProfile::DestroyWebDataService() { | 859 void TestingProfile::DestroyWebDataService() { |
| 853 if (!web_data_service_.get()) | 860 if (!web_data_service_.get()) |
| 854 return; | 861 return; |
| 855 | 862 |
| 856 web_data_service_->Shutdown(); | 863 web_data_service_->Shutdown(); |
| 857 } | 864 } |
| OLD | NEW |