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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for | 776 // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for |
777 // the pending RVH to be destroyed. | 777 // the pending RVH to be destroyed. |
778 host_destroyed_observer.Wait(); | 778 host_destroyed_observer.Wait(); |
779 EXPECT_EQ(url, browser()->toolbar_model()->GetURL()); | 779 EXPECT_EQ(url, browser()->toolbar_model()->GetURL()); |
780 | 780 |
781 // Clear the beforeunload handler so the test can easily exit. | 781 // Clear the beforeunload handler so the test can easily exit. |
782 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame()-> | 782 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame()-> |
783 ExecuteJavaScript(ASCIIToUTF16("onbeforeunload=null;")); | 783 ExecuteJavaScript(ASCIIToUTF16("onbeforeunload=null;")); |
784 } | 784 } |
785 | 785 |
786 // Crashy on mac. http://crbug.com/38522 Crashy on win too (after 3 years). | |
787 // Flaky timeouts on a MemorySanitizer bot. http://crbug.com/410891 | |
788 #if defined(OS_MACOSX) || \ | |
789 defined(OS_WIN) || \ | |
790 defined(MEMORY_SANITIZER) || \ | |
791 defined(ADDRESS_SANITIZER) | |
792 #define MAYBE_SingleBeforeUnloadAfterWindowClose \ | |
793 DISABLED_SingleBeforeUnloadAfterWindowClose | |
794 #else | |
795 #define MAYBE_SingleBeforeUnloadAfterWindowClose \ | |
796 SingleBeforeUnloadAfterWindowClose | |
797 #endif | |
798 | |
799 // Test for crbug.com/11647. A page closed with window.close() should not have | 786 // Test for crbug.com/11647. A page closed with window.close() should not have |
800 // two beforeunload dialogs shown. | 787 // two beforeunload dialogs shown. |
801 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_SingleBeforeUnloadAfterWindowClose) { | 788 // http://crbug.com/410891 |
| 789 IN_PROC_BROWSER_TEST_F(BrowserTest, |
| 790 DISABLED_SingleBeforeUnloadAfterWindowClose) { |
802 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame()-> | 791 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame()-> |
803 ExecuteJavaScriptForTests(ASCIIToUTF16(kOpenNewBeforeUnloadPage)); | 792 ExecuteJavaScriptForTests(ASCIIToUTF16(kOpenNewBeforeUnloadPage)); |
804 | 793 |
805 // Close the new window with JavaScript, which should show a single | 794 // Close the new window with JavaScript, which should show a single |
806 // beforeunload dialog. Then show another alert, to make it easy to verify | 795 // beforeunload dialog. Then show another alert, to make it easy to verify |
807 // that a second beforeunload dialog isn't shown. | 796 // that a second beforeunload dialog isn't shown. |
808 browser()->tab_strip_model()->GetWebContentsAt(0)->GetMainFrame()-> | 797 browser()->tab_strip_model()->GetWebContentsAt(0)->GetMainFrame()-> |
809 ExecuteJavaScriptForTests(ASCIIToUTF16("w.close(); alert('bar');")); | 798 ExecuteJavaScriptForTests(ASCIIToUTF16("w.close(); alert('bar');")); |
810 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 799 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
811 alert->native_dialog()->AcceptAppModalDialog(); | 800 alert->native_dialog()->AcceptAppModalDialog(); |
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2724 #endif | 2713 #endif |
2725 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2714 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2726 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2715 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2727 gfx::Size exp_final_size(initial_wcv_size); | 2716 gfx::Size exp_final_size(initial_wcv_size); |
2728 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2717 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2729 wcv_resize_insets.height() + height_inset); | 2718 wcv_resize_insets.height() + height_inset); |
2730 EXPECT_EQ(exp_final_size, | 2719 EXPECT_EQ(exp_final_size, |
2731 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2720 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2732 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2721 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
2733 } | 2722 } |
OLD | NEW |