| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 8 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 // Get the print preview dialog for the initiator tab. | 194 // Get the print preview dialog for the initiator tab. |
| 195 WebContents* new_preview_dialog = GetPrintPreviewDialog(); | 195 WebContents* new_preview_dialog = GetPrintPreviewDialog(); |
| 196 | 196 |
| 197 // Check a new preview dialog got created. | 197 // Check a new preview dialog got created. |
| 198 EXPECT_TRUE(new_preview_dialog); | 198 EXPECT_TRUE(new_preview_dialog); |
| 199 } | 199 } |
| 200 | 200 |
| 201 // Test to verify that after reloading the initiator, it creates a new print | 201 // Test to verify that after reloading the initiator, it creates a new print |
| 202 // preview dialog. | 202 // preview dialog. |
| 203 // http://crbug.com/377337 |
| 204 #if defined(OS_WIN) |
| 205 #define MAYBE_ReloadInitiatorTab DISABLED_ReloadInitiatorTab |
| 206 #else |
| 207 #define MAYBE_ReloadInitiatorTab ReloadInitiatorTab |
| 208 #endif |
| 203 IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, | 209 IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, |
| 204 ReloadInitiatorTab) { | 210 MAYBE_ReloadInitiatorTab) { |
| 205 // print for the first time. | 211 // print for the first time. |
| 206 PrintPreview(); | 212 PrintPreview(); |
| 207 | 213 |
| 208 WebContents* preview_dialog = GetPrintPreviewDialog(); | 214 WebContents* preview_dialog = GetPrintPreviewDialog(); |
| 209 | 215 |
| 210 // Check a new print preview dialog got created. | 216 // Check a new print preview dialog got created. |
| 211 ASSERT_TRUE(preview_dialog); | 217 ASSERT_TRUE(preview_dialog); |
| 212 ASSERT_NE(initiator(), preview_dialog); | 218 ASSERT_NE(initiator(), preview_dialog); |
| 213 | 219 |
| 214 // Reload the initiator. Make sure reloading destroys the print preview | 220 // Reload the initiator. Make sure reloading destroys the print preview |
| 215 // dialog. | 221 // dialog. |
| 216 PrintPreviewDialogDestroyedObserver dialog_destroyed_observer(preview_dialog); | 222 PrintPreviewDialogDestroyedObserver dialog_destroyed_observer(preview_dialog); |
| 217 chrome::Reload(browser(), CURRENT_TAB); | 223 chrome::Reload(browser(), CURRENT_TAB); |
| 218 content::WaitForLoadStop( | 224 content::WaitForLoadStop( |
| 219 browser()->tab_strip_model()->GetActiveWebContents()); | 225 browser()->tab_strip_model()->GetActiveWebContents()); |
| 220 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); | 226 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); |
| 221 | 227 |
| 222 // Try printing again. | 228 // Try printing again. |
| 223 PrintPreview(); | 229 PrintPreview(); |
| 224 | 230 |
| 225 // Create a preview dialog for the initiator tab. | 231 // Create a preview dialog for the initiator tab. |
| 226 WebContents* new_preview_dialog = GetPrintPreviewDialog(); | 232 WebContents* new_preview_dialog = GetPrintPreviewDialog(); |
| 227 EXPECT_TRUE(new_preview_dialog); | 233 EXPECT_TRUE(new_preview_dialog); |
| 228 } | 234 } |
| OLD | NEW |