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

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.cc

Issue 891213002: Add a test for the mouseleave event on window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.cc
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.cc
index 2a27e3c422d2425216d5953b1327a793fe5176d4..2f822262624025495b9eae10580395955148641d 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.cc
@@ -50,29 +50,26 @@ void ContextMenuNotificationObserver::ExecuteCommand(
context_menu->Cancel();
}
-SaveLinkAsContextMenuObserver::SaveLinkAsContextMenuObserver(
- const content::NotificationSource& source)
- : ContextMenuNotificationObserver(IDC_CONTENT_CONTEXT_SAVELINKAS),
- menu_visible_(false) {
+ContextMenuWaiter::ContextMenuWaiter(const content::NotificationSource& source)
+ : menu_visible_(false) {
+ registrar_.Add(this, chrome::NOTIFICATION_RENDER_VIEW_CONTEXT_MENU_SHOWN,
+ content::NotificationService::AllSources());
}
-SaveLinkAsContextMenuObserver::~SaveLinkAsContextMenuObserver() {
+ContextMenuWaiter::~ContextMenuWaiter() {
}
-void SaveLinkAsContextMenuObserver::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+void ContextMenuWaiter::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_RENDER_VIEW_CONTEXT_MENU_SHOWN: {
menu_visible_ = true;
RenderViewContextMenu* context_menu =
content::Source<RenderViewContextMenu>(source).ptr();
base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&SaveLinkAsContextMenuObserver::Cancel,
- base::Unretained(this),
- context_menu));
+ FROM_HERE, base::Bind(&ContextMenuWaiter::Cancel,
+ base::Unretained(this), context_menu));
break;
}
@@ -81,21 +78,22 @@ void SaveLinkAsContextMenuObserver::Observe(
}
}
-void SaveLinkAsContextMenuObserver::WaitForMenu() {
+void ContextMenuWaiter::WaitForMenuOpenAndClose() {
content::WindowedNotificationObserver menu_observer(
chrome::NOTIFICATION_RENDER_VIEW_CONTEXT_MENU_SHOWN,
content::NotificationService::AllSources());
if (!menu_visible_)
menu_observer.Wait();
+
+ content::RunAllPendingInMessageLoop();
menu_visible_ = false;
}
-base::string16 SaveLinkAsContextMenuObserver::GetSuggestedFilename() {
- return params_.suggested_filename;
+content::ContextMenuParams& ContextMenuWaiter::params() {
+ return params_;
}
-void SaveLinkAsContextMenuObserver::Cancel(
- RenderViewContextMenu* context_menu) {
+void ContextMenuWaiter::Cancel(RenderViewContextMenu* context_menu) {
params_ = context_menu->params();
context_menu->Cancel();
}
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h ('k') | chrome/test/data/mouseleave.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698