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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/extension_test_registry_observer.h
diff --git a/extensions/browser/extension_test_registry_observer.h b/extensions/browser/extension_test_registry_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..8e8e4b031ca35ff22e29f8a6d516d8bc4f28521b
--- /dev/null
+++ b/extensions/browser/extension_test_registry_observer.h
@@ -0,0 +1,48 @@
+// 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_EXTENSION_TEST_REGISTRY_OBSERVER_H_
+#define EXTENSIONS_BROWSER_EXTENSION_TEST_REGISTRY_OBSERVER_H_
not at google - send to devlin 2014/06/15 21:20:16 +yoz, rockot Can this file go in extensions/test?
+
+#include "base/scoped_observer.h"
+#include "content/public/test/test_utils.h"
+#include "extensions/browser/extension_registry.h"
not at google - send to devlin 2014/06/15 21:20:16 forward declare?
limasdf 2014/06/16 18:58:53 Done.
+#include "extensions/browser/extension_registry_observer.h"
+
+namespace extensions {
+
+// A helper class that listen for ExtensionRegistry notifications.
+class ExtensionTestRegistryObserver : public ExtensionRegistryObserver {
+ public:
+ explicit ExtensionTestRegistryObserver(ExtensionRegistry* registry);
+ virtual ~ExtensionTestRegistryObserver();
+
+ void WaitForExtensionInstalled();
not at google - send to devlin 2014/06/15 21:20:17 This should probably be "WaitForExtensionWillBeIns
limasdf 2014/06/16 18:58:53 WaitForAnyExtensionWillBeInstalled.
+ void WaitForExtensionUninstalled();
not at google - send to devlin 2014/06/15 21:20:17 I expect that eventually we'll want to be checking
+
+ private:
+ 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;
+
+ bool waiting_for_installed_;
+ bool received_installed_;
+ scoped_refptr<content::MessageLoopRunner> runner_installed_;
+
+ bool waiting_for_uninstalled_;
+ bool received_uninstalled_;
+ scoped_refptr<content::MessageLoopRunner> runner_uninstalled_;
+
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_EXTENSION_TEST_REGISTRY_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698