| 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_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_TEST_UTIL_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_TEST_UTIL_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_TEST_UTIL_H_ | 6 #define EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "chrome/browser/extensions/api/storage/settings_storage_factory.h" | |
| 16 #include "chrome/browser/extensions/extension_service.h" | |
| 17 #include "chrome/browser/extensions/test_extension_service.h" | |
| 18 #include "chrome/browser/extensions/test_extension_system.h" | 15 #include "chrome/browser/extensions/test_extension_system.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 20 #include "extensions/browser/api/storage/settings_namespace.h" | 17 #include "extensions/browser/api/storage/settings_namespace.h" |
| 18 #include "extensions/browser/api/storage/settings_storage_factory.h" |
| 21 #include "extensions/browser/event_router.h" | 19 #include "extensions/browser/event_router.h" |
| 22 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 23 | 21 |
| 24 class ValueStore; | 22 class ValueStore; |
| 25 | 23 |
| 26 namespace extensions { | 24 namespace extensions { |
| 27 | 25 |
| 28 class SettingsFrontend; | 26 class SettingsFrontend; |
| 29 // Utilities for extension settings API tests. | 27 // Utilities for extension settings API tests. |
| 30 namespace settings_test_util { | 28 namespace settings_test_util { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 Manifest::Type type, | 49 Manifest::Type type, |
| 52 const std::set<std::string>& permissions); | 50 const std::set<std::string>& permissions); |
| 53 | 51 |
| 54 // A mock ExtensionSystem to serve an EventRouter. | 52 // A mock ExtensionSystem to serve an EventRouter. |
| 55 class MockExtensionSystem : public TestExtensionSystem { | 53 class MockExtensionSystem : public TestExtensionSystem { |
| 56 public: | 54 public: |
| 57 explicit MockExtensionSystem(Profile* profile); | 55 explicit MockExtensionSystem(Profile* profile); |
| 58 virtual ~MockExtensionSystem(); | 56 virtual ~MockExtensionSystem(); |
| 59 | 57 |
| 60 virtual EventRouter* event_router() OVERRIDE; | 58 virtual EventRouter* event_router() OVERRIDE; |
| 61 virtual ExtensionService* extension_service() OVERRIDE; | |
| 62 | 59 |
| 63 private: | 60 private: |
| 64 scoped_ptr<EventRouter> event_router_; | 61 scoped_ptr<EventRouter> event_router_; |
| 65 TestExtensionService extension_service_; | |
| 66 | 62 |
| 67 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem); | 63 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem); |
| 68 }; | 64 }; |
| 69 | 65 |
| 70 // A Profile which returns an ExtensionService with enough functionality for | 66 // A Profile which returns an ExtensionSystem with enough functionality for |
| 71 // the tests. | 67 // the tests. |
| 72 class MockProfile : public TestingProfile { | 68 class MockProfile : public TestingProfile { |
| 73 public: | 69 public: |
| 74 explicit MockProfile(const base::FilePath& file_path); | 70 explicit MockProfile(const base::FilePath& file_path); |
| 75 virtual ~MockProfile(); | 71 virtual ~MockProfile(); |
| 76 }; | 72 }; |
| 77 | 73 |
| 78 // SettingsStorageFactory which acts as a wrapper for other factories. | 74 // SettingsStorageFactory which acts as a wrapper for other factories. |
| 79 class ScopedSettingsStorageFactory : public SettingsStorageFactory { | 75 class ScopedSettingsStorageFactory : public SettingsStorageFactory { |
| 80 public: | 76 public: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 97 // SettingsStorageFactory is refcounted. | 93 // SettingsStorageFactory is refcounted. |
| 98 virtual ~ScopedSettingsStorageFactory(); | 94 virtual ~ScopedSettingsStorageFactory(); |
| 99 | 95 |
| 100 scoped_refptr<SettingsStorageFactory> delegate_; | 96 scoped_refptr<SettingsStorageFactory> delegate_; |
| 101 }; | 97 }; |
| 102 | 98 |
| 103 } // namespace settings_test_util | 99 } // namespace settings_test_util |
| 104 | 100 |
| 105 } // namespace extensions | 101 } // namespace extensions |
| 106 | 102 |
| 107 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_TEST_UTIL_H_ | 103 #endif // EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_TEST_UTIL_H_ |
| OLD | NEW |