| 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_test.h" | 5 #include "chrome/browser/printing/print_preview_test.h" |
| 6 | 6 |
| 7 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 7 #include "chrome/test/base/dialog_test_browser_window.h" | 8 #include "chrome/test/base/dialog_test_browser_window.h" |
| 8 #include "content/public/browser/plugin_service.h" | 9 #include "content/public/browser/plugin_service.h" |
| 10 #include "ui/views/window/dialog_delegate.h" |
| 9 | 11 |
| 10 PrintPreviewTest::PrintPreviewTest() {} | 12 PrintPreviewTest::PrintPreviewTest() {} |
| 11 PrintPreviewTest::~PrintPreviewTest() {} | 13 PrintPreviewTest::~PrintPreviewTest() {} |
| 12 | 14 |
| 13 void PrintPreviewTest::SetUp() { | 15 void PrintPreviewTest::SetUp() { |
| 14 BrowserWithTestWindowTest::SetUp(); | 16 BrowserWithTestWindowTest::SetUp(); |
| 15 | 17 |
| 16 // The PluginService will be destroyed at the end of the test (due to the | 18 // The PluginService will be destroyed at the end of the test (due to the |
| 17 // ShadowingAtExitManager in our base class). | 19 // ShadowingAtExitManager in our base class). |
| 18 content::PluginService::GetInstance()->Init(); | 20 content::PluginService::GetInstance()->Init(); |
| 19 } | 21 } |
| 20 | 22 |
| 21 BrowserWindow* PrintPreviewTest::CreateBrowserWindow() { | 23 BrowserWindow* PrintPreviewTest::CreateBrowserWindow() { |
| 22 return new DialogTestBrowserWindow; | 24 return new DialogTestBrowserWindow; |
| 23 } | 25 } |
| 26 |
| 27 #if defined(USE_AURA) |
| 28 PrintPreviewDialogControllerTest::PrintPreviewDialogControllerTest( |
| 29 gfx::NativeView context): context_(context) {} |
| 30 |
| 31 PrintPreviewDialogControllerTest::~PrintPreviewDialogControllerTest() {} |
| 32 |
| 33 // Need to override the function to get the delegate so that it uses the |
| 34 // correct window. |
| 35 ConstrainedWebDialogDelegate* PrintPreviewDialogControllerTest:: |
| 36 GetWebDialogDelegate( |
| 37 content::WebContents* initiator) { |
| 38 ConstrainedWebDialogDelegate* dialog = |
| 39 ShowTopLevelConstrainedWebDialogInWindow( |
| 40 initiator->GetBrowserContext(), |
| 41 printing::GetPrintPreviewDialogDelegate(initiator), |
| 42 initiator, context_); |
| 43 return dialog; |
| 44 } |
| 45 |
| 46 void PrintPreviewDialogControllerTest::SetContext(gfx::NativeView context) { |
| 47 context_ = context; |
| 48 } |
| 49 #endif |
| OLD | NEW |