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

Unified Diff: chrome/browser/mouseleave_browsertest.cc

Issue 2784533002: Turn on auto-dismissing dialogs for trunk builds. (Closed)
Patch Set: chromeos Created 3 years, 8 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/mouseleave_browsertest.cc
diff --git a/chrome/browser/mouseleave_browsertest.cc b/chrome/browser/mouseleave_browsertest.cc
index c0708666a1c70fd682dae4969af3a6e91357e5f7..7d34aac4588017b08ba32e7cd762a283559784d1 100644
--- a/chrome/browser/mouseleave_browsertest.cc
+++ b/chrome/browser/mouseleave_browsertest.cc
@@ -4,6 +4,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
+#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
@@ -12,10 +13,10 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "components/app_modal/app_modal_dialog.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
@@ -158,10 +159,15 @@ IN_PROC_BROWSER_TEST_F(MouseLeaveTest, MAYBE_ModalDialog) {
EXPECT_NO_FATAL_FAILURE(LoadTestPageAndWaitForMouseOver(tab));
+ JavaScriptDialogTabHelper* js_helper =
+ JavaScriptDialogTabHelper::FromWebContents(tab);
+ base::RunLoop dialog_wait;
+ js_helper->SetDialogShownCallbackForTesting(dialog_wait.QuitClosure());
tab->GetMainFrame()->ExecuteJavaScriptForTests(base::UTF8ToUTF16("alert()"));
- app_modal::AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
+ dialog_wait.Run();
+
// Cancel the dialog.
- alert->CloseModalDialog();
+ js_helper->HandleJavaScriptDialog(tab, false, nullptr);
tab->GetMainFrame()->ExecuteJavaScriptForTests(base::ASCIIToUTF16("done()"));
const base::string16 success_title = base::ASCIIToUTF16("without mouseleave");
« no previous file with comments | « chrome/browser/extensions/content_script_apitest.cc ('k') | chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698