summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-02 17:41:04 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-02 17:41:04 +0000
commit0d108edbffac458f8f19c35fd470376e45a811c9 (patch)
treee5bb3dafed1af558ac79f443ea8c8a9a07d56893
parentdcf831f62e6501caf9265c9c2d6c942cd0c523f1 (diff)
downloadchromium_src-0d108edbffac458f8f19c35fd470376e45a811c9.zip
chromium_src-0d108edbffac458f8f19c35fd470376e45a811c9.tar.gz
chromium_src-0d108edbffac458f8f19c35fd470376e45a811c9.tar.bz2
Use printf and friends instead of cout and friends for printing layout test results
On windows, cout will replace \n with \r\n BUG=111316 TEST=run_webkit_tests.py works on windows Review URL: https://chromiumcodereview.appspot.com/10698006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145160 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/shell/layout_test_controller_host.cc21
-rw-r--r--content/shell/shell.cc8
-rw-r--r--content/shell/shell_browser_main.cc10
-rw-r--r--content/shell/shell_javascript_dialog_creator.cc14
-rw-r--r--content/shell/shell_win.cc6
5 files changed, 27 insertions, 32 deletions
diff --git a/content/shell/layout_test_controller_host.cc b/content/shell/layout_test_controller_host.cc
index 5b52cbd..b1b8563 100644
--- a/content/shell/layout_test_controller_host.cc
+++ b/content/shell/layout_test_controller_host.cc
@@ -4,8 +4,6 @@
#include "content/shell/layout_test_controller_host.h"
-#include <iostream>
-
#include "base/message_loop.h"
#include "content/public/browser/render_view_host.h"
#include "content/shell/shell_messages.h"
@@ -72,8 +70,8 @@ void LayoutTestControllerHost::CaptureDump() {
}
void LayoutTestControllerHost::TimeoutHandler() {
- std::cout << "FAIL: Timed out waiting for notifyDone to be called\n";
- std::cerr << "FAIL: Timed out waiting for notifyDone to be called\n";
+ printf("FAIL: Timed out waiting for notifyDone to be called\n");
+ fprintf(stderr, "FAIL: Timed out waiting for notifyDone to be called\n");
CaptureDump();
}
@@ -107,9 +105,8 @@ void LayoutTestControllerHost::OnDidFinishLoad() {
}
void LayoutTestControllerHost::OnTextDump(const std::string& dump) {
- std::cout << dump;
- std::cout << "#EOF\n";
- std::cerr << "#EOF\n";
+ printf("%s#EOF\n", dump.c_str());
+ fprintf(stderr, "#EOF\n");
if (dump_as_text_)
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
@@ -125,9 +122,9 @@ void LayoutTestControllerHost::OnImageDump(
SkAutoLockPixels image_lock(image);
- std::cout << "\nActualHash: " << actual_pixel_hash << "\n";
+ printf("\nActualHash: %s\n", actual_pixel_hash.c_str());
if (!expected_pixel_hash_.empty())
- std::cout << "\nExpectedHash: " << expected_pixel_hash_ << "\n";
+ printf("\nExpectedHash: %s\n", expected_pixel_hash_.c_str());
// Only encode and dump the png if the hashes don't match. Encoding the
// image is really expensive.
@@ -150,9 +147,9 @@ void LayoutTestControllerHost::OnImageDump(
actual_pixel_hash,
&png);
- std::cout << "Content-Type: image/png\n";
- std::cout << "Content-Length: " << png.size() << "\n";
- std::cout.write(reinterpret_cast<const char*>(&png[0]), png.size());
+ printf("Content-Type: image/png\n");
+ printf("Content-Length: %u\n", static_cast<unsigned>(png.size()));
+ fwrite(&png[0], 1, png.size(), stdout);
}
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
diff --git a/content/shell/shell.cc b/content/shell/shell.cc
index 11b121e..84b66ee 100644
--- a/content/shell/shell.cc
+++ b/content/shell/shell.cc
@@ -4,8 +4,6 @@
#include "content/shell/shell.h"
-#include <iostream>
-
#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/message_loop.h"
@@ -177,10 +175,10 @@ bool Shell::AddMessageToConsole(WebContents* source,
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
return false;
- std::cout << "CONSOLE MESSAGE: ";
+ printf("CONSOLE MESSAGE: ");
if (line_no)
- std::cout << "line " << line_no << ": ";
- std::cout << UTF16ToUTF8(message) << "\n";
+ printf("line %d: ", line_no);
+ printf("%s\n", UTF16ToUTF8(message).c_str());
return true;
}
diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc
index 597f1a0..62f1fb1 100644
--- a/content/shell/shell_browser_main.cc
+++ b/content/shell/shell_browser_main.cc
@@ -4,8 +4,6 @@
#include "content/shell/shell_browser_main.h"
-#include <iostream>
-
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -81,7 +79,7 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters) {
continue;
// Test header.
- std::cout << "Content-Type: text/plain\n";
+ printf("Content-Type: text/plain\n");
std::string pixel_hash;
content::Shell::CreateNewWindow(
@@ -97,9 +95,9 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters) {
content::Shell::CloseAllWindows();
// Test footer.
- std::cout << "#EOF\n";
- std::cout.flush();
-
+ printf("#EOF\n");
+ fflush(stdout);
+ fflush(stderr);
}
exit_code = 0;
} else {
diff --git a/content/shell/shell_javascript_dialog_creator.cc b/content/shell/shell_javascript_dialog_creator.cc
index 37518acf..045d0f1 100644
--- a/content/shell/shell_javascript_dialog_creator.cc
+++ b/content/shell/shell_javascript_dialog_creator.cc
@@ -4,8 +4,6 @@
#include "content/shell/shell_javascript_dialog_creator.h"
-#include <iostream>
-
#include "base/command_line.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
@@ -34,13 +32,13 @@ void ShellJavaScriptDialogCreator::RunJavaScriptDialog(
bool* did_suppress_message) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
if (javascript_message_type == JAVASCRIPT_MESSAGE_TYPE_ALERT) {
- std::cout << "ALERT: " << UTF16ToUTF8(message_text) << "\n";
+ printf("ALERT: %s\n", UTF16ToUTF8(message_text).c_str());
} else if (javascript_message_type == JAVASCRIPT_MESSAGE_TYPE_CONFIRM) {
- std::cout << "CONFIRM: " << UTF16ToUTF8(message_text) << "\n";
+ printf("CONFIRM: %s\n", UTF16ToUTF8(message_text).c_str());
} else { // JAVASCRIPT_MESSAGE_TYPE_PROMPT
- std::cout << "PROMPT: " << UTF16ToUTF8(message_text);
- std::cout << ", default text: " << UTF16ToUTF8(default_prompt_text);
- std::cout << "\n";
+ printf("PROMPT: %s, default text: %s\n",
+ UTF16ToUTF8(message_text).c_str(),
+ UTF16ToUTF8(default_prompt_text).c_str());
}
callback.Run(true, string16());
return;
@@ -77,7 +75,7 @@ void ShellJavaScriptDialogCreator::RunBeforeUnloadDialog(
bool is_reload,
const DialogClosedCallback& callback) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
- std::cout << "CONFIRM NAVIGATION: " << UTF16ToUTF8(message_text) << "\n";
+ printf("CONFIRM NAVIGATION: %s\n", UTF16ToUTF8(message_text).c_str());
LayoutTestControllerHost* controller =
LayoutTestControllerHost::FromRenderViewHost(
web_contents->GetRenderViewHost());
diff --git a/content/shell/shell_win.cc b/content/shell/shell_win.cc
index 02cef79..d33ea21 100644
--- a/content/shell/shell_win.cc
+++ b/content/shell/shell_win.cc
@@ -4,8 +4,10 @@
#include "content/shell/shell.h"
-#include <windows.h>
#include <commctrl.h>
+#include <fcntl.h>
+#include <io.h>
+#include <windows.h>
#include "base/command_line.h"
#include "base/string_piece.h"
@@ -49,6 +51,8 @@ namespace content {
HINSTANCE Shell::instance_handle_;
void Shell::PlatformInitialize() {
+ _setmode(_fileno(stdout), _O_BINARY);
+ _setmode(_fileno(stderr), _O_BINARY);
INITCOMMONCONTROLSEX InitCtrlEx;
InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrlEx.dwICC = ICC_STANDARD_CLASSES;