Commit f5599092 authored by danakj's avatar danakj Committed by Commit Bot

Remove test_runner_support

This library provides access to RenderFrameImpl things but
WebFrameTestProxy is-a RenderFrameImpl and can be used instead.

R=creis@chromium.org

Bug: 866140
Change-Id: Iefdeef8de4fa70966119ac026f7be1b5c592a918
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2110071Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751804}
parent 9c6f62dc
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_TEST_TEST_RUNNER_SUPPORT_H_
#define CONTENT_PUBLIC_TEST_TEST_RUNNER_SUPPORT_H_
#include <string>
namespace blink {
class WebLocalFrame;
}
namespace content {
// Returns a frame name that can be used in the output of web tests
// (the name is derived from the frame's unique name).
std::string GetFrameNameForWebTests(blink::WebLocalFrame* frame);
} // namespace content
#endif // CONTENT_PUBLIC_TEST_TEST_RUNNER_SUPPORT_H_
...@@ -99,7 +99,6 @@ jumbo_component("test_runner") { ...@@ -99,7 +99,6 @@ jumbo_component("test_runner") {
"//content/shell:client_hints_util", "//content/shell:client_hints_util",
"//content/shell:web_test_switches", "//content/shell:web_test_switches",
"//content/shell:web_test_utils", "//content/shell:web_test_utils",
"//content/test:test_runner_support",
"//device/base/synchronization", "//device/base/synchronization",
"//device/gamepad/public/cpp:shared_with_blink", "//device/gamepad/public/cpp:shared_with_blink",
"//device/gamepad/public/mojom", "//device/gamepad/public/mojom",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "content/public/test/test_runner_support.h" #include "content/shell/test_runner/web_frame_test_proxy.h"
#include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/public/platform/web_size.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document.h"
...@@ -30,7 +30,8 @@ std::string DumpFrameHeaderIfNeeded(WebLocalFrame* frame) { ...@@ -30,7 +30,8 @@ std::string DumpFrameHeaderIfNeeded(WebLocalFrame* frame) {
// Add header for all but the main frame. Skip empty frames. // Add header for all but the main frame. Skip empty frames.
if (frame->Parent() && !frame->GetDocument().DocumentElement().IsNull()) { if (frame->Parent() && !frame->GetDocument().DocumentElement().IsNull()) {
result.append("\n--------\nFrame: '"); result.append("\n--------\nFrame: '");
result.append(content::GetFrameNameForWebTests(frame)); auto* frame_proxy = static_cast<WebFrameTestProxy*>(frame->Client());
result.append(frame_proxy->GetFrameNameForWebTests());
result.append("'\n--------\n"); result.append("'\n--------\n");
} }
...@@ -42,8 +43,9 @@ std::string DumpFrameScrollPosition(WebLocalFrame* frame) { ...@@ -42,8 +43,9 @@ std::string DumpFrameScrollPosition(WebLocalFrame* frame) {
WebSize offset = frame->GetScrollOffset(); WebSize offset = frame->GetScrollOffset();
if (offset.width > 0 || offset.height > 0) { if (offset.width > 0 || offset.height > 0) {
if (frame->Parent()) { if (frame->Parent()) {
result = std::string("frame '") + auto* frame_proxy = static_cast<WebFrameTestProxy*>(frame->Client());
content::GetFrameNameForWebTests(frame) + "' "; result = std::string("frame '") + frame_proxy->GetFrameNameForWebTests() +
"' ";
} }
base::StringAppendF(&result, "scrolled to %d,%d\n", offset.width, base::StringAppendF(&result, "scrolled to %d,%d\n", offset.width,
offset.height); offset.height);
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "content/public/common/referrer.h" #include "content/public/common/referrer.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/test/test_runner_support.h"
#include "content/shell/test_runner/accessibility_controller.h" #include "content/shell/test_runner/accessibility_controller.h"
#include "content/shell/test_runner/event_sender.h" #include "content/shell/test_runner/event_sender.h"
#include "content/shell/test_runner/mock_screen_orientation_client.h" #include "content/shell/test_runner/mock_screen_orientation_client.h"
...@@ -142,7 +141,8 @@ WebFrameTestClient::WebFrameTestClient(WebViewTestProxy* web_view_test_proxy, ...@@ -142,7 +141,8 @@ WebFrameTestClient::WebFrameTestClient(WebViewTestProxy* web_view_test_proxy,
std::string WebFrameTestClient::PrintFrameDescription( std::string WebFrameTestClient::PrintFrameDescription(
WebTestDelegate* delegate, WebTestDelegate* delegate,
blink::WebLocalFrame* frame) { blink::WebLocalFrame* frame) {
std::string name = content::GetFrameNameForWebTests(frame); auto* frame_proxy = static_cast<WebFrameTestProxy*>(frame->Client());
std::string name = frame_proxy->GetFrameNameForWebTests();
if (frame == frame->View()->MainFrame()) { if (frame == frame->View()->MainFrame()) {
DCHECK(name.empty()); DCHECK(name.empty());
return "main frame"; return "main frame";
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "content/shell/test_runner/web_frame_test_proxy.h" #include "content/shell/test_runner/web_frame_test_proxy.h"
#include "content/common/unique_name_helper.h"
#include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer.h"
#include "content/shell/test_runner/test_interfaces.h" #include "content/shell/test_runner/test_interfaces.h"
#include "content/shell/test_runner/test_runner.h" #include "content/shell/test_runner/test_runner.h"
...@@ -130,6 +131,10 @@ void WebFrameTestProxy::Initialize( ...@@ -130,6 +131,10 @@ void WebFrameTestProxy::Initialize(
new TestRenderFrameObserver(this, view_proxy_for_frame); // deletes itself. new TestRenderFrameObserver(this, view_proxy_for_frame); // deletes itself.
} }
std::string WebFrameTestProxy::GetFrameNameForWebTests() {
return content::UniqueNameHelper::ExtractStableNameForTesting(unique_name());
}
void WebFrameTestProxy::UpdateAllLifecyclePhasesAndCompositeForTesting() { void WebFrameTestProxy::UpdateAllLifecyclePhasesAndCompositeForTesting() {
if (!IsLocalRoot()) if (!IsLocalRoot())
return; return;
......
...@@ -38,6 +38,10 @@ class TEST_RUNNER_EXPORT WebFrameTestProxy : public content::RenderFrameImpl { ...@@ -38,6 +38,10 @@ class TEST_RUNNER_EXPORT WebFrameTestProxy : public content::RenderFrameImpl {
void Initialize(WebTestInterfaces* interfaces, void Initialize(WebTestInterfaces* interfaces,
content::RenderViewImpl* render_view_for_frame); content::RenderViewImpl* render_view_for_frame);
// Returns a frame name that can be used in the output of web tests
// (the name is derived from the frame's unique name).
std::string GetFrameNameForWebTests();
// RenderFrameImpl overrides. // RenderFrameImpl overrides.
void UpdateAllLifecyclePhasesAndCompositeForTesting() override; void UpdateAllLifecyclePhasesAndCompositeForTesting() override;
......
...@@ -775,27 +775,6 @@ static_library("web_test_support") { ...@@ -775,27 +775,6 @@ static_library("web_test_support") {
] ]
} }
static_library("test_runner_support") {
testonly = true
# See comment at the top of //content/BUILD.gn for why this is disabled in
# component builds.
if (is_component_build) {
check_includes = false
}
sources = [
"../public/test/test_runner_support.h",
"test_runner_support.cc",
]
deps = [
"//content/public/renderer",
"//content/renderer:for_content_tests",
"//third_party/blink/public:blink",
]
}
static_library("blink_test_browser_support") { static_library("blink_test_browser_support") {
testonly = true testonly = true
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/test/test_runner_support.h"
#include "content/common/unique_name_helper.h"
#include "content/renderer/render_frame_impl.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace content {
std::string GetFrameNameForWebTests(blink::WebLocalFrame* frame) {
std::string unique_name = RenderFrameImpl::FromWebFrame(frame)->unique_name();
return UniqueNameHelper::ExtractStableNameForTesting(unique_name);
}
} // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment