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

Side by Side Diff: content/shell/shell_browser_main.cc

Issue 10941011: Rewrite layout_browsertests to use content_shell --dump-render-tree to execute layout tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/shell/shell_browser_main.h" 5 #include "content/shell/shell_browser_main.h"
6 6
7 #include <iostream>
8
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
10 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
11 #include "content/public/browser/browser_main_runner.h" 13 #include "content/public/browser/browser_main_runner.h"
12 #include "content/shell/shell_switches.h" 14 #include "content/shell/shell_switches.h"
13 #include "content/shell/webkit_test_runner_host.h" 15 #include "content/shell/webkit_test_runner_host.h"
14 #include "webkit/support/webkit_support.h" 16 #include "webkit/support/webkit_support.h"
15 17
16 namespace { 18 namespace {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 67 }
66 68
67 bool layout_test_mode = 69 bool layout_test_mode =
68 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree); 70 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree);
69 71
70 if (layout_test_mode) { 72 if (layout_test_mode) {
71 content::WebKitTestController test_controller; 73 content::WebKitTestController test_controller;
72 74
73 char test_string[2048]; 75 char test_string[2048];
74 #if defined(OS_ANDROID) 76 #if defined(OS_ANDROID)
75 puts("#READY"); 77 std::cout << "#READY\n";
76 fflush(stdout); 78 std::cout.flush();
77 #endif 79 #endif
78 80
79 while (fgets(test_string, sizeof(test_string), stdin)) { 81 while (fgets(test_string, sizeof(test_string), stdin)) {
80 char *new_line_position = strchr(test_string, '\n'); 82 char *new_line_position = strchr(test_string, '\n');
81 if (new_line_position) 83 if (new_line_position)
82 *new_line_position = '\0'; 84 *new_line_position = '\0';
83 if (test_string[0] == '\0') 85 if (test_string[0] == '\0')
84 continue; 86 continue;
85 if (!strcmp(test_string, "QUIT")) 87 if (!strcmp(test_string, "QUIT"))
86 break; 88 break;
87 89
88 bool enable_pixel_dumps; 90 bool enable_pixel_dumps;
89 std::string pixel_hash; 91 std::string pixel_hash;
90 GURL test_url = GetURLForLayoutTest( 92 GURL test_url = GetURLForLayoutTest(
91 test_string, &enable_pixel_dumps, &pixel_hash); 93 test_string, &enable_pixel_dumps, &pixel_hash);
92 if (!content::WebKitTestController::Get()->PrepareForLayoutTest( 94 if (!content::WebKitTestController::Get()->PrepareForLayoutTest(
93 test_url, enable_pixel_dumps, pixel_hash)) { 95 test_url, enable_pixel_dumps, pixel_hash)) {
94 break; 96 break;
95 } 97 }
96 98
97 main_runner_->Run(); 99 main_runner_->Run();
98 100
99 fflush(stdout);
100 fflush(stderr);
101
102 if (!content::WebKitTestController::Get()->ResetAfterLayoutTest()) 101 if (!content::WebKitTestController::Get()->ResetAfterLayoutTest())
103 break; 102 break;
104 } 103 }
105 exit_code = 0; 104 exit_code = 0;
106 } else { 105 } else {
107 exit_code = main_runner_->Run(); 106 exit_code = main_runner_->Run();
108 } 107 }
109 108
110 main_runner_->Shutdown(); 109 main_runner_->Shutdown();
111 110
112 return exit_code; 111 return exit_code;
113 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698