OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/printing/print_view_manager.h" |
| 6 #include "chrome/browser/printing/print_preview_test.h" |
| 7 #include "chrome/browser/ui/browser_commands.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "content/public/test/test_renderer_host.h" |
| 10 |
| 11 namespace printing { |
| 12 |
| 13 using PrintViewManagerTest = PrintPreviewTest; |
| 14 |
| 15 TEST_F(PrintViewManagerTest, PrintSubFrameAndDestroy) { |
| 16 chrome::NewTab(browser()); |
| 17 content::WebContents* web_contents = |
| 18 browser()->tab_strip_model()->GetActiveWebContents(); |
| 19 ASSERT_TRUE(web_contents); |
| 20 |
| 21 content::RenderFrameHost* sub_frame = |
| 22 content::RenderFrameHostTester::For(web_contents->GetMainFrame()) |
| 23 ->AppendChild("child"); |
| 24 |
| 25 PrintViewManager* print_view_manager = |
| 26 PrintViewManager::FromWebContents(web_contents); |
| 27 ASSERT_TRUE(print_view_manager); |
| 28 EXPECT_FALSE(print_view_manager->print_preview_rfh()); |
| 29 |
| 30 print_view_manager->PrintPreviewNow(sub_frame, false); |
| 31 EXPECT_TRUE(print_view_manager->print_preview_rfh()); |
| 32 |
| 33 content::RenderFrameHostTester::For(sub_frame)->Detach(); |
| 34 EXPECT_FALSE(print_view_manager->print_preview_rfh()); |
| 35 } |
| 36 |
| 37 } // namespace printing |
OLD | NEW |