| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 explicit PrintPreviewDialogDestroyedObserver(WebContents* dialog) | 84 explicit PrintPreviewDialogDestroyedObserver(WebContents* dialog) |
| 85 : WebContentsObserver(dialog), | 85 : WebContentsObserver(dialog), |
| 86 dialog_destroyed_(false) { | 86 dialog_destroyed_(false) { |
| 87 } | 87 } |
| 88 virtual ~PrintPreviewDialogDestroyedObserver() {} | 88 virtual ~PrintPreviewDialogDestroyedObserver() {} |
| 89 | 89 |
| 90 bool dialog_destroyed() const { return dialog_destroyed_; } | 90 bool dialog_destroyed() const { return dialog_destroyed_; } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 // content::WebContentsObserver implementation. | 93 // content::WebContentsObserver implementation. |
| 94 virtual void WebContentsDestroyed(WebContents* contents) OVERRIDE { | 94 virtual void WebContentsDestroyed() OVERRIDE { |
| 95 dialog_destroyed_ = true; | 95 dialog_destroyed_ = true; |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool dialog_destroyed_; | 98 bool dialog_destroyed_; |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogDestroyedObserver); | 100 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogDestroyedObserver); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest { | 103 class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest { |
| 104 public: | 104 public: |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 browser()->tab_strip_model()->GetActiveWebContents()); | 213 browser()->tab_strip_model()->GetActiveWebContents()); |
| 214 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); | 214 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); |
| 215 | 215 |
| 216 // Try printing again. | 216 // Try printing again. |
| 217 PrintPreview(); | 217 PrintPreview(); |
| 218 | 218 |
| 219 // Create a preview dialog for the initiator tab. | 219 // Create a preview dialog for the initiator tab. |
| 220 WebContents* new_preview_dialog = GetPrintPreviewDialog(); | 220 WebContents* new_preview_dialog = GetPrintPreviewDialog(); |
| 221 EXPECT_TRUE(new_preview_dialog); | 221 EXPECT_TRUE(new_preview_dialog); |
| 222 } | 222 } |
| OLD | NEW |