OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
6 #include <fstream> | 6 #include <fstream> |
7 #include <iostream> | 7 #include <iostream> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 public: | 300 public: |
301 PrintPreviewPdfGeneratedBrowserTest() {} | 301 PrintPreviewPdfGeneratedBrowserTest() {} |
302 ~PrintPreviewPdfGeneratedBrowserTest() override {} | 302 ~PrintPreviewPdfGeneratedBrowserTest() override {} |
303 | 303 |
304 // Navigates to the given web page, then initiates print preview and waits | 304 // Navigates to the given web page, then initiates print preview and waits |
305 // for all the settings to be set, then save the preview to PDF. | 305 // for all the settings to be set, then save the preview to PDF. |
306 void NavigateAndPrint(const base::FilePath::StringType& file_name, | 306 void NavigateAndPrint(const base::FilePath::StringType& file_name, |
307 const PrintPreviewSettings& settings) { | 307 const PrintPreviewSettings& settings) { |
308 print_preview_observer_->SetPrintPreviewSettings(settings); | 308 print_preview_observer_->SetPrintPreviewSettings(settings); |
309 base::FilePath path(file_name); | 309 base::FilePath path(file_name); |
310 GURL gurl = net::FilePathToFileURL(path); | 310 GURL gurl = net::FilePathToFileURL(base::MakeAbsoluteFilePath(path)); |
311 | 311 |
312 ui_test_utils::NavigateToURL(browser(), gurl); | 312 ui_test_utils::NavigateToURL(browser(), gurl); |
313 | 313 |
314 base::RunLoop loop; | 314 base::RunLoop loop; |
315 print_preview_observer_->set_quit_closure(loop.QuitClosure()); | 315 print_preview_observer_->set_quit_closure(loop.QuitClosure()); |
316 chrome::Print(browser()); | 316 chrome::Print(browser()); |
317 loop.Run(); | 317 loop.Run(); |
318 | 318 |
319 // Need to check whether the save was successful. Ending the loop only | 319 // Need to check whether the save was successful. Ending the loop only |
320 // means the save was attempted. | 320 // means the save was attempted. |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // waiting for this message and start waiting for the image data. | 630 // waiting for this message and start waiting for the image data. |
631 std::cout << "#EOF\n"; | 631 std::cout << "#EOF\n"; |
632 std::cout.flush(); | 632 std::cout.flush(); |
633 | 633 |
634 SendPng(); | 634 SendPng(); |
635 Reset(); | 635 Reset(); |
636 } | 636 } |
637 } | 637 } |
638 | 638 |
639 } // namespace printing | 639 } // namespace printing |
OLD | NEW |