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

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

Issue 10860037: [content shell] rename layout_test_controller{,_host,_bindings}.* to webkit_test_runner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 8 years, 4 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
« no previous file with comments | « content/shell/webkit_test_runner.h ('k') | content/shell/webkit_test_runner.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/layout_test_controller.h" 5 #include "content/shell/webkit_test_runner.h"
6 6
7 #include "base/md5.h" 7 #include "base/md5.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "content/public/renderer/render_view.h" 10 #include "content/public/renderer/render_view.h"
11 #include "content/shell/shell_messages.h" 11 #include "content/shell/shell_messages.h"
12 #include "skia/ext/platform_canvas.h" 12 #include "skia/ext/platform_canvas.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h "
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 #if !defined(OS_MACOSX) 131 #if !defined(OS_MACOSX)
132 // Only the expected PNGs for Mac have a valid alpha channel. 132 // Only the expected PNGs for Mac have a valid alpha channel.
133 MakeBitmapOpaque(snapshot); 133 MakeBitmapOpaque(snapshot);
134 #endif 134 #endif
135 135
136 } 136 }
137 137
138 } // namespace 138 } // namespace
139 139
140 LayoutTestController::LayoutTestController(RenderView* render_view) 140 WebKitTestRunner::WebKitTestRunner(RenderView* render_view)
141 : RenderViewObserver(render_view) { 141 : RenderViewObserver(render_view) {
142 } 142 }
143 143
144 LayoutTestController::~LayoutTestController() { 144 WebKitTestRunner::~WebKitTestRunner() {
145 } 145 }
146 146
147 void LayoutTestController::DidClearWindowObject(WebFrame* frame) { 147 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
148 WebTestingSupport::injectInternalsObject(frame); 148 WebTestingSupport::injectInternalsObject(frame);
149 } 149 }
150 150
151 void LayoutTestController::DidFinishLoad(WebFrame* frame) { 151 void WebKitTestRunner::DidFinishLoad(WebFrame* frame) {
152 if (!frame->parent()) 152 if (!frame->parent())
153 Send(new ShellViewHostMsg_DidFinishLoad(routing_id())); 153 Send(new ShellViewHostMsg_DidFinishLoad(routing_id()));
154 } 154 }
155 155
156 bool LayoutTestController::OnMessageReceived(const IPC::Message& message) { 156 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) {
157 bool handled = true; 157 bool handled = true;
158 IPC_BEGIN_MESSAGE_MAP(LayoutTestController, message) 158 IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message)
159 IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureTextDump, OnCaptureTextDump) 159 IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureTextDump, OnCaptureTextDump)
160 IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureImageDump, OnCaptureImageDump) 160 IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureImageDump, OnCaptureImageDump)
161 IPC_MESSAGE_UNHANDLED(handled = false) 161 IPC_MESSAGE_UNHANDLED(handled = false)
162 IPC_END_MESSAGE_MAP() 162 IPC_END_MESSAGE_MAP()
163 163
164 return handled; 164 return handled;
165 } 165 }
166 166
167 void LayoutTestController::OnCaptureTextDump(bool as_text, 167 void WebKitTestRunner::OnCaptureTextDump(bool as_text,
168 bool printing, 168 bool printing,
169 bool recursive) { 169 bool recursive) {
170 WebFrame* frame = render_view()->GetWebView()->mainFrame(); 170 WebFrame* frame = render_view()->GetWebView()->mainFrame();
171 std::string dump; 171 std::string dump;
172 if (as_text) { 172 if (as_text) {
173 dump = DumpFramesAsText(frame, printing, recursive); 173 dump = DumpFramesAsText(frame, printing, recursive);
174 } else { 174 } else {
175 WebFrame::RenderAsTextControls render_text_behavior = 175 WebFrame::RenderAsTextControls render_text_behavior =
176 WebFrame::RenderAsTextNormal; 176 WebFrame::RenderAsTextNormal;
177 if (printing) 177 if (printing)
178 render_text_behavior |= WebFrame::RenderAsTextPrinting; 178 render_text_behavior |= WebFrame::RenderAsTextPrinting;
179 dump = frame->renderTreeAsText(render_text_behavior).utf8(); 179 dump = frame->renderTreeAsText(render_text_behavior).utf8();
180 dump.append(DumpFrameScrollPosition(frame, recursive)); 180 dump.append(DumpFrameScrollPosition(frame, recursive));
181 } 181 }
182 Send(new ShellViewHostMsg_TextDump(routing_id(), dump)); 182 Send(new ShellViewHostMsg_TextDump(routing_id(), dump));
183 } 183 }
184 184
185 void LayoutTestController::OnCaptureImageDump( 185 void WebKitTestRunner::OnCaptureImageDump(
186 const std::string& expected_pixel_hash) { 186 const std::string& expected_pixel_hash) {
187 SkBitmap snapshot; 187 SkBitmap snapshot;
188 CaptureSnapshot(render_view()->GetWebView(), &snapshot); 188 CaptureSnapshot(render_view()->GetWebView(), &snapshot);
189 189
190 SkAutoLockPixels snapshot_lock(snapshot); 190 SkAutoLockPixels snapshot_lock(snapshot);
191 base::MD5Digest digest; 191 base::MD5Digest digest;
192 #if defined(OS_ANDROID) 192 #if defined(OS_ANDROID)
193 // On Android, pixel layout is RGBA, however, other Chrome platforms use BGRA. 193 // On Android, pixel layout is RGBA, however, other Chrome platforms use BGRA.
194 const uint8_t* raw_pixels = 194 const uint8_t* raw_pixels =
195 reinterpret_cast<const uint8_t*>(snapshot.getPixels()); 195 reinterpret_cast<const uint8_t*>(snapshot.getPixels());
(...skipping 15 matching lines...) Expand all
211 SkBitmap empty_image; 211 SkBitmap empty_image;
212 Send(new ShellViewHostMsg_ImageDump( 212 Send(new ShellViewHostMsg_ImageDump(
213 routing_id(), actual_pixel_hash, empty_image)); 213 routing_id(), actual_pixel_hash, empty_image));
214 return; 214 return;
215 } 215 }
216 Send(new ShellViewHostMsg_ImageDump( 216 Send(new ShellViewHostMsg_ImageDump(
217 routing_id(), actual_pixel_hash, snapshot)); 217 routing_id(), actual_pixel_hash, snapshot));
218 } 218 }
219 219
220 } // namespace content 220 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/webkit_test_runner.h ('k') | content/shell/webkit_test_runner.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698