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

Side by Side Diff: chrome/browser/extensions/extension_settings_test_util.h

Issue 8375047: Separate the syncing of extension settings and app settings into separate data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_TEST_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_TEST_UTIL_H_
7 #pragma once
8
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/extension_event_router.h"
12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/test_extension_service.h"
14 #include "chrome/test/base/testing_profile.h"
15
16 class Extension;
17
18 // Utilities for extension settings API tests.
19 namespace extension_settings_test_util {
20
21 // Synchronously gets the storage area for an extension from |frontend|.
22 ExtensionSettingsStorage* GetStorage(
23 const std::string& extension_id, ExtensionSettingsFrontend* frontend);
akalin 2011/10/28 06:04:54 #include <string>
akalin 2011/10/28 06:04:54 forward-declare Frontend?
not at google - send to devlin 2011/10/31 00:02:23 Done, but, why?
not at google - send to devlin 2011/10/31 00:02:23 Done.
akalin 2011/10/31 20:20:57 You use it as a parameter. It's probably pulled i
24
25 // An ExtensionService which allows extensions to be hand-added to be returned
26 // by GetExtensionById.
27 class MockExtensionService : public TestExtensionService {
28 public:
29 MockExtensionService();
30 virtual ~MockExtensionService();
31
32 // Adds an extension with id |id| to be returned by GetExtensionById.
33 void AddExtension(const std::string& id, bool is_app);
akalin 2011/10/28 06:04:54 I think using Extension::Type (not sure what it's
not at google - send to devlin 2011/10/31 00:02:23 Done.
34
35 virtual const Extension* GetExtensionById(
36 const std::string& id, bool include_disabled) const OVERRIDE;
37
38 private:
39 std::map<std::string, scoped_refptr<Extension> > extensions_;
40 };
41
42 // A Profile which returns ExtensionService and ExtensionEventRouters with
43 // enough functionality for the tests.
44 class MockProfile : public TestingProfile {
45 public:
46 explicit MockProfile(const FilePath& file_path);
47 virtual ~MockProfile();
48
49 // Returns the same object as GetExtensionService, but not coaxed into an
50 // ExtensionService; use this method from tests.
51 MockExtensionService* GetMockExtensionService();
52
53 virtual ExtensionService* GetExtensionService() OVERRIDE;
54 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE;
55
56 private:
57 MockExtensionService extension_service_;
58 scoped_ptr<ExtensionEventRouter> event_router_;
59 };
60
61 } // namespace extension_settings_test_util
62
63 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698