PrintPreviewPdfGeneratedBrowserTest now properly reads from |std::cin|...

PrintPreviewPdfGeneratedBrowserTest now properly reads from |std::cin| removing an edge case where |std::cin.eof()| is false, but |input.empty()| is true. The test also properly exits and doesn't wait for SIGKILL anymore.
BUG=388517

Review URL: https://codereview.chromium.org/414623005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285459 0039d316-1c4b-4281-b951-d872f2087c98
parent b7828210
...@@ -644,25 +644,19 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewPdfGeneratedBrowserTest, ...@@ -644,25 +644,19 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewPdfGeneratedBrowserTest,
InitPdfFunctions(); InitPdfFunctions();
SetupStdinAndSavePath(); SetupStdinAndSavePath();
// There is no way to determine how many tests are to be run ahead of time
// without undesirable changes to the layout test framework. However, that is
// ok since whenever all the tests have been run, the layout test framework
// calls SIGKILL on this process, ending the test. This will end the while
// loop and cause the test to clean up after itself. For this to work, the
// browsertest must be run with '--single_process' not '--single-process.'
while (true) { while (true) {
std::string input; std::string input;
while (input.empty()) {
std::getline(std::cin, input); std::getline(std::cin, input);
if (input.empty()) { if (std::cin.eof())
while (std::cin.eof()) {
std::cin.clear(); std::cin.clear();
std::getline(std::cin, input);
if (!input.empty()) {
break;
}
}
} }
// If the layout test framework sends "QUIT" to this test, that means there
// are no more tests for this instance to run and it should quit.
if (input == "QUIT")
break;
base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf"); base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf");
base::FilePath::StringType cmd; base::FilePath::StringType cmd;
#if defined(OS_POSIX) #if defined(OS_POSIX)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment