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

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

Issue 256233002: Ensure that modal dialogs from subframes can be cleaned up correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leak. Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 567 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
568 base::KillProcess(child_process->GetHandle(), 0, false); 568 base::KillProcess(child_process->GetHandle(), 0, false);
569 crash_observer.Wait(); 569 crash_observer.Wait();
570 EXPECT_FALSE(dialog_queue->HasActiveDialog()); 570 EXPECT_FALSE(dialog_queue->HasActiveDialog());
571 571
572 // Make sure subsequent navigations work. 572 // Make sure subsequent navigations work.
573 GURL url2("http://www.example.com/files/empty.html"); 573 GURL url2("http://www.example.com/files/empty.html");
574 ui_test_utils::NavigateToURL(browser(), url2); 574 ui_test_utils::NavigateToURL(browser(), url2);
575 } 575 }
576 576
577 // Make sure that dialogs opened by subframes are closed when the process dies.
578 // See http://crbug.com/366510.
579 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) {
580 // Navigate to an iframe that opens an alert dialog.
581 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
582 contents->GetMainFrame()->ExecuteJavaScript(
583 ASCIIToUTF16("window.location.href = 'data:text/html,"
584 "<iframe srcdoc=\"<script>alert(1)</script>\">'"));
585 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
586 EXPECT_TRUE(alert->IsValid());
587 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
588 EXPECT_TRUE(dialog_queue->HasActiveDialog());
589
590 // Crash the renderer process and ensure the dialog is gone.
591 content::RenderProcessHost* child_process = contents->GetRenderProcessHost();
592 content::RenderProcessHostWatcher crash_observer(
593 child_process,
594 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
595 base::KillProcess(child_process->GetHandle(), 0, false);
596 crash_observer.Wait();
597 EXPECT_FALSE(dialog_queue->HasActiveDialog());
598
599 // Make sure subsequent navigations work.
600 GURL url2("data:text/html,foo");
601 ui_test_utils::NavigateToURL(browser(), url2);
602 }
603
577 // Test for crbug.com/22004. Reloading a page with a before unload handler and 604 // Test for crbug.com/22004. Reloading a page with a before unload handler and
578 // then canceling the dialog should not leave the throbber spinning. 605 // then canceling the dialog should not leave the throbber spinning.
579 IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { 606 IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) {
580 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); 607 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML);
581 ui_test_utils::NavigateToURL(browser(), url); 608 ui_test_utils::NavigateToURL(browser(), url);
582 609
583 // Navigate to another page, but click cancel in the dialog. Make sure that 610 // Navigate to another page, but click cancel in the dialog. Make sure that
584 // the throbber stops spinning. 611 // the throbber stops spinning.
585 chrome::Reload(browser(), CURRENT_TAB); 612 chrome::Reload(browser(), CURRENT_TAB);
586 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 613 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
(...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 #endif 2702 #endif
2676 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2703 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2677 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2704 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2678 gfx::Size exp_final_size(initial_wcv_size); 2705 gfx::Size exp_final_size(initial_wcv_size);
2679 exp_final_size.Enlarge(wcv_resize_insets.width(), 2706 exp_final_size.Enlarge(wcv_resize_insets.width(),
2680 wcv_resize_insets.height() + height_inset); 2707 wcv_resize_insets.height() + height_inset);
2681 EXPECT_EQ(exp_final_size, 2708 EXPECT_EQ(exp_final_size,
2682 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2709 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2683 EXPECT_EQ(exp_final_size, web_contents->GetView()->GetContainerSize()); 2710 EXPECT_EQ(exp_final_size, web_contents->GetView()->GetContainerSize());
2684 } 2711 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698