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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
637 // | 637 // |
638 // Throughout this code, there will be |std::cout| statements. The layout test | 638 // Throughout this code, there will be |std::cout| statements. The layout test |
639 // framework uses stdout to get data from the browser test and uses stdin | 639 // framework uses stdout to get data from the browser test and uses stdin |
640 // to send data to the browser test. Writing "EOF\n" to |std::cout| indicates | 640 // to send data to the browser test. Writing "EOF\n" to |std::cout| indicates |
641 // that whatever block of data that the test was expecting has been completely | 641 // that whatever block of data that the test was expecting has been completely |
642 // sent. Sometimes EOF is printed to stderr because the test will expect it | 642 // sent. Sometimes EOF is printed to stderr because the test will expect it |
643 // from stderr in addition to stdout for certain blocks of data. | 643 // from stderr in addition to stdout for certain blocks of data. |
644 InitPdfFunctions(); | 644 InitPdfFunctions(); |
645 SetupStdinAndSavePath(); | 645 SetupStdinAndSavePath(); |
646 | 646 |
647 // There is no way to determine how many tests are to be run ahead of time | |
648 // without undesirable changes to the layout test framework. However, that is | |
649 // ok since whenever all the tests have been run, the layout test framework | |
650 // calls SIGKILL on this process, ending the test. This will end the while | |
651 // loop and cause the test to clean up after itself. For this to work, the | |
652 // browsertest must be run with '--single_process' not '--single-process.' | |
653 while (true) { | 647 while (true) { |
654 std::string input; | 648 std::string input; |
655 std::getline(std::cin, input); | 649 while (input.empty()) { |
656 if (input.empty()) { | 650 std::getline(std::cin, input); |
ivandavid
2014/07/24 21:39:37
I flipped the getline and the clearing of |std::ci
| |
657 while (std::cin.eof()) { | 651 if (std::cin.eof()) |
658 std::cin.clear(); | 652 std::cin.clear(); |
659 std::getline(std::cin, input); | |
660 if (!input.empty()) { | |
661 break; | |
662 } | |
663 } | |
664 } | 653 } |
665 | 654 |
655 if (input == "QUIT") | |
656 break; | |
657 | |
666 base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf"); | 658 base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf"); |
667 base::FilePath::StringType cmd; | 659 base::FilePath::StringType cmd; |
668 #if defined(OS_POSIX) | 660 #if defined(OS_POSIX) |
669 cmd = input; | 661 cmd = input; |
670 #elif defined(OS_WIN) | 662 #elif defined(OS_WIN) |
671 cmd = base::UTF8ToWide(input); | 663 cmd = base::UTF8ToWide(input); |
672 #endif | 664 #endif |
673 | 665 |
674 DuplicateTab(); | 666 DuplicateTab(); |
675 PrintPreviewSettings settings( | 667 PrintPreviewSettings settings( |
(...skipping 22 matching lines...) Expand all Loading... | |
698 // waiting for this message and start waiting for the image data. | 690 // waiting for this message and start waiting for the image data. |
699 std::cout << "#EOF\n"; | 691 std::cout << "#EOF\n"; |
700 std::cout.flush(); | 692 std::cout.flush(); |
701 | 693 |
702 SendPng(); | 694 SendPng(); |
703 Reset(); | 695 Reset(); |
704 } | 696 } |
705 } | 697 } |
706 | 698 |
707 } // namespace printing | 699 } // namespace printing |
OLD | NEW |