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

Side by Side Diff: extensions/browser/extension_test_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: Ben's comments 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_EXTENSION_TEST_REGISTRY_OBSERVER_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_TEST_REGISTRY_OBSERVER_H_
7
8 #include "base/scoped_observer.h"
9 #include "content/public/test/test_utils.h"
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 ExtensionTestRegistryObserver : public ExtensionRegistryObserver {
Yoyo Zhou 2014/06/17 02:29:54 nit: TestExtensionRegistryObserver?
limasdf 2014/06/17 17:20:55 Done.
17 public:
18 explicit ExtensionTestRegistryObserver(ExtensionRegistry* registry);
19 virtual ~ExtensionTestRegistryObserver();
20
21 void WaitForAnyExtensionWillBeInstalled();
Yoyo Zhou 2014/06/17 02:29:54 These should be documented. What do you think of c
limasdf 2014/06/17 17:20:55 Done.
22 void WaitForAnyExtensionUninstalled();
23
24 private:
25 class Waiter;
26
27 // ExtensionRegistryObserver.
28 virtual void OnExtensionWillBeInstalled(
29 content::BrowserContext* browser_context,
30 const Extension* extension,
31 bool is_update,
32 bool from_ephemeral,
33 const std::string& old_name) OVERRIDE;
34 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
35 const Extension* extension) OVERRIDE;
36
37 scoped_ptr<Waiter> installed_waiter_;
Yoyo Zhou 2014/06/17 02:29:54 should be will_be_uninstalled_ for consistency.
limasdf 2014/06/17 17:20:56 Done.
38 scoped_ptr<Waiter> uninstalled_waiter_;
39
40 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
41 extension_registry_observer_;
42
43 DISALLOW_COPY_AND_ASSIGN(ExtensionTestRegistryObserver);
44 };
45
46 } // namespace extensions
47
48 #endif // EXTENSIONS_BROWSER_EXTENSION_TEST_REGISTRY_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698