OLD | NEW |
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/webkit_test_runner.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" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
20 #ifdef WEBKIT_TESTING_SUPPORT_AVAILABLE | |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h" |
22 #endif | |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
24 #include "webkit/glue/webkit_glue.h" | 22 #include "webkit/glue/webkit_glue.h" |
25 | 23 |
26 using WebKit::WebFrame; | 24 using WebKit::WebFrame; |
27 using WebKit::WebElement; | 25 using WebKit::WebElement; |
28 using WebKit::WebRect; | 26 using WebKit::WebRect; |
29 using WebKit::WebSize; | 27 using WebKit::WebSize; |
30 #ifdef WEBKIT_TESTING_SUPPORT_AVAILABLE | |
31 using WebKit::WebTestingSupport; | 28 using WebKit::WebTestingSupport; |
32 #endif | |
33 using WebKit::WebView; | 29 using WebKit::WebView; |
34 | 30 |
35 namespace content { | 31 namespace content { |
36 | 32 |
37 namespace { | 33 namespace { |
38 | 34 |
39 std::string DumpDocumentText(WebFrame* frame) { | 35 std::string DumpDocumentText(WebFrame* frame) { |
40 // We use the document element's text instead of the body text here because | 36 // We use the document element's text instead of the body text here because |
41 // not all documents have a body, such as XML documents. | 37 // not all documents have a body, such as XML documents. |
42 WebElement documentElement = frame->document().documentElement(); | 38 WebElement documentElement = frame->document().documentElement(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } // namespace | 138 } // namespace |
143 | 139 |
144 WebKitTestRunner::WebKitTestRunner(RenderView* render_view) | 140 WebKitTestRunner::WebKitTestRunner(RenderView* render_view) |
145 : RenderViewObserver(render_view) { | 141 : RenderViewObserver(render_view) { |
146 } | 142 } |
147 | 143 |
148 WebKitTestRunner::~WebKitTestRunner() { | 144 WebKitTestRunner::~WebKitTestRunner() { |
149 } | 145 } |
150 | 146 |
151 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { | 147 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { |
152 #ifdef WEBKIT_TESTING_SUPPORT_AVAILABLE | |
153 WebTestingSupport::injectInternalsObject(frame); | 148 WebTestingSupport::injectInternalsObject(frame); |
154 #endif | |
155 } | 149 } |
156 | 150 |
157 void WebKitTestRunner::DidFinishLoad(WebFrame* frame) { | 151 void WebKitTestRunner::DidFinishLoad(WebFrame* frame) { |
158 if (!frame->parent()) | 152 if (!frame->parent()) |
159 Send(new ShellViewHostMsg_DidFinishLoad(routing_id())); | 153 Send(new ShellViewHostMsg_DidFinishLoad(routing_id())); |
160 } | 154 } |
161 | 155 |
162 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { | 156 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { |
163 bool handled = true; | 157 bool handled = true; |
164 IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message) | 158 IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 SkBitmap empty_image; | 211 SkBitmap empty_image; |
218 Send(new ShellViewHostMsg_ImageDump( | 212 Send(new ShellViewHostMsg_ImageDump( |
219 routing_id(), actual_pixel_hash, empty_image)); | 213 routing_id(), actual_pixel_hash, empty_image)); |
220 return; | 214 return; |
221 } | 215 } |
222 Send(new ShellViewHostMsg_ImageDump( | 216 Send(new ShellViewHostMsg_ImageDump( |
223 routing_id(), actual_pixel_hash, snapshot)); | 217 routing_id(), actual_pixel_hash, snapshot)); |
224 } | 218 } |
225 | 219 |
226 } // namespace content | 220 } // namespace content |
OLD | NEW |