OLD | NEW |
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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 521 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
522 base::KillProcess(child_process->GetHandle(), 0, false); | 522 base::KillProcess(child_process->GetHandle(), 0, false); |
523 crash_observer.Wait(); | 523 crash_observer.Wait(); |
524 EXPECT_FALSE(dialog_queue->HasActiveDialog()); | 524 EXPECT_FALSE(dialog_queue->HasActiveDialog()); |
525 | 525 |
526 // Make sure subsequent navigations work. | 526 // Make sure subsequent navigations work. |
527 GURL url2("http://www.example.com/files/empty.html"); | 527 GURL url2("http://www.example.com/files/empty.html"); |
528 ui_test_utils::NavigateToURL(browser(), url2); | 528 ui_test_utils::NavigateToURL(browser(), url2); |
529 } | 529 } |
530 | 530 |
| 531 // Make sure that dialogs opened by subframes are closed when the process dies. |
| 532 // See http://crbug.com/366510. |
| 533 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) { |
| 534 // Navigate to an iframe that opens an alert dialog. |
| 535 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
| 536 contents->GetMainFrame()->ExecuteJavaScript( |
| 537 ASCIIToUTF16("window.location.href = 'data:text/html," |
| 538 "<iframe srcdoc=\"<script>alert(1)</script>\">'")); |
| 539 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
| 540 EXPECT_TRUE(alert->IsValid()); |
| 541 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); |
| 542 EXPECT_TRUE(dialog_queue->HasActiveDialog()); |
| 543 |
| 544 // Crash the renderer process and ensure the dialog is gone. |
| 545 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); |
| 546 content::RenderProcessHostWatcher crash_observer( |
| 547 child_process, |
| 548 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 549 base::KillProcess(child_process->GetHandle(), 0, false); |
| 550 crash_observer.Wait(); |
| 551 EXPECT_FALSE(dialog_queue->HasActiveDialog()); |
| 552 |
| 553 // Make sure subsequent navigations work. |
| 554 GURL url2("data:text/html,foo"); |
| 555 ui_test_utils::NavigateToURL(browser(), url2); |
| 556 } |
| 557 |
531 // Test for crbug.com/22004. Reloading a page with a before unload handler and | 558 // Test for crbug.com/22004. Reloading a page with a before unload handler and |
532 // then canceling the dialog should not leave the throbber spinning. | 559 // then canceling the dialog should not leave the throbber spinning. |
533 IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { | 560 IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { |
534 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); | 561 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); |
535 ui_test_utils::NavigateToURL(browser(), url); | 562 ui_test_utils::NavigateToURL(browser(), url); |
536 | 563 |
537 // Navigate to another page, but click cancel in the dialog. Make sure that | 564 // Navigate to another page, but click cancel in the dialog. Make sure that |
538 // the throbber stops spinning. | 565 // the throbber stops spinning. |
539 chrome::Reload(browser(), CURRENT_TAB); | 566 chrome::Reload(browser(), CURRENT_TAB); |
540 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 567 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2604 #endif | 2631 #endif |
2605 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2632 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2606 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2633 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2607 gfx::Size exp_final_size(initial_wcv_size); | 2634 gfx::Size exp_final_size(initial_wcv_size); |
2608 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2635 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2609 wcv_resize_insets.height() + height_inset); | 2636 wcv_resize_insets.height() + height_inset); |
2610 EXPECT_EQ(exp_final_size, | 2637 EXPECT_EQ(exp_final_size, |
2611 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2638 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2612 EXPECT_EQ(exp_final_size, web_contents->GetView()->GetContainerSize()); | 2639 EXPECT_EQ(exp_final_size, web_contents->GetView()->GetContainerSize()); |
2613 } | 2640 } |
OLD | NEW |