| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 EXPECT_FALSE(web_dialog_view_destroyed_); | 215 EXPECT_FALSE(web_dialog_view_destroyed_); |
| 216 content::RunAllPendingInMessageLoop(); | 216 content::RunAllPendingInMessageLoop(); |
| 217 EXPECT_TRUE(web_dialog_view_destroyed_); | 217 EXPECT_TRUE(web_dialog_view_destroyed_); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Test that closing the parent of a window-modal web dialog properly destroys | 220 // Test that closing the parent of a window-modal web dialog properly destroys |
| 221 // the dialog and delegate. | 221 // the dialog and delegate. |
| 222 IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, CloseParentWindow) { | 222 IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, CloseParentWindow) { |
| 223 // Open a second browser window so we don't trigger shutdown. | 223 // Open a second browser window so we don't trigger shutdown. |
| 224 ui_test_utils::NavigateToURLWithDisposition( | 224 ui_test_utils::NavigateToURLWithDisposition( |
| 225 browser(), GURL(url::kAboutBlankURL), NEW_WINDOW, | 225 browser(), GURL(url::kAboutBlankURL), WindowOpenDisposition::NEW_WINDOW, |
| 226 ui_test_utils::BROWSER_TEST_NONE); | 226 ui_test_utils::BROWSER_TEST_NONE); |
| 227 | 227 |
| 228 // TestWebDialogDelegate defaults to window-modal, so closing the browser | 228 // TestWebDialogDelegate defaults to window-modal, so closing the browser |
| 229 // Window (as opposed to closing merely the tab) should close the dialog. | 229 // Window (as opposed to closing merely the tab) should close the dialog. |
| 230 EXPECT_EQ(ui::MODAL_TYPE_WINDOW, | 230 EXPECT_EQ(ui::MODAL_TYPE_WINDOW, |
| 231 view_->GetWidget()->widget_delegate()->GetModalType()); | 231 view_->GetWidget()->widget_delegate()->GetModalType()); |
| 232 | 232 |
| 233 // Close the parent window. Tear down may happen asynchronously. | 233 // Close the parent window. Tear down may happen asynchronously. |
| 234 EXPECT_FALSE(web_dialog_delegate_destroyed_); | 234 EXPECT_FALSE(web_dialog_delegate_destroyed_); |
| 235 EXPECT_FALSE(web_dialog_view_destroyed_); | 235 EXPECT_FALSE(web_dialog_view_destroyed_); |
| 236 browser()->window()->Close(); | 236 browser()->window()->Close(); |
| 237 content::RunAllPendingInMessageLoop(); | 237 content::RunAllPendingInMessageLoop(); |
| 238 EXPECT_TRUE(web_dialog_delegate_destroyed_); | 238 EXPECT_TRUE(web_dialog_delegate_destroyed_); |
| 239 EXPECT_TRUE(web_dialog_view_destroyed_); | 239 EXPECT_TRUE(web_dialog_view_destroyed_); |
| 240 } | 240 } |
| OLD | NEW |