| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 539 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
| 540 EXPECT_TRUE(alert->IsValid()); | 540 EXPECT_TRUE(alert->IsValid()); |
| 541 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); | 541 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); |
| 542 EXPECT_TRUE(dialog_queue->HasActiveDialog()); | 542 EXPECT_TRUE(dialog_queue->HasActiveDialog()); |
| 543 | 543 |
| 544 // Crash the renderer process and ensure the dialog is gone. | 544 // Crash the renderer process and ensure the dialog is gone. |
| 545 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); | 545 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); |
| 546 content::RenderProcessHostWatcher crash_observer( | 546 content::RenderProcessHostWatcher crash_observer( |
| 547 child_process, | 547 child_process, |
| 548 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 548 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 549 base::KillProcess(child_process->GetHandle(), 0, false); | 549 child_process->Shutdown(0, false); |
| 550 crash_observer.Wait(); | 550 crash_observer.Wait(); |
| 551 EXPECT_FALSE(dialog_queue->HasActiveDialog()); | 551 EXPECT_FALSE(dialog_queue->HasActiveDialog()); |
| 552 | 552 |
| 553 // Make sure subsequent navigations work. | 553 // Make sure subsequent navigations work. |
| 554 GURL url2("http://www.example.com/files/empty.html"); | 554 GURL url2("http://www.example.com/files/empty.html"); |
| 555 ui_test_utils::NavigateToURL(browser(), url2); | 555 ui_test_utils::NavigateToURL(browser(), url2); |
| 556 } | 556 } |
| 557 | 557 |
| 558 // Make sure that dialogs opened by subframes are closed when the process dies. | 558 // Make sure that dialogs opened by subframes are closed when the process dies. |
| 559 // See http://crbug.com/366510. | 559 // See http://crbug.com/366510. |
| 560 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) { | 560 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) { |
| 561 // Navigate to an iframe that opens an alert dialog. | 561 // Navigate to an iframe that opens an alert dialog. |
| 562 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 562 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
| 563 contents->GetMainFrame()->ExecuteJavaScript( | 563 contents->GetMainFrame()->ExecuteJavaScript( |
| 564 ASCIIToUTF16("window.location.href = 'data:text/html," | 564 ASCIIToUTF16("window.location.href = 'data:text/html," |
| 565 "<iframe srcdoc=\"<script>alert(1)</script>\">'")); | 565 "<iframe srcdoc=\"<script>alert(1)</script>\">'")); |
| 566 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 566 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
| 567 EXPECT_TRUE(alert->IsValid()); | 567 EXPECT_TRUE(alert->IsValid()); |
| 568 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); | 568 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); |
| 569 EXPECT_TRUE(dialog_queue->HasActiveDialog()); | 569 EXPECT_TRUE(dialog_queue->HasActiveDialog()); |
| 570 | 570 |
| 571 // Crash the renderer process and ensure the dialog is gone. | 571 // Crash the renderer process and ensure the dialog is gone. |
| 572 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); | 572 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); |
| 573 content::RenderProcessHostWatcher crash_observer( | 573 content::RenderProcessHostWatcher crash_observer( |
| 574 child_process, | 574 child_process, |
| 575 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 575 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 576 base::KillProcess(child_process->GetHandle(), 0, false); | 576 child_process->Shutdown(0, false); |
| 577 crash_observer.Wait(); | 577 crash_observer.Wait(); |
| 578 EXPECT_FALSE(dialog_queue->HasActiveDialog()); | 578 EXPECT_FALSE(dialog_queue->HasActiveDialog()); |
| 579 | 579 |
| 580 // Make sure subsequent navigations work. | 580 // Make sure subsequent navigations work. |
| 581 GURL url2("data:text/html,foo"); | 581 GURL url2("data:text/html,foo"); |
| 582 ui_test_utils::NavigateToURL(browser(), url2); | 582 ui_test_utils::NavigateToURL(browser(), url2); |
| 583 } | 583 } |
| 584 | 584 |
| 585 // Test for crbug.com/22004. Reloading a page with a before unload handler and | 585 // Test for crbug.com/22004. Reloading a page with a before unload handler and |
| 586 // then canceling the dialog should not leave the throbber spinning. | 586 // then canceling the dialog should not leave the throbber spinning. |
| (...skipping 2067 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 |