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

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: 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 464 }
465 465
466 // Test for crbug.com/297289. Ensure that modal dialogs are closed when a 466 // Test for crbug.com/297289. Ensure that modal dialogs are closed when a
467 // cross-process navigation is ready to commit. 467 // cross-process navigation is ready to commit.
468 IN_PROC_BROWSER_TEST_F(BrowserTest, CrossProcessNavCancelsDialogs) { 468 IN_PROC_BROWSER_TEST_F(BrowserTest, CrossProcessNavCancelsDialogs) {
469 ASSERT_TRUE(test_server()->Start()); 469 ASSERT_TRUE(test_server()->Start());
470 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 470 host_resolver()->AddRule("www.example.com", "127.0.0.1");
471 GURL url(test_server()->GetURL("empty.html")); 471 GURL url(test_server()->GetURL("empty.html"));
472 ui_test_utils::NavigateToURL(browser(), url); 472 ui_test_utils::NavigateToURL(browser(), url);
473 473
474 // TODO(creis): Test this with a setInterval loop of alert dialogs to ensure 474 // Test this with a setInterval loop of alert dialogs to ensure that we can
475 // that we can navigate away even if the renderer tries to synchronously 475 // navigate away even if the renderer tries to synchronously create more.
476 // create more. See http://crbug.com/312490. 476 // See http://crbug.com/312490.
477 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); 477 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
478 contents->GetRenderViewHost()->ExecuteJavascriptInWebFrame( 478 contents->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
479 string16(), 479 string16(),
480 ASCIIToUTF16("alert('Dialog showing!');")); 480 ASCIIToUTF16("setInterval(\"alert('Dialog showing!');\", 0);"));
481 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 481 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
482 EXPECT_TRUE(alert->IsValid()); 482 EXPECT_TRUE(alert->IsValid());
483 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); 483 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
484 EXPECT_TRUE(dialog_queue->HasActiveDialog()); 484 EXPECT_TRUE(dialog_queue->HasActiveDialog());
485 485
486 // A cross-site navigation should force the dialog to close. 486 // A cross-site navigation should force the dialog to close.
487 GURL url2("http://www.example.com/empty.html"); 487 GURL url2("http://www.example.com/empty.html");
488 ui_test_utils::NavigateToURL(browser(), url2); 488 ui_test_utils::NavigateToURL(browser(), url2);
489 EXPECT_FALSE(dialog_queue->HasActiveDialog()); 489 EXPECT_FALSE(dialog_queue->HasActiveDialog());
490 490
(...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 exp_commit_size.Enlarge(wcv_resize_insets.width(), 2505 exp_commit_size.Enlarge(wcv_resize_insets.width(),
2506 wcv_resize_insets.height() + height_inset); 2506 wcv_resize_insets.height() + height_inset);
2507 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2507 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2508 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2508 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2509 // Sizes of RenderWidgetHostView and WebContentsView before and after 2509 // Sizes of RenderWidgetHostView and WebContentsView before and after
2510 // WebContentsDelegate::DidNavigateMainFramePostCommit should be the same. 2510 // WebContentsDelegate::DidNavigateMainFramePostCommit should be the same.
2511 EXPECT_EQ(rwhv_commit_size2, 2511 EXPECT_EQ(rwhv_commit_size2,
2512 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2512 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2513 EXPECT_EQ(wcv_commit_size2, web_contents->GetView()->GetContainerSize()); 2513 EXPECT_EQ(wcv_commit_size2, web_contents->GetView()->GetContainerSize());
2514 } 2514 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_impl.h » ('j') | content/renderer/render_view_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698