| Index: extensions/browser/test_extension_registry_observer.h
|
| diff --git a/extensions/browser/test_extension_registry_observer.h b/extensions/browser/test_extension_registry_observer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fc1c286667808b57b62ee684e1ac7d7915d7aff6
|
| --- /dev/null
|
| +++ b/extensions/browser/test_extension_registry_observer.h
|
| @@ -0,0 +1,58 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
|
| +#define EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
|
| +
|
| +#include "base/scoped_observer.h"
|
| +#include "content/public/test/test_utils.h"
|
| +#include "extensions/browser/extension_registry_observer.h"
|
| +
|
| +namespace extensions {
|
| +class ExtensionRegistry;
|
| +
|
| +// A helper class that listen for ExtensionRegistry notifications.
|
| +class TestExtensionRegistryObserver : public ExtensionRegistryObserver {
|
| + public:
|
| + explicit TestExtensionRegistryObserver(ExtensionRegistry* registry);
|
| + virtual ~TestExtensionRegistryObserver();
|
| +
|
| + void WaitForExtensionWillBeInstalled(const std::string& extension_id);
|
| + void WaitForExtensionUninstalled(const std::string& extension_id);
|
| + void WaitForExtensionLoaded(const std::string& extension_id);
|
| + void WaitForExtensionUnloaded(const std::string& extension_id);
|
| +
|
| + private:
|
| + class Waiter;
|
| +
|
| + // ExtensionRegistryObserver.
|
| + virtual void OnExtensionWillBeInstalled(
|
| + content::BrowserContext* browser_context,
|
| + const Extension* extension,
|
| + bool is_update,
|
| + bool from_ephemeral,
|
| + const std::string& old_name) OVERRIDE;
|
| + virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
|
| + const Extension* extension) OVERRIDE;
|
| + virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
|
| + const Extension* extension) OVERRIDE;
|
| + virtual void OnExtensionUnloaded(
|
| + content::BrowserContext* browser_context,
|
| + const Extension* extension,
|
| + UnloadedExtensionInfo::Reason reason) OVERRIDE;
|
| +
|
| + scoped_ptr<Waiter> will_be_installed_waiter_;
|
| + scoped_ptr<Waiter> uninstalled_waiter_;
|
| + scoped_ptr<Waiter> loaded_waiter_;
|
| + scoped_ptr<Waiter> unloaded_waiter_;
|
| +
|
| + ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
|
| + extension_registry_observer_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(TestExtensionRegistryObserver);
|
| +};
|
| +
|
| +} // namespace extensions
|
| +
|
| +#endif // EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
|
|
|