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

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: remove failed test to fix later 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
« no previous file with comments | « extensions/DEPS ('k') | extensions/browser/test_extension_registry_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/extension_registry_observer.h"
10
11 namespace extensions {
12 class ExtensionRegistry;
13
14 // A helper class that listen for ExtensionRegistry notifications.
15 class TestExtensionRegistryObserver : public ExtensionRegistryObserver {
16 public:
17 explicit TestExtensionRegistryObserver(ExtensionRegistry* registry,
18 const std::string& extension_id);
19 virtual ~TestExtensionRegistryObserver();
20
21 void WaitForExtensionWillBeInstalled();
22 void WaitForExtensionUninstalled();
23 void WaitForExtensionLoaded();
24 void WaitForExtensionUnloaded();
25
26 private:
27 class Waiter;
28
29 // ExtensionRegistryObserver.
30 virtual void OnExtensionWillBeInstalled(
31 content::BrowserContext* browser_context,
32 const Extension* extension,
33 bool is_update,
34 bool from_ephemeral,
35 const std::string& old_name) OVERRIDE;
36 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
37 const Extension* extension) OVERRIDE;
38 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
39 const Extension* extension) OVERRIDE;
40 virtual void OnExtensionUnloaded(
41 content::BrowserContext* browser_context,
42 const Extension* extension,
43 UnloadedExtensionInfo::Reason reason) OVERRIDE;
44
45 scoped_ptr<Waiter> will_be_installed_waiter_;
46 scoped_ptr<Waiter> uninstalled_waiter_;
47 scoped_ptr<Waiter> loaded_waiter_;
48 scoped_ptr<Waiter> unloaded_waiter_;
49
50 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
51 extension_registry_observer_;
52
53 std::string extension_id_;
54
55 DISALLOW_COPY_AND_ASSIGN(TestExtensionRegistryObserver);
56 };
57
58 } // namespace extensions
59
60 #endif // EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
OLDNEW
« no previous file with comments | « extensions/DEPS ('k') | extensions/browser/test_extension_registry_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698