OLD | NEW |
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 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_ | 5 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_ |
6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ | 6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "components/domain_reliability/clear_mode.h" | 14 #include "components/domain_reliability/clear_mode.h" |
15 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 15 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class MockResourceContext; | 18 class MockResourceContext; |
19 } | 19 } |
20 | 20 |
21 namespace extensions { | |
22 class ExtensionPrefs; | |
23 } | |
24 | |
25 namespace history { | 21 namespace history { |
26 class TopSites; | 22 class TopSites; |
27 } | 23 } |
28 | 24 |
29 namespace net { | 25 namespace net { |
30 class CookieMonster; | 26 class CookieMonster; |
31 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
32 } | 28 } |
33 | 29 |
34 namespace policy { | 30 namespace policy { |
35 class PolicyService; | 31 class PolicyService; |
36 class ProfilePolicyConnector; | 32 class ProfilePolicyConnector; |
37 class SchemaRegistryService; | 33 class SchemaRegistryService; |
38 } | 34 } |
39 | 35 |
40 namespace quota { | 36 namespace quota { |
41 class SpecialStoragePolicy; | 37 class SpecialStoragePolicy; |
42 } | 38 } |
43 | 39 |
44 class BrowserContextDependencyManager; | 40 class BrowserContextDependencyManager; |
45 class ExtensionSpecialStoragePolicy; | 41 class ExtensionSpecialStoragePolicy; |
46 class HostContentSettingsMap; | 42 class HostContentSettingsMap; |
47 class PrefServiceSyncable; | 43 class PrefServiceSyncable; |
48 class ProfileSyncService; | |
49 class TemplateURLService; | |
50 class TestingPrefServiceSyncable; | 44 class TestingPrefServiceSyncable; |
51 | 45 |
52 class TestingProfile : public Profile { | 46 class TestingProfile : public Profile { |
53 public: | 47 public: |
54 // Profile directory name for the test user. This is "Default" on most | 48 // Profile directory name for the test user. This is "Default" on most |
55 // platforms but must be different on ChromeOS because a logged-in user cannot | 49 // platforms but must be different on ChromeOS because a logged-in user cannot |
56 // use "Default" as profile directory. | 50 // use "Default" as profile directory. |
57 // Browser- and UI tests should always use this to get to the user's profile | 51 // Browser- and UI tests should always use this to get to the user's profile |
58 // directory. Unit-tests, though, should use |kInitialProfile|, which is | 52 // directory. Unit-tests, though, should use |kInitialProfile|, which is |
59 // always "Default", because they are runnining without logged-in user. | 53 // always "Default", because they are runnining without logged-in user. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE; | 296 const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE; |
303 virtual void CancelProtectedMediaIdentifierPermissionRequests( | 297 virtual void CancelProtectedMediaIdentifierPermissionRequests( |
304 int group_id) OVERRIDE; | 298 int group_id) OVERRIDE; |
305 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 299 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
306 const base::FilePath& partition_path, | 300 const base::FilePath& partition_path, |
307 bool in_memory, | 301 bool in_memory, |
308 content::ProtocolHandlerMap* protocol_handlers, | 302 content::ProtocolHandlerMap* protocol_handlers, |
309 content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE; | 303 content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE; |
310 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; | 304 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; |
311 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; | 305 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; |
312 virtual std::wstring GetName(); | |
313 virtual void SetName(const std::wstring& name) {} | |
314 virtual std::wstring GetID(); | |
315 virtual void SetID(const std::wstring& id); | |
316 void set_last_session_exited_cleanly(bool value) { | 306 void set_last_session_exited_cleanly(bool value) { |
317 last_session_exited_cleanly_ = value; | 307 last_session_exited_cleanly_ = value; |
318 } | 308 } |
319 virtual void MergeResourceString(int message_id, | |
320 std::wstring* output_string) {} | |
321 virtual void MergeResourceInteger(int message_id, int* output_value) {} | |
322 virtual void MergeResourceBoolean(int message_id, bool* output_value) {} | |
323 virtual bool IsSameProfile(Profile *p) OVERRIDE; | 309 virtual bool IsSameProfile(Profile *p) OVERRIDE; |
324 virtual base::Time GetStartTime() const OVERRIDE; | 310 virtual base::Time GetStartTime() const OVERRIDE; |
325 virtual base::FilePath last_selected_directory() OVERRIDE; | 311 virtual base::FilePath last_selected_directory() OVERRIDE; |
326 virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE; | 312 virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE; |
327 virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE; | 313 virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE; |
328 virtual bool IsGuestSession() const OVERRIDE; | 314 virtual bool IsGuestSession() const OVERRIDE; |
329 virtual void SetExitType(ExitType exit_type) OVERRIDE {} | 315 virtual void SetExitType(ExitType exit_type) OVERRIDE {} |
330 virtual ExitType GetLastSessionExitType() OVERRIDE; | 316 virtual ExitType GetLastSessionExitType() OVERRIDE; |
331 #if defined(OS_CHROMEOS) | 317 #if defined(OS_CHROMEOS) |
332 virtual void ChangeAppLocale(const std::string&, | 318 virtual void ChangeAppLocale(const std::string&, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 void CreateTestingPrefService(); | 366 void CreateTestingPrefService(); |
381 | 367 |
382 // Creates a ProfilePolicyConnector that the ProfilePolicyConnectorFactory | 368 // Creates a ProfilePolicyConnector that the ProfilePolicyConnectorFactory |
383 // maps to this profile. | 369 // maps to this profile. |
384 void CreateProfilePolicyConnector(); | 370 void CreateProfilePolicyConnector(); |
385 | 371 |
386 // Internally, this is a TestURLRequestContextGetter that creates a dummy | 372 // Internally, this is a TestURLRequestContextGetter that creates a dummy |
387 // request context. Currently, only the CookieMonster is hooked up. | 373 // request context. Currently, only the CookieMonster is hooked up. |
388 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; | 374 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; |
389 | 375 |
390 std::wstring id_; | |
391 | |
392 bool incognito_; | 376 bool incognito_; |
393 bool force_incognito_; | 377 bool force_incognito_; |
394 scoped_ptr<Profile> incognito_profile_; | 378 scoped_ptr<Profile> incognito_profile_; |
395 Profile* original_profile_; | 379 Profile* original_profile_; |
396 | 380 |
397 bool guest_session_; | 381 bool guest_session_; |
398 | 382 |
399 std::string managed_user_id_; | 383 std::string managed_user_id_; |
400 | 384 |
401 // Did the last session exit cleanly? Default is true. | 385 // Did the last session exit cleanly? Default is true. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 420 |
437 // Weak pointer to a delegate for indicating that a profile was created. | 421 // Weak pointer to a delegate for indicating that a profile was created. |
438 Delegate* delegate_; | 422 Delegate* delegate_; |
439 | 423 |
440 std::string profile_name_; | 424 std::string profile_name_; |
441 | 425 |
442 scoped_ptr<policy::PolicyService> policy_service_; | 426 scoped_ptr<policy::PolicyService> policy_service_; |
443 }; | 427 }; |
444 | 428 |
445 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 429 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
OLD | NEW |