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 "chrome/browser/printing/print_preview_dialog_controller.h" | 5 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // Check a new print preview dialog got created. | 259 // Check a new print preview dialog got created. |
260 ASSERT_TRUE(preview_dialog); | 260 ASSERT_TRUE(preview_dialog); |
261 ASSERT_NE(initiator(), preview_dialog); | 261 ASSERT_NE(initiator(), preview_dialog); |
262 | 262 |
263 // Reload the initiator. Make sure reloading destroys the print preview | 263 // Reload the initiator. Make sure reloading destroys the print preview |
264 // dialog. | 264 // dialog. |
265 PrintPreviewDialogDestroyedObserver dialog_destroyed_observer(preview_dialog); | 265 PrintPreviewDialogDestroyedObserver dialog_destroyed_observer(preview_dialog); |
266 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); | 266 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
267 content::WaitForLoadStop( | 267 content::WaitForLoadStop( |
268 browser()->tab_strip_model()->GetActiveWebContents()); | 268 browser()->tab_strip_model()->GetActiveWebContents()); |
269 // When Widget::Close is called, a task is posted that will destroy the | |
270 // widget. Here the widget is closed when the navigation commits. Load stop | |
271 // may occur right after the commit, before the widget is destroyed. | |
272 // Execute pending tasks to account for this. | |
273 base::RunLoop().RunUntilIdle(); | |
274 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); | 269 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); |
275 | 270 |
276 // Try printing again. | 271 // Try printing again. |
277 PrintPreview(); | 272 PrintPreview(); |
278 | 273 |
279 // Create a preview dialog for the initiator tab. | 274 // Create a preview dialog for the initiator tab. |
280 WebContents* new_preview_dialog = GetPrintPreviewDialog(); | 275 WebContents* new_preview_dialog = GetPrintPreviewDialog(); |
281 EXPECT_TRUE(new_preview_dialog); | 276 EXPECT_TRUE(new_preview_dialog); |
282 } | 277 } |
283 | 278 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); | 390 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); |
396 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,HelloWorld")); | 391 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,HelloWorld")); |
397 PrintPreview(); | 392 PrintPreview(); |
398 WebContents* preview_dialog = GetPrintPreviewDialog(); | 393 WebContents* preview_dialog = GetPrintPreviewDialog(); |
399 WaitForAccessibilityTreeToContainNodeWithName(preview_dialog, "HelloWorld"); | 394 WaitForAccessibilityTreeToContainNodeWithName(preview_dialog, "HelloWorld"); |
400 } | 395 } |
401 | 396 |
402 } // namespace | 397 } // namespace |
403 | 398 |
404 #endif // !defined(OS_ANDROID) | 399 #endif // !defined(OS_ANDROID) |
OLD | NEW |