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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 7 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void WebContentsDestroyed() override { dialog_destroyed_ = true; } | 91 void WebContentsDestroyed() override { dialog_destroyed_ = true; } |
92 | 92 |
93 bool dialog_destroyed_; | 93 bool dialog_destroyed_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogDestroyedObserver); | 95 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogDestroyedObserver); |
96 }; | 96 }; |
97 | 97 |
98 class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest { | 98 class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest { |
99 public: | 99 public: |
100 PrintPreviewDialogControllerBrowserTest() : initiator_(NULL) {} | 100 PrintPreviewDialogControllerBrowserTest() : initiator_(NULL) {} |
101 virtual ~PrintPreviewDialogControllerBrowserTest() {} | 101 ~PrintPreviewDialogControllerBrowserTest() override {} |
102 | 102 |
103 WebContents* initiator() { | 103 WebContents* initiator() { |
104 return initiator_; | 104 return initiator_; |
105 } | 105 } |
106 | 106 |
107 void PrintPreview() { | 107 void PrintPreview() { |
108 base::RunLoop run_loop; | 108 base::RunLoop run_loop; |
109 request_preview_dialog_observer()->set_quit_closure(run_loop.QuitClosure()); | 109 request_preview_dialog_observer()->set_quit_closure(run_loop.QuitClosure()); |
110 chrome::Print(browser()); | 110 chrome::Print(browser()); |
111 run_loop.Run(); | 111 run_loop.Run(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 browser()->tab_strip_model()->GetActiveWebContents()); | 214 browser()->tab_strip_model()->GetActiveWebContents()); |
215 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); | 215 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); |
216 | 216 |
217 // Try printing again. | 217 // Try printing again. |
218 PrintPreview(); | 218 PrintPreview(); |
219 | 219 |
220 // Create a preview dialog for the initiator tab. | 220 // Create a preview dialog for the initiator tab. |
221 WebContents* new_preview_dialog = GetPrintPreviewDialog(); | 221 WebContents* new_preview_dialog = GetPrintPreviewDialog(); |
222 EXPECT_TRUE(new_preview_dialog); | 222 EXPECT_TRUE(new_preview_dialog); |
223 } | 223 } |
OLD | NEW |