| 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 // Load stop may occure right after the reload commits, and the dialog is |
| 270 // destroyed in a task posted during commit. Make sure that task is executed. |
| 271 base::RunLoop().RunUntilIdle(); |
| 269 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); | 272 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); |
| 270 | 273 |
| 271 // Try printing again. | 274 // Try printing again. |
| 272 PrintPreview(); | 275 PrintPreview(); |
| 273 | 276 |
| 274 // Create a preview dialog for the initiator tab. | 277 // Create a preview dialog for the initiator tab. |
| 275 WebContents* new_preview_dialog = GetPrintPreviewDialog(); | 278 WebContents* new_preview_dialog = GetPrintPreviewDialog(); |
| 276 EXPECT_TRUE(new_preview_dialog); | 279 EXPECT_TRUE(new_preview_dialog); |
| 277 } | 280 } |
| 278 | 281 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); | 393 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); |
| 391 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,HelloWorld")); | 394 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,HelloWorld")); |
| 392 PrintPreview(); | 395 PrintPreview(); |
| 393 WebContents* preview_dialog = GetPrintPreviewDialog(); | 396 WebContents* preview_dialog = GetPrintPreviewDialog(); |
| 394 WaitForAccessibilityTreeToContainNodeWithName(preview_dialog, "HelloWorld"); | 397 WaitForAccessibilityTreeToContainNodeWithName(preview_dialog, "HelloWorld"); |
| 395 } | 398 } |
| 396 | 399 |
| 397 } // namespace | 400 } // namespace |
| 398 | 401 |
| 399 #endif // !defined(OS_ANDROID) | 402 #endif // !defined(OS_ANDROID) |
| OLD | NEW |