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/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
6 #include "base/location.h" | 6 #include "base/location.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 nullptr, | 139 nullptr, |
140 GURL(kDummyPrintUrl), | 140 GURL(kDummyPrintUrl), |
141 GURL(), | 141 GURL(), |
142 &pdf_plugin_info)); | 142 &pdf_plugin_info)); |
143 } | 143 } |
144 | 144 |
145 } // namespace | 145 } // namespace |
146 | 146 |
147 class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest { | 147 class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest { |
148 public: | 148 public: |
149 PrintPreviewDialogControllerBrowserTest() : initiator_(NULL) {} | 149 PrintPreviewDialogControllerBrowserTest() : initiator_(nullptr) {} |
150 ~PrintPreviewDialogControllerBrowserTest() override {} | 150 ~PrintPreviewDialogControllerBrowserTest() override {} |
151 | 151 |
152 WebContents* initiator() { | 152 WebContents* initiator() { |
153 return initiator_; | 153 return initiator_; |
154 } | 154 } |
155 | 155 |
156 void PrintPreview() { | 156 void PrintPreview() { |
157 base::RunLoop run_loop; | 157 base::RunLoop run_loop; |
158 request_preview_dialog_observer()->set_quit_closure(run_loop.QuitClosure()); | 158 request_preview_dialog_observer()->set_quit_closure(run_loop.QuitClosure()); |
159 chrome::Print(browser()); | 159 chrome::Print(browser()); |
(...skipping 23 matching lines...) Expand all Loading... |
183 initiator_ = browser()->tab_strip_model()->GetActiveWebContents(); | 183 initiator_ = browser()->tab_strip_model()->GetActiveWebContents(); |
184 ASSERT_TRUE(initiator_); | 184 ASSERT_TRUE(initiator_); |
185 ASSERT_NE(first_tab, initiator_); | 185 ASSERT_NE(first_tab, initiator_); |
186 | 186 |
187 content::PluginService::GetInstance()->Init(); | 187 content::PluginService::GetInstance()->Init(); |
188 content::PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); | 188 content::PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); |
189 } | 189 } |
190 | 190 |
191 void TearDownOnMainThread() override { | 191 void TearDownOnMainThread() override { |
192 cloned_tab_observer_.reset(); | 192 cloned_tab_observer_.reset(); |
193 initiator_ = NULL; | 193 initiator_ = nullptr; |
194 } | 194 } |
195 | 195 |
196 RequestPrintPreviewObserver* request_preview_dialog_observer() { | 196 RequestPrintPreviewObserver* request_preview_dialog_observer() { |
197 return cloned_tab_observer_->request_preview_dialog_observer(); | 197 return cloned_tab_observer_->request_preview_dialog_observer(); |
198 } | 198 } |
199 | 199 |
200 scoped_ptr<PrintPreviewDialogClonedObserver> cloned_tab_observer_; | 200 scoped_ptr<PrintPreviewDialogClonedObserver> cloned_tab_observer_; |
201 WebContents* initiator_; | 201 WebContents* initiator_; |
202 | 202 |
203 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogControllerBrowserTest); | 203 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogControllerBrowserTest); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 frame_count = 0; | 324 frame_count = 0; |
325 preview_dialog->ForEachFrame( | 325 preview_dialog->ForEachFrame( |
326 base::Bind(&CountFrames, base::Unretained(&frame_count))); | 326 base::Bind(&CountFrames, base::Unretained(&frame_count))); |
327 } while (frame_count < kExpectedFrameCount); | 327 } while (frame_count < kExpectedFrameCount); |
328 ASSERT_EQ(kExpectedFrameCount, frame_count); | 328 ASSERT_EQ(kExpectedFrameCount, frame_count); |
329 | 329 |
330 // Make sure all the frames in the dialog has access to the PDF plugin. | 330 // Make sure all the frames in the dialog has access to the PDF plugin. |
331 preview_dialog->ForEachFrame(base::Bind(&CheckPdfPluginForRenderFrame)); | 331 preview_dialog->ForEachFrame(base::Bind(&CheckPdfPluginForRenderFrame)); |
332 } | 332 } |
OLD | NEW |