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

Side by Side Diff: content/shell/test_runner/layout_dump.cc

Issue 2714943004: Move unique name generation and tracking into //content. (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/test_runner/layout_dump.h" 5 #include "content/shell/test_runner/layout_dump.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "content/renderer/render_frame_impl.h"
9 #include "third_party/WebKit/public/platform/WebSize.h" 10 #include "third_party/WebKit/public/platform/WebSize.h"
10 #include "third_party/WebKit/public/platform/WebString.h" 11 #include "third_party/WebKit/public/platform/WebString.h"
11 #include "third_party/WebKit/public/web/WebDocument.h" 12 #include "third_party/WebKit/public/web/WebDocument.h"
12 #include "third_party/WebKit/public/web/WebElement.h" 13 #include "third_party/WebKit/public/web/WebElement.h"
13 #include "third_party/WebKit/public/web/WebFrame.h" 14 #include "third_party/WebKit/public/web/WebFrame.h"
14 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" 15 #include "third_party/WebKit/public/web/WebFrameContentDumper.h"
15 #include "third_party/WebKit/public/web/WebLocalFrame.h" 16 #include "third_party/WebKit/public/web/WebLocalFrame.h"
16 17
17 namespace test_runner { 18 namespace test_runner {
18 19
19 using blink::WebFrame; 20 using blink::WebFrame;
20 using blink::WebFrameContentDumper; 21 using blink::WebFrameContentDumper;
21 using blink::WebLocalFrame; 22 using blink::WebLocalFrame;
22 using blink::WebSize; 23 using blink::WebSize;
23 24
24 namespace { 25 namespace {
25 26
26 std::string DumpFrameHeaderIfNeeded(WebFrame* frame) { 27 std::string DumpFrameHeaderIfNeeded(WebLocalFrame* frame) {
27 std::string result; 28 std::string result;
28 29
29 // Add header for all but the main frame. Skip empty frames. 30 // Add header for all but the main frame. Skip empty frames.
30 if (frame->parent() && !frame->document().documentElement().isNull()) { 31 if (frame->parent() && !frame->document().documentElement().isNull()) {
31 result.append("\n--------\nFrame: '"); 32 result.append("\n--------\nFrame: '");
32 result.append(frame->uniqueName().utf8()); 33 result.append(content::RenderFrameImpl::FromWebFrame(frame)->unique_name());
33 result.append("'\n--------\n"); 34 result.append("'\n--------\n");
34 } 35 }
35 36
36 return result; 37 return result;
37 } 38 }
38 39
39 std::string DumpFrameScrollPosition(WebFrame* frame) { 40 std::string DumpFrameScrollPosition(WebLocalFrame* frame) {
40 std::string result; 41 std::string result;
41 WebSize offset = frame->getScrollOffset(); 42 WebSize offset = frame->getScrollOffset();
42 if (offset.width > 0 || offset.height > 0) { 43 if (offset.width > 0 || offset.height > 0) {
43 if (frame->parent()) { 44 if (frame->parent()) {
44 result = 45 result = std::string("frame '") +
45 std::string("frame '") + frame->uniqueName().utf8().data() + "' "; 46 content::RenderFrameImpl::FromWebFrame(frame)->unique_name() +
47 "' ";
46 } 48 }
47 base::StringAppendF(&result, "scrolled to %d,%d\n", offset.width, 49 base::StringAppendF(&result, "scrolled to %d,%d\n", offset.width,
48 offset.height); 50 offset.height);
49 } 51 }
50 52
51 return result; 53 return result;
52 } 54 }
53 55
54 } // namespace 56 } // namespace
55 57
(...skipping 27 matching lines...) Expand all
83 layout_text_behavior) 85 layout_text_behavior)
84 .utf8(); 86 .utf8();
85 } 87 }
86 result += DumpFrameScrollPosition(frame); 88 result += DumpFrameScrollPosition(frame);
87 } 89 }
88 90
89 return result; 91 return result;
90 } 92 }
91 93
92 } // namespace test_runner 94 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698