| 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" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 std::string DumpFramesAsText(WebFrame* frame, bool printing, bool recursive) { | 48 std::string DumpFramesAsText(WebFrame* frame, bool printing, bool recursive) { |
| 49 std::string result; | 49 std::string result; |
| 50 | 50 |
| 51 // Cannot do printed format for anything other than HTML. | 51 // Cannot do printed format for anything other than HTML. |
| 52 if (printing && !frame->document().isHTMLDocument()) | 52 if (printing && !frame->document().isHTMLDocument()) |
| 53 return std::string(); | 53 return std::string(); |
| 54 | 54 |
| 55 // Add header for all but the main frame. Skip emtpy frames. | 55 // Add header for all but the main frame. Skip emtpy frames. |
| 56 if (frame->parent() && !frame->document().documentElement().isNull()) { | 56 if (frame->parent() && !frame->document().documentElement().isNull()) { |
| 57 result.append("\n--------\nFrame: '"); | 57 result.append("\n--------\nFrame: '"); |
| 58 result.append(frame->name().utf8().data()); | 58 result.append(frame->uniqueName().utf8().data()); |
| 59 result.append("'\n--------\n"); | 59 result.append("'\n--------\n"); |
| 60 } | 60 } |
| 61 | 61 |
| 62 result.append( | 62 result.append( |
| 63 printing ? DumpDocumentPrintedText(frame) : DumpDocumentText(frame)); | 63 printing ? DumpDocumentPrintedText(frame) : DumpDocumentText(frame)); |
| 64 result.append("\n"); | 64 result.append("\n"); |
| 65 | 65 |
| 66 if (recursive) { | 66 if (recursive) { |
| 67 for (WebFrame* child = frame->firstChild(); child; | 67 for (WebFrame* child = frame->firstChild(); child; |
| 68 child = child->nextSibling()) { | 68 child = child->nextSibling()) { |
| 69 result.append(DumpFramesAsText(child, printing, recursive)); | 69 result.append(DumpFramesAsText(child, printing, recursive)); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 return result; | 72 return result; |
| 73 } | 73 } |
| 74 | 74 |
| 75 std::string DumpFrameScrollPosition(WebFrame* frame, bool recursive) { | 75 std::string DumpFrameScrollPosition(WebFrame* frame, bool recursive) { |
| 76 std::string result; | 76 std::string result; |
| 77 | 77 |
| 78 WebSize offset = frame->scrollOffset(); | 78 WebSize offset = frame->scrollOffset(); |
| 79 if (offset.width > 0 || offset.height > 0) { | 79 if (offset.width > 0 || offset.height > 0) { |
| 80 if (frame->parent()) { | 80 if (frame->parent()) { |
| 81 result.append( | 81 result.append( |
| 82 base::StringPrintf("frame '%s' ", frame->name().utf8().data())); | 82 base::StringPrintf("frame '%s' ", frame->uniqueName().utf8().data())); |
| 83 } | 83 } |
| 84 result.append( | 84 result.append( |
| 85 base::StringPrintf("scrolled to %d,%d\n", offset.width, offset.height)); | 85 base::StringPrintf("scrolled to %d,%d\n", offset.width, offset.height)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 if (recursive) { | 88 if (recursive) { |
| 89 for (WebFrame* child = frame->firstChild(); child; | 89 for (WebFrame* child = frame->firstChild(); child; |
| 90 child = child->nextSibling()) { | 90 child = child->nextSibling()) { |
| 91 result.append(DumpFrameScrollPosition(child, recursive)); | 91 result.append(DumpFrameScrollPosition(child, recursive)); |
| 92 } | 92 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |