Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/browser/printing/print_preview_pdf_generated_browsertest.cc

Issue 414623005: PrintPreviewPdfGeneratedBrowserTest properly listens to messages and exits correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test now properly exits by listening for a message from the layout test framework. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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()) {
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
661 if (input.find("QUIT") != std::string::npos)
Lei Zhang 2014/07/24 21:06:52 If you do this, shouldn't it be input == "QUIT" ?
ivandavid 2014/07/24 21:39:37 Done.
662 break;
663
666 base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf"); 664 base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf");
667 base::FilePath::StringType cmd; 665 base::FilePath::StringType cmd;
668 #if defined(OS_POSIX) 666 #if defined(OS_POSIX)
669 cmd = input; 667 cmd = input;
670 #elif defined(OS_WIN) 668 #elif defined(OS_WIN)
671 cmd = base::UTF8ToWide(input); 669 cmd = base::UTF8ToWide(input);
672 #endif 670 #endif
673 671
674 DuplicateTab(); 672 DuplicateTab();
675 PrintPreviewSettings settings( 673 PrintPreviewSettings settings(
(...skipping 22 matching lines...) Expand all
698 // waiting for this message and start waiting for the image data. 696 // waiting for this message and start waiting for the image data.
699 std::cout << "#EOF\n"; 697 std::cout << "#EOF\n";
700 std::cout.flush(); 698 std::cout.flush();
701 699
702 SendPng(); 700 SendPng();
703 Reset(); 701 Reset();
704 } 702 }
705 } 703 }
706 704
707 } // namespace printing 705 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698