| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 537 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
| 538 EXPECT_TRUE(alert->IsValid()); | 538 EXPECT_TRUE(alert->IsValid()); |
| 539 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); | 539 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); |
| 540 EXPECT_TRUE(dialog_queue->HasActiveDialog()); | 540 EXPECT_TRUE(dialog_queue->HasActiveDialog()); |
| 541 | 541 |
| 542 // Crash the renderer process and ensure the dialog is gone. | 542 // Crash the renderer process and ensure the dialog is gone. |
| 543 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); | 543 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); |
| 544 content::RenderProcessHostWatcher crash_observer( | 544 content::RenderProcessHostWatcher crash_observer( |
| 545 child_process, | 545 child_process, |
| 546 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 546 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 547 base::KillProcess(child_process->GetHandle(), 0, false); | 547 child_process->FastShutdown(0, false); |
| 548 crash_observer.Wait(); | 548 crash_observer.Wait(); |
| 549 EXPECT_FALSE(dialog_queue->HasActiveDialog()); | 549 EXPECT_FALSE(dialog_queue->HasActiveDialog()); |
| 550 | 550 |
| 551 // Make sure subsequent navigations work. | 551 // Make sure subsequent navigations work. |
| 552 GURL url2("http://www.example.com/files/empty.html"); | 552 GURL url2("http://www.example.com/files/empty.html"); |
| 553 ui_test_utils::NavigateToURL(browser(), url2); | 553 ui_test_utils::NavigateToURL(browser(), url2); |
| 554 } | 554 } |
| 555 | 555 |
| 556 // Make sure that dialogs opened by subframes are closed when the process dies. | 556 // Make sure that dialogs opened by subframes are closed when the process dies. |
| 557 // See http://crbug.com/366510. | 557 // See http://crbug.com/366510. |
| 558 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) { | 558 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) { |
| 559 // Navigate to an iframe that opens an alert dialog. | 559 // Navigate to an iframe that opens an alert dialog. |
| 560 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 560 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
| 561 contents->GetMainFrame()->ExecuteJavaScript( | 561 contents->GetMainFrame()->ExecuteJavaScript( |
| 562 ASCIIToUTF16("window.location.href = 'data:text/html," | 562 ASCIIToUTF16("window.location.href = 'data:text/html," |
| 563 "<iframe srcdoc=\"<script>alert(1)</script>\">'")); | 563 "<iframe srcdoc=\"<script>alert(1)</script>\">'")); |
| 564 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 564 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
| 565 EXPECT_TRUE(alert->IsValid()); | 565 EXPECT_TRUE(alert->IsValid()); |
| 566 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); | 566 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); |
| 567 EXPECT_TRUE(dialog_queue->HasActiveDialog()); | 567 EXPECT_TRUE(dialog_queue->HasActiveDialog()); |
| 568 | 568 |
| 569 // Crash the renderer process and ensure the dialog is gone. | 569 // Crash the renderer process and ensure the dialog is gone. |
| 570 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); | 570 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); |
| 571 content::RenderProcessHostWatcher crash_observer( | 571 content::RenderProcessHostWatcher crash_observer( |
| 572 child_process, | 572 child_process, |
| 573 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 573 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 574 base::KillProcess(child_process->GetHandle(), 0, false); | 574 child_process->FastShutdown(0, false); |
| 575 crash_observer.Wait(); | 575 crash_observer.Wait(); |
| 576 EXPECT_FALSE(dialog_queue->HasActiveDialog()); | 576 EXPECT_FALSE(dialog_queue->HasActiveDialog()); |
| 577 | 577 |
| 578 // Make sure subsequent navigations work. | 578 // Make sure subsequent navigations work. |
| 579 GURL url2("data:text/html,foo"); | 579 GURL url2("data:text/html,foo"); |
| 580 ui_test_utils::NavigateToURL(browser(), url2); | 580 ui_test_utils::NavigateToURL(browser(), url2); |
| 581 } | 581 } |
| 582 | 582 |
| 583 // Test for crbug.com/22004. Reloading a page with a before unload handler and | 583 // Test for crbug.com/22004. Reloading a page with a before unload handler and |
| 584 // then canceling the dialog should not leave the throbber spinning. | 584 // then canceling the dialog should not leave the throbber spinning. |
| (...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2654 #endif | 2654 #endif |
| 2655 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2655 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
| 2656 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2656 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
| 2657 gfx::Size exp_final_size(initial_wcv_size); | 2657 gfx::Size exp_final_size(initial_wcv_size); |
| 2658 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2658 exp_final_size.Enlarge(wcv_resize_insets.width(), |
| 2659 wcv_resize_insets.height() + height_inset); | 2659 wcv_resize_insets.height() + height_inset); |
| 2660 EXPECT_EQ(exp_final_size, | 2660 EXPECT_EQ(exp_final_size, |
| 2661 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2661 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
| 2662 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2662 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
| 2663 } | 2663 } |
| OLD | NEW |