Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5371)

Unified Diff: chrome/browser/printing/print_view_manager_unittest.cc

Issue 2775133002: M57: Properly clean up in PrintViewManager::RenderFrameCreated(). (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/printing/print_view_manager.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_view_manager_unittest.cc
diff --git a/chrome/browser/printing/print_view_manager_unittest.cc b/chrome/browser/printing/print_view_manager_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..aa8469dfc8451f6eb5832b9e241b95b39a4823bb
--- /dev/null
+++ b/chrome/browser/printing/print_view_manager_unittest.cc
@@ -0,0 +1,37 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/printing/print_view_manager.h"
+#include "chrome/browser/printing/print_preview_test.h"
+#include "chrome/browser/ui/browser_commands.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "content/public/test/test_renderer_host.h"
+
+namespace printing {
+
+using PrintViewManagerTest = PrintPreviewTest;
+
+TEST_F(PrintViewManagerTest, PrintSubFrameAndDestroy) {
+ chrome::NewTab(browser());
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(web_contents);
+
+ content::RenderFrameHost* sub_frame =
+ content::RenderFrameHostTester::For(web_contents->GetMainFrame())
+ ->AppendChild("child");
+
+ PrintViewManager* print_view_manager =
+ PrintViewManager::FromWebContents(web_contents);
+ ASSERT_TRUE(print_view_manager);
+ EXPECT_FALSE(print_view_manager->print_preview_rfh());
+
+ print_view_manager->PrintPreviewNow(sub_frame, false);
+ EXPECT_TRUE(print_view_manager->print_preview_rfh());
+
+ content::RenderFrameHostTester::For(sub_frame)->Detach();
+ EXPECT_FALSE(print_view_manager->print_preview_rfh());
+}
+
+} // namespace printing
« no previous file with comments | « chrome/browser/printing/print_view_manager.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698