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

Side by Side Diff: extensions/browser/test_extension_registry_observer.h

Issue 334083002: Add a test helper class for ExtensionRegistry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: yoyo Created 6 years, 6 months 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
OLDNEW
(Empty)
1 // Copyright 2014 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 EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
6 #define EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
7
8 #include "base/scoped_observer.h"
9 #include "content/public/test/test_utils.h"
Lei Zhang 2014/06/19 23:48:10 you can include this in the .cc file and just forw
limasdf 2014/06/20 14:04:27 Done.
10 #include "extensions/browser/extension_registry_observer.h"
11
12 namespace extensions {
13 class ExtensionRegistry;
14
15 // A helper class that listen for ExtensionRegistry notifications.
16 class TestExtensionRegistryObserver : public ExtensionRegistryObserver {
17 public:
18 explicit TestExtensionRegistryObserver(ExtensionRegistry* registry,
19 const std::string& extension_id);
20 virtual ~TestExtensionRegistryObserver();
21
22 void WaitForExtensionWillBeInstalled();
23 void WaitForExtensionUninstalled();
24 void WaitForExtensionLoaded();
25 void WaitForExtensionUnloaded();
26
27 private:
28 class Waiter;
29
30 // ExtensionRegistryObserver.
31 virtual void OnExtensionWillBeInstalled(
32 content::BrowserContext* browser_context,
33 const Extension* extension,
34 bool is_update,
35 bool from_ephemeral,
36 const std::string& old_name) OVERRIDE;
37 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
38 const Extension* extension) OVERRIDE;
39 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
40 const Extension* extension) OVERRIDE;
41 virtual void OnExtensionUnloaded(
42 content::BrowserContext* browser_context,
43 const Extension* extension,
44 UnloadedExtensionInfo::Reason reason) OVERRIDE;
45
46 scoped_ptr<Waiter> will_be_installed_waiter_;
47 scoped_ptr<Waiter> uninstalled_waiter_;
48 scoped_ptr<Waiter> loaded_waiter_;
49 scoped_ptr<Waiter> unloaded_waiter_;
50
51 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
52 extension_registry_observer_;
53
54 std::string extension_id_;
55
56 DISALLOW_COPY_AND_ASSIGN(TestExtensionRegistryObserver);
57 };
58
59 } // namespace extensions
60
61 #endif // EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698