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

Side by Side Diff: chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc

Issue 2541173003: Allow navigation while a JavaScript dialog is up. (Closed)
Patch Set: test cleaner Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/strings/utf_string_conversions.h"
6 #include "base/test/scoped_feature_list.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/common/chrome_features.h"
11 #include "chrome/test/base/in_process_browser_test.h"
12 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/web_contents.h"
14 #include "content/public/test/browser_test_utils.h"
15 #include "content/public/test/test_utils.h"
16
17 using JavaScriptDialogTest = InProcessBrowserTest;
18
19 IN_PROC_BROWSER_TEST_F(JavaScriptDialogTest, ReloadDoesntHang) {
20 base::test::ScopedFeatureList feature_list;
21 feature_list.InitAndEnableFeature(features::kAutoDismissingDialogs);
22
23 content::WebContents* tab =
24 browser()->tab_strip_model()->GetActiveWebContents();
25 JavaScriptDialogTabHelper* js_helper =
26 JavaScriptDialogTabHelper::FromWebContents(tab);
27
28 // Show a dialog.
29
30 scoped_refptr<content::MessageLoopRunner> runner =
31 new content::MessageLoopRunner;
32 js_helper->SetDialogShownCallbackForTesting(runner->QuitClosure());
33 tab->GetMainFrame()->ExecuteJavaScriptForTests(base::UTF8ToUTF16("alert()"));
34 runner->Run();
35
36 // Try reloading.
37
38 tab->GetController().Reload(false);
39 content::WaitForLoadStop(tab);
40
41 // If the WaitForLoadStop doesn't hang forever, we've passed.
42 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698