summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/lazy_background_page_test_util.h
diff options
context:
space:
mode:
authoryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-01 23:56:38 +0000
committeryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-01 23:56:38 +0000
commit158ce095aef6fc54ae69e568263fd0db60b85489 (patch)
tree8bd4f9bdcfbec4839f273a56e5fd9733762e01d3 /chrome/browser/extensions/lazy_background_page_test_util.h
parentab55c2b682d9770de2b46cc85b00bcc79c4ea315 (diff)
downloadchromium_src-158ce095aef6fc54ae69e568263fd0db60b85489.zip
chromium_src-158ce095aef6fc54ae69e568263fd0db60b85489.tar.gz
chromium_src-158ce095aef6fc54ae69e568263fd0db60b85489.tar.bz2
Browser test for executing context menu items from event pages.
BUG=123366 Review URL: https://chromiumcodereview.appspot.com/10476004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/lazy_background_page_test_util.h')
-rw-r--r--chrome/browser/extensions/lazy_background_page_test_util.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/chrome/browser/extensions/lazy_background_page_test_util.h b/chrome/browser/extensions/lazy_background_page_test_util.h
new file mode 100644
index 0000000..88e3540
--- /dev/null
+++ b/chrome/browser/extensions/lazy_background_page_test_util.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_
+#define CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_
+#pragma once
+
+#include "content/public/browser/notification_service.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "chrome/test/base/ui_test_utils.h"
+
+// Helper class to wait for a lazy background page to load and close again.
+class LazyBackgroundObserver {
+ public:
+ LazyBackgroundObserver()
+ : page_created_(chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
+ content::NotificationService::AllSources()),
+ page_closed_(chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
+ content::NotificationService::AllSources()) {
+ }
+ explicit LazyBackgroundObserver(Profile* profile)
+ : page_created_(chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
+ content::NotificationService::AllSources()),
+ page_closed_(chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
+ content::Source<Profile>(profile)) {
+ }
+ void Wait() {
+ page_created_.Wait();
+ page_closed_.Wait();
+ }
+
+ void WaitUntilLoaded() {
+ page_created_.Wait();
+ }
+ void WaitUntilClosed() {
+ page_closed_.Wait();
+ }
+
+ private:
+ ui_test_utils::WindowedNotificationObserver page_created_;
+ ui_test_utils::WindowedNotificationObserver page_closed_;
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_