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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 50223002: Prevent modal dialogs when preparing to swap out. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after RVHM moved Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 466
467 // Test for crbug.com/297289. Ensure that modal dialogs are closed when a 467 // Test for crbug.com/297289. Ensure that modal dialogs are closed when a
468 // cross-process navigation is ready to commit. 468 // cross-process navigation is ready to commit.
469 IN_PROC_BROWSER_TEST_F(BrowserTest, CrossProcessNavCancelsDialogs) { 469 IN_PROC_BROWSER_TEST_F(BrowserTest, CrossProcessNavCancelsDialogs) {
470 ASSERT_TRUE(test_server()->Start()); 470 ASSERT_TRUE(test_server()->Start());
471 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 471 host_resolver()->AddRule("www.example.com", "127.0.0.1");
472 GURL url(test_server()->GetURL("empty.html")); 472 GURL url(test_server()->GetURL("empty.html"));
473 ui_test_utils::NavigateToURL(browser(), url); 473 ui_test_utils::NavigateToURL(browser(), url);
474 474
475 // TODO(creis): Test this with a setInterval loop of alert dialogs to ensure 475 // Test this with a setInterval loop of alert dialogs to ensure that we can
476 // that we can navigate away even if the renderer tries to synchronously 476 // navigate away even if the renderer tries to synchronously create more.
477 // create more. See http://crbug.com/312490. 477 // See http://crbug.com/312490.
478 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); 478 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
479 contents->GetRenderViewHost()->ExecuteJavascriptInWebFrame( 479 contents->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
480 string16(), 480 string16(),
481 ASCIIToUTF16("alert('Dialog showing!');")); 481 ASCIIToUTF16("setInterval(\"alert('Dialog showing!');\", 0);"));
darin (slow to review) 2013/11/01 21:01:42 This feels like such an imprecise test. I wonder i
Charlie Reis 2013/11/04 19:32:49 Good point. I've simplified this to just be two b
482 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 482 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
483 EXPECT_TRUE(alert->IsValid()); 483 EXPECT_TRUE(alert->IsValid());
484 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); 484 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
485 EXPECT_TRUE(dialog_queue->HasActiveDialog()); 485 EXPECT_TRUE(dialog_queue->HasActiveDialog());
486 486
487 // A cross-site navigation should force the dialog to close. 487 // A cross-site navigation should force the dialog to close.
488 GURL url2("http://www.example.com/empty.html"); 488 GURL url2("http://www.example.com/empty.html");
489 ui_test_utils::NavigateToURL(browser(), url2); 489 ui_test_utils::NavigateToURL(browser(), url2);
490 EXPECT_FALSE(dialog_queue->HasActiveDialog()); 490 EXPECT_FALSE(dialog_queue->HasActiveDialog());
491 491
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 exp_commit_size.Enlarge(wcv_resize_insets.width(), 2540 exp_commit_size.Enlarge(wcv_resize_insets.width(),
2541 wcv_resize_insets.height() + height_inset); 2541 wcv_resize_insets.height() + height_inset);
2542 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2542 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2543 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2543 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2544 // Sizes of RenderWidgetHostView and WebContentsView before and after 2544 // Sizes of RenderWidgetHostView and WebContentsView before and after
2545 // WebContentsDelegate::DidNavigateMainFramePostCommit should be the same. 2545 // WebContentsDelegate::DidNavigateMainFramePostCommit should be the same.
2546 EXPECT_EQ(rwhv_commit_size2, 2546 EXPECT_EQ(rwhv_commit_size2,
2547 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2547 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2548 EXPECT_EQ(wcv_commit_size2, web_contents->GetView()->GetContainerSize()); 2548 EXPECT_EQ(wcv_commit_size2, web_contents->GetView()->GetContainerSize());
2549 } 2549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698