Chromium Code Reviews| 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 SetupStdinAndSavePath(); | 645 SetupStdinAndSavePath(); |
| 646 | 646 |
| 647 // There is no way to determine how many tests are to be run ahead of time | 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 | 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 | 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 | 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 | 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.' | 652 // browsertest must be run with '--single_process' not '--single-process.' |
| 653 while (true) { | 653 while (true) { |
| 654 std::string input; | 654 std::string input; |
| 655 std::getline(std::cin, input); | 655 while (input.empty()) { |
|
ivandavid
2014/07/23 03:33:57
The error would occur after at least 1 iteration o
| |
| 656 if (input.empty()) { | 656 if (std::cin.eof()) |
| 657 while (std::cin.eof()) { | |
| 658 std::cin.clear(); | 657 std::cin.clear(); |
| 659 std::getline(std::cin, input); | 658 std::getline(std::cin, input); |
| 660 if (!input.empty()) { | |
| 661 break; | |
| 662 } | |
| 663 } | |
| 664 } | 659 } |
| 665 | 660 |
| 666 base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf"); | 661 base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf"); |
| 667 base::FilePath::StringType cmd; | 662 base::FilePath::StringType cmd; |
| 668 #if defined(OS_POSIX) | 663 #if defined(OS_POSIX) |
| 669 cmd = input; | 664 cmd = input; |
| 670 #elif defined(OS_WIN) | 665 #elif defined(OS_WIN) |
| 671 cmd = base::UTF8ToWide(input); | 666 cmd = base::UTF8ToWide(input); |
| 672 #endif | 667 #endif |
| 673 | 668 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 698 // waiting for this message and start waiting for the image data. | 693 // waiting for this message and start waiting for the image data. |
| 699 std::cout << "#EOF\n"; | 694 std::cout << "#EOF\n"; |
| 700 std::cout.flush(); | 695 std::cout.flush(); |
| 701 | 696 |
| 702 SendPng(); | 697 SendPng(); |
| 703 Reset(); | 698 Reset(); |
| 704 } | 699 } |
| 705 } | 700 } |
| 706 | 701 |
| 707 } // namespace printing | 702 } // namespace printing |
| OLD | NEW |