| 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 "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 " frames['sub1'].document.write(" | 406 " frames['sub1'].document.write(" |
| 407 " '<p>Cras tempus ante eu felis semper luctus!</p>');" | 407 " '<p>Cras tempus ante eu felis semper luctus!</p>');" |
| 408 " frames['sub1'].document.close();" | 408 " frames['sub1'].document.close();" |
| 409 "</script></body></html>"; | 409 "</script></body></html>"; |
| 410 | 410 |
| 411 LoadHTML(html); | 411 LoadHTML(html); |
| 412 | 412 |
| 413 // Find the frame and set it as the focused one. This should mean that that | 413 // Find the frame and set it as the focused one. This should mean that that |
| 414 // the printout should only contain the contents of that frame. | 414 // the printout should only contain the contents of that frame. |
| 415 auto* web_view = view_->GetWebView(); | 415 auto* web_view = view_->GetWebView(); |
| 416 WebFrame* sub1_frame = web_view->FindFrameByName(WebString::FromUTF8("sub1")); | 416 WebFrame* sub1_frame = |
| 417 web_view->MainFrame()->ToWebLocalFrame()->FindFrameByName( |
| 418 WebString::FromUTF8("sub1")); |
| 417 ASSERT_TRUE(sub1_frame); | 419 ASSERT_TRUE(sub1_frame); |
| 418 web_view->SetFocusedFrame(sub1_frame); | 420 web_view->SetFocusedFrame(sub1_frame); |
| 419 ASSERT_NE(web_view->FocusedFrame(), web_view->MainFrame()); | 421 ASSERT_NE(web_view->FocusedFrame(), web_view->MainFrame()); |
| 420 | 422 |
| 421 // Initiate printing. | 423 // Initiate printing. |
| 422 OnPrintPages(); | 424 OnPrintPages(); |
| 423 VerifyPagesPrinted(true); | 425 VerifyPagesPrinted(true); |
| 424 | 426 |
| 425 // Verify output through MockPrinter. | 427 // Verify output through MockPrinter. |
| 426 const MockPrinter* printer(print_render_thread_->printer()); | 428 const MockPrinter* printer(print_render_thread_->printer()); |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1156 |
| 1155 VerifyPrintFailed(true); | 1157 VerifyPrintFailed(true); |
| 1156 VerifyPagesPrinted(false); | 1158 VerifyPagesPrinted(false); |
| 1157 } | 1159 } |
| 1158 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) | 1160 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 1159 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 1161 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 1160 | 1162 |
| 1161 #endif // !defined(OS_CHROMEOS) | 1163 #endif // !defined(OS_CHROMEOS) |
| 1162 | 1164 |
| 1163 } // namespace printing | 1165 } // namespace printing |
| OLD | NEW |