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

Unified Diff: components/test_runner/web_view_test_client.cc

Issue 2386683002: Do not store TestRunner in WebFrameTestClient. (Closed)
Patch Set: s/test_runner_/test_runner()/ for one case pulled after rebasing. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/test_runner/web_view_test_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/web_view_test_client.cc
diff --git a/components/test_runner/web_view_test_client.cc b/components/test_runner/web_view_test_client.cc
index ce689deccda6fb11b7429a9a1e166f67a96a28de..6ca965fbf9f62709e6c68371740a6fc6c5661a24 100644
--- a/components/test_runner/web_view_test_client.cc
+++ b/components/test_runner/web_view_test_client.cc
@@ -13,6 +13,7 @@
#include "components/test_runner/event_sender.h"
#include "components/test_runner/mock_web_speech_recognizer.h"
#include "components/test_runner/test_common.h"
+#include "components/test_runner/test_interfaces.h"
#include "components/test_runner/test_runner.h"
#include "components/test_runner/test_runner_for_specific_view.h"
#include "components/test_runner/web_test_delegate.h"
@@ -28,11 +29,8 @@
namespace test_runner {
WebViewTestClient::WebViewTestClient(
- TestRunner* test_runner,
WebViewTestProxyBase* web_view_test_proxy_base)
- : test_runner_(test_runner),
- web_view_test_proxy_base_(web_view_test_proxy_base) {
- DCHECK(test_runner);
+ : web_view_test_proxy_base_(web_view_test_proxy_base) {
DCHECK(web_view_test_proxy_base);
}
@@ -43,7 +41,7 @@ void WebViewTestClient::startDragging(blink::WebLocalFrame* frame,
blink::WebDragOperationsMask mask,
const blink::WebImage& image,
const blink::WebPoint& point) {
- test_runner_->setDragImage(image);
+ test_runner()->setDragImage(image);
// When running a test, we need to fake a drag drop operation otherwise
// Windows waits for real mouse events to know when the drag is over.
@@ -54,7 +52,7 @@ void WebViewTestClient::startDragging(blink::WebLocalFrame* frame,
// expected by the layout tests. See EditingDelegate.m in DumpRenderTree.
void WebViewTestClient::didChangeContents() {
- if (test_runner_->shouldDumpEditingCallbacks())
+ if (test_runner()->shouldDumpEditingCallbacks())
delegate()->PrintMessage(
"EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n");
}
@@ -66,15 +64,15 @@ blink::WebView* WebViewTestClient::createView(
const blink::WebString& frame_name,
blink::WebNavigationPolicy policy,
bool suppress_opener) {
- if (test_runner_->shouldDumpNavigationPolicy()) {
+ if (test_runner()->shouldDumpNavigationPolicy()) {
delegate()->PrintMessage("Default policy for createView for '" +
URLDescription(request.url()) + "' is '" +
WebNavigationPolicyToString(policy) + "'\n");
}
- if (!test_runner_->canOpenWindows())
+ if (!test_runner()->canOpenWindows())
return nullptr;
- if (test_runner_->shouldDumpCreateView())
+ if (test_runner()->shouldDumpCreateView())
delegate()->PrintMessage(std::string("createView(") +
URLDescription(request.url()) + ")\n");
@@ -86,7 +84,7 @@ blink::WebView* WebViewTestClient::createView(
}
void WebViewTestClient::setStatusText(const blink::WebString& text) {
- if (!test_runner_->shouldDumpStatusCallbacks())
+ if (!test_runner()->shouldDumpStatusCallbacks())
return;
delegate()->PrintMessage(
std::string("UI DELEGATE STATUS CALLBACK: setStatusText:") +
@@ -109,7 +107,7 @@ void WebViewTestClient::showValidationMessage(
blink::WebTextDirection main_message_hint,
const blink::WebString& sub_message,
blink::WebTextDirection sub_message_hint) {
- if (test_runner_->is_web_platform_tests_mode())
+ if (test_runner()->is_web_platform_tests_mode())
return;
base::string16 wrapped_main_text = main_message;
@@ -138,11 +136,11 @@ void WebViewTestClient::showValidationMessage(
}
blink::WebSpeechRecognizer* WebViewTestClient::speechRecognizer() {
- return test_runner_->getMockWebSpeechRecognizer();
+ return test_runner()->getMockWebSpeechRecognizer();
}
blink::WebString WebViewTestClient::acceptLanguages() {
- return blink::WebString::fromUTF8(test_runner_->GetAcceptLanguages());
+ return blink::WebString::fromUTF8(test_runner()->GetAcceptLanguages());
}
WebTestDelegate* WebViewTestClient::delegate() {
@@ -150,7 +148,11 @@ WebTestDelegate* WebViewTestClient::delegate() {
}
void WebViewTestClient::didFocus() {
- test_runner_->SetFocus(web_view_test_proxy_base_->web_view(), true);
+ test_runner()->SetFocus(web_view_test_proxy_base_->web_view(), true);
+}
+
+TestRunner* WebViewTestClient::test_runner() {
+ return web_view_test_proxy_base_->test_interfaces()->GetTestRunner();
}
} // namespace test_runner
« no previous file with comments | « components/test_runner/web_view_test_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698