summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorabhishek.a21@samsung.com <abhishek.a21@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-11 19:47:55 +0000
committerabhishek.a21@samsung.com <abhishek.a21@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-11 19:49:41 +0000
commit8ed8bf43124192671eaf134d014f148a9dd12bea (patch)
tree2a0ef238685dea6d9af17bdb2e4c2bb4abf852fb /content
parent56291de8573cabae74d604bd0a8ac4def0b43311 (diff)
downloadchromium_src-8ed8bf43124192671eaf134d014f148a9dd12bea.zip
chromium_src-8ed8bf43124192671eaf134d014f148a9dd12bea.tar.gz
chromium_src-8ed8bf43124192671eaf134d014f148a9dd12bea.tar.bz2
TestInterfaces to chromium c++ style, rename methods and remove un-used header.
Changes: 1) Run clang-format through source and header files. 2) Rename data member variables to use unix_hacker_ style. 3) Rename methods to use CamelCase style. 4) Rename file name to test_interfaces. 5) Rename methods testRunner, eventSender and accessibilityController to GetTestRunner, GetEventSender and GetAccessibilityController respectively. 6) Removed un-used test_interfaces header. BUG=331299 Review URL: https://codereview.chromium.org/458723002 Cr-Commit-Position: refs/heads/master@{#288768} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/content_shell.gypi4
-rw-r--r--content/shell/BUILD.gn4
-rw-r--r--content/shell/renderer/test_runner/TestInterfaces.cpp203
-rw-r--r--content/shell/renderer/test_runner/TestInterfaces.h82
-rw-r--r--content/shell/renderer/test_runner/WebTestInterfaces.cpp18
-rw-r--r--content/shell/renderer/test_runner/event_sender.cc11
-rw-r--r--content/shell/renderer/test_runner/gamepad_controller.cc1
-rw-r--r--content/shell/renderer/test_runner/mock_web_media_stream_center.cc4
-rw-r--r--content/shell/renderer/test_runner/mock_web_midi_accessor.cc6
-rw-r--r--content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc38
-rw-r--r--content/shell/renderer/test_runner/test_interfaces.cc184
-rw-r--r--content/shell/renderer/test_runner/test_interfaces.h83
-rw-r--r--content/shell/renderer/test_runner/test_runner.cc8
-rw-r--r--content/shell/renderer/test_runner/web_frame_test_proxy.h4
-rw-r--r--content/shell/renderer/test_runner/web_test_proxy.cc145
15 files changed, 392 insertions, 403 deletions
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
index be5dcd8..111103f 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -176,8 +176,6 @@
'shell/renderer/shell_render_process_observer.h',
'shell/renderer/shell_render_view_observer.cc',
'shell/renderer/shell_render_view_observer.h',
- 'shell/renderer/test_runner/TestInterfaces.cpp',
- 'shell/renderer/test_runner/TestInterfaces.h',
'shell/renderer/test_runner/TestPlugin.cpp',
'shell/renderer/test_runner/TestPlugin.h',
'shell/renderer/test_runner/WebTask.cpp',
@@ -229,6 +227,8 @@
'shell/renderer/test_runner/spell_check_client.h',
'shell/renderer/test_runner/test_common.cc',
'shell/renderer/test_runner/test_common.h',
+ 'shell/renderer/test_runner/test_interfaces.cc',
+ 'shell/renderer/test_runner/test_interfaces.h',
'shell/renderer/test_runner/test_runner.cc',
'shell/renderer/test_runner/test_runner.h',
'shell/renderer/test_runner/text_input_controller.cc',
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn
index 7e18991..22df868 100644
--- a/content/shell/BUILD.gn
+++ b/content/shell/BUILD.gn
@@ -125,8 +125,6 @@ static_library("content_shell_lib") {
"renderer/shell_render_process_observer.h",
"renderer/shell_render_view_observer.cc",
"renderer/shell_render_view_observer.h",
- "renderer/test_runner/TestInterfaces.cpp",
- "renderer/test_runner/TestInterfaces.h",
"renderer/test_runner/TestPlugin.cpp",
"renderer/test_runner/TestPlugin.h",
"renderer/test_runner/WebTask.cpp",
@@ -178,6 +176,8 @@ static_library("content_shell_lib") {
"renderer/test_runner/spell_check_client.h",
"renderer/test_runner/test_common.cc",
"renderer/test_runner/test_common.h",
+ "renderer/test_runner/test_interfaces.cc",
+ "renderer/test_runner/test_interfaces.h",
"renderer/test_runner/test_runner.cc",
"renderer/test_runner/test_runner.h",
"renderer/test_runner/text_input_controller.cc",
diff --git a/content/shell/renderer/test_runner/TestInterfaces.cpp b/content/shell/renderer/test_runner/TestInterfaces.cpp
deleted file mode 100644
index 9f086d7..0000000
--- a/content/shell/renderer/test_runner/TestInterfaces.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright 2013 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/shell/renderer/test_runner/TestInterfaces.h"
-
-#include <string>
-
-#include "base/logging.h"
-#include "base/command_line.h"
-#include "base/strings/stringprintf.h"
-#include "content/shell/common/shell_switches.h"
-#include "content/shell/renderer/test_runner/accessibility_controller.h"
-#include "content/shell/renderer/test_runner/event_sender.h"
-#include "content/shell/renderer/test_runner/gamepad_controller.h"
-#include "content/shell/renderer/test_runner/text_input_controller.h"
-#include "content/shell/renderer/test_runner/test_runner.h"
-#include "content/shell/renderer/test_runner/web_test_proxy.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebURL.h"
-#include "third_party/WebKit/public/web/WebCache.h"
-#include "third_party/WebKit/public/web/WebKit.h"
-#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
-#include "third_party/WebKit/public/web/WebView.h"
-
-using namespace blink;
-
-namespace content {
-
-TestInterfaces::TestInterfaces()
- : m_accessibilityController(new AccessibilityController())
- , m_eventSender(new EventSender(this))
- , m_gamepadController(new GamepadController())
- , m_textInputController(new TextInputController())
- , m_testRunner(new TestRunner(this))
- , m_delegate(0)
-{
- blink::setLayoutTestMode(true);
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableFontAntialiasing))
- blink::setFontAntialiasingEnabledForTest(true);
-
- // NOTE: please don't put feature specific enable flags here,
- // instead add them to RuntimeEnabledFeatures.in
-
- resetAll();
-}
-
-TestInterfaces::~TestInterfaces()
-{
- m_accessibilityController->SetWebView(0);
- m_eventSender->SetWebView(0);
- // m_gamepadController doesn't depend on WebView.
- m_textInputController->SetWebView(NULL);
- m_testRunner->SetWebView(0, 0);
-
- m_accessibilityController->SetDelegate(0);
- m_eventSender->SetDelegate(0);
- m_gamepadController->SetDelegate(0);
- // m_textInputController doesn't depend on WebTestDelegate.
- m_testRunner->SetDelegate(0);
-}
-
-void TestInterfaces::setWebView(WebView* webView, WebTestProxyBase* proxy)
-{
- m_proxy = proxy;
- m_accessibilityController->SetWebView(webView);
- m_eventSender->SetWebView(webView);
- // m_gamepadController doesn't depend on WebView.
- m_textInputController->SetWebView(webView);
- m_testRunner->SetWebView(webView, proxy);
-}
-
-void TestInterfaces::setDelegate(WebTestDelegate* delegate)
-{
- m_accessibilityController->SetDelegate(delegate);
- m_eventSender->SetDelegate(delegate);
- m_gamepadController->SetDelegate(delegate);
- // m_textInputController doesn't depend on WebTestDelegate.
- m_testRunner->SetDelegate(delegate);
- m_delegate = delegate;
-}
-
-void TestInterfaces::bindTo(WebFrame* frame)
-{
- m_accessibilityController->Install(frame);
- m_eventSender->Install(frame);
- m_gamepadController->Install(frame);
- m_textInputController->Install(frame);
- m_testRunner->Install(frame);
-}
-
-void TestInterfaces::resetTestHelperControllers()
-{
- m_accessibilityController->Reset();
- m_eventSender->Reset();
- m_gamepadController->Reset();
- // m_textInputController doesn't have any state to reset.
- WebCache::clear();
-}
-
-void TestInterfaces::resetAll()
-{
- resetTestHelperControllers();
- m_testRunner->Reset();
-}
-
-void TestInterfaces::setTestIsRunning(bool running)
-{
- m_testRunner->SetTestIsRunning(running);
-}
-
-void TestInterfaces::configureForTestWithURL(const WebURL& testURL, bool generatePixels)
-{
- std::string spec = GURL(testURL).spec();
- m_testRunner->setShouldGeneratePixelResults(generatePixels);
- if (spec.find("loading/") != std::string::npos)
- m_testRunner->setShouldDumpFrameLoadCallbacks(true);
- if (spec.find("/dumpAsText/") != std::string::npos) {
- m_testRunner->setShouldDumpAsText(true);
- m_testRunner->setShouldGeneratePixelResults(false);
- }
- if (spec.find("/inspector/") != std::string::npos
- || spec.find("/inspector-enabled/") != std::string::npos)
- m_testRunner->clearDevToolsLocalStorage();
- if (spec.find("/inspector/") != std::string::npos) {
- // Subfolder name determines default panel to open.
- std::string settings = "";
- std::string test_path = spec.substr(spec.find("/inspector/") + 11);
- size_t slash_index = test_path.find("/");
- if (slash_index != std::string::npos) {
- settings = base::StringPrintf(
- "{\"lastActivePanel\":\"\\\"%s\\\"\"}",
- test_path.substr(0, slash_index).c_str());
- }
- m_testRunner->showDevTools(settings, std::string());
- }
- if (spec.find("/viewsource/") != std::string::npos) {
- m_testRunner->setShouldEnableViewSource(true);
- m_testRunner->setShouldGeneratePixelResults(false);
- m_testRunner->setShouldDumpAsMarkup(true);
- }
-}
-
-void TestInterfaces::windowOpened(WebTestProxyBase* proxy)
-{
- m_windowList.push_back(proxy);
-}
-
-void TestInterfaces::windowClosed(WebTestProxyBase* proxy)
-{
- std::vector<WebTestProxyBase*>::iterator pos = std::find(m_windowList.begin(), m_windowList.end(), proxy);
- if (pos == m_windowList.end()) {
- NOTREACHED();
- return;
- }
- m_windowList.erase(pos);
-}
-
-AccessibilityController* TestInterfaces::accessibilityController()
-{
- return m_accessibilityController.get();
-}
-
-EventSender* TestInterfaces::eventSender()
-{
- return m_eventSender.get();
-}
-
-TestRunner* TestInterfaces::testRunner()
-{
- return m_testRunner.get();
-}
-
-WebTestDelegate* TestInterfaces::delegate()
-{
- return m_delegate;
-}
-
-WebTestProxyBase* TestInterfaces::proxy()
-{
- return m_proxy;
-}
-
-const std::vector<WebTestProxyBase*>& TestInterfaces::windowList()
-{
- return m_windowList;
-}
-
-WebThemeEngine* TestInterfaces::themeEngine()
-{
- if (!m_testRunner->UseMockTheme())
- return 0;
-#if defined(__APPLE__)
- if (!m_themeEngine.get())
- m_themeEngine.reset(new MockWebThemeEngineMac());
-#else
- if (!m_themeEngine.get())
- m_themeEngine.reset(new MockWebThemeEngine());
-#endif
- return m_themeEngine.get();
-}
-
-} // namespace content
diff --git a/content/shell/renderer/test_runner/TestInterfaces.h b/content/shell/renderer/test_runner/TestInterfaces.h
deleted file mode 100644
index b203476..0000000
--- a/content/shell/renderer/test_runner/TestInterfaces.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2013 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_SHELL_RENDERER_TEST_RUNNER_TESTINTERFACES_H_
-#define CONTENT_SHELL_RENDERER_TEST_RUNNER_TESTINTERFACES_H_
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "third_party/WebKit/public/platform/WebNonCopyable.h"
-
-#if defined(__APPLE__)
-#include "content/shell/renderer/test_runner/mock_web_theme_engine_mac.h"
-#else
-#include "content/shell/renderer/test_runner/mock_web_theme_engine.h"
-#endif
-
-namespace blink {
-class WebFrame;
-class WebThemeEngine;
-class WebURL;
-class WebView;
-}
-
-namespace content {
-
-class AccessibilityController;
-class EventSender;
-class GamepadController;
-class TestRunner;
-class TextInputController;
-class WebTestDelegate;
-class WebTestProxyBase;
-
-class TestInterfaces {
-public:
- TestInterfaces();
- ~TestInterfaces();
-
- void setWebView(blink::WebView*, WebTestProxyBase*);
- void setDelegate(WebTestDelegate*);
- void bindTo(blink::WebFrame*);
- void resetTestHelperControllers();
- void resetAll();
- void setTestIsRunning(bool);
- void configureForTestWithURL(const blink::WebURL&, bool generatePixels);
-
- void windowOpened(WebTestProxyBase*);
- void windowClosed(WebTestProxyBase*);
-
- AccessibilityController* accessibilityController();
- EventSender* eventSender();
- TestRunner* testRunner();
- WebTestDelegate* delegate();
- WebTestProxyBase* proxy();
- const std::vector<WebTestProxyBase*>& windowList();
- blink::WebThemeEngine* themeEngine();
-
-private:
- scoped_ptr<AccessibilityController> m_accessibilityController;
- scoped_ptr<EventSender> m_eventSender;
- scoped_ptr<GamepadController> m_gamepadController;
- scoped_ptr<TextInputController> m_textInputController;
- scoped_ptr<TestRunner> m_testRunner;
- WebTestDelegate* m_delegate;
- WebTestProxyBase* m_proxy;
-
- std::vector<WebTestProxyBase*> m_windowList;
-#if defined(__APPLE__)
- scoped_ptr<MockWebThemeEngineMac> m_themeEngine;
-#else
- scoped_ptr<MockWebThemeEngine> m_themeEngine;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(TestInterfaces);
-};
-
-} // namespace content
-
-#endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_TESTINTERFACES_H_
diff --git a/content/shell/renderer/test_runner/WebTestInterfaces.cpp b/content/shell/renderer/test_runner/WebTestInterfaces.cpp
index 01475d8..513cc59 100644
--- a/content/shell/renderer/test_runner/WebTestInterfaces.cpp
+++ b/content/shell/renderer/test_runner/WebTestInterfaces.cpp
@@ -4,11 +4,11 @@
#include "content/shell/renderer/test_runner/WebTestInterfaces.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/mock_web_audio_device.h"
#include "content/shell/renderer/test_runner/mock_web_media_stream_center.h"
#include "content/shell/renderer/test_runner/mock_web_midi_accessor.h"
#include "content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.h"
+#include "content/shell/renderer/test_runner/test_interfaces.h"
#include "content/shell/renderer/test_runner/test_runner.h"
using namespace blink;
@@ -26,42 +26,42 @@ WebTestInterfaces::~WebTestInterfaces()
void WebTestInterfaces::setWebView(WebView* webView, WebTestProxyBase* proxy)
{
- m_interfaces->setWebView(webView, proxy);
+ m_interfaces->SetWebView(webView, proxy);
}
void WebTestInterfaces::setDelegate(WebTestDelegate* delegate)
{
- m_interfaces->setDelegate(delegate);
+ m_interfaces->SetDelegate(delegate);
}
void WebTestInterfaces::bindTo(WebFrame* frame)
{
- m_interfaces->bindTo(frame);
+ m_interfaces->BindTo(frame);
}
void WebTestInterfaces::resetAll()
{
- m_interfaces->resetAll();
+ m_interfaces->ResetAll();
}
void WebTestInterfaces::setTestIsRunning(bool running)
{
- m_interfaces->setTestIsRunning(running);
+ m_interfaces->SetTestIsRunning(running);
}
void WebTestInterfaces::configureForTestWithURL(const WebURL& testURL, bool generatePixels)
{
- m_interfaces->configureForTestWithURL(testURL, generatePixels);
+ m_interfaces->ConfigureForTestWithURL(testURL, generatePixels);
}
WebTestRunner* WebTestInterfaces::testRunner()
{
- return m_interfaces->testRunner();
+ return m_interfaces->GetTestRunner();
}
WebThemeEngine* WebTestInterfaces::themeEngine()
{
- return m_interfaces->themeEngine();
+ return m_interfaces->GetThemeEngine();
}
TestInterfaces* WebTestInterfaces::testInterfaces()
diff --git a/content/shell/renderer/test_runner/event_sender.cc b/content/shell/renderer/test_runner/event_sender.cc
index ccdf6e9..f4cf310 100644
--- a/content/shell/renderer/test_runner/event_sender.cc
+++ b/content/shell/renderer/test_runner/event_sender.cc
@@ -8,9 +8,9 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "content/public/common/page_zoom.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "content/shell/renderer/test_runner/mock_spell_check.h"
+#include "content/shell/renderer/test_runner/test_interfaces.h"
#include "content/shell/renderer/test_runner/web_test_proxy.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
@@ -1426,7 +1426,8 @@ void EventSender::TextZoomOut() {
}
void EventSender::ZoomPageIn() {
- const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList();
+ const std::vector<WebTestProxyBase*>& window_list =
+ interfaces_->GetWindowList();
for (size_t i = 0; i < window_list.size(); ++i) {
window_list.at(i)->GetWebView()->setZoomLevel(
@@ -1435,7 +1436,8 @@ void EventSender::ZoomPageIn() {
}
void EventSender::ZoomPageOut() {
- const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList();
+ const std::vector<WebTestProxyBase*>& window_list =
+ interfaces_->GetWindowList();
for (size_t i = 0; i < window_list.size(); ++i) {
window_list.at(i)->GetWebView()->setZoomLevel(
@@ -1444,7 +1446,8 @@ void EventSender::ZoomPageOut() {
}
void EventSender::SetPageZoomFactor(double zoom_factor) {
- const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList();
+ const std::vector<WebTestProxyBase*>& window_list =
+ interfaces_->GetWindowList();
for (size_t i = 0; i < window_list.size(); ++i) {
window_list.at(i)->GetWebView()->setZoomLevel(
diff --git a/content/shell/renderer/test_runner/gamepad_controller.cc b/content/shell/renderer/test_runner/gamepad_controller.cc
index ff33402..2fa2b36 100644
--- a/content/shell/renderer/test_runner/gamepad_controller.cc
+++ b/content/shell/renderer/test_runner/gamepad_controller.cc
@@ -4,7 +4,6 @@
#include "content/shell/renderer/test_runner/gamepad_controller.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "gin/arguments.h"
#include "gin/handle.h"
diff --git a/content/shell/renderer/test_runner/mock_web_media_stream_center.cc b/content/shell/renderer/test_runner/mock_web_media_stream_center.cc
index 7b3432c..7666482 100644
--- a/content/shell/renderer/test_runner/mock_web_media_stream_center.cc
+++ b/content/shell/renderer/test_runner/mock_web_media_stream_center.cc
@@ -5,8 +5,8 @@
#include "content/shell/renderer/test_runner/mock_web_media_stream_center.h"
#include "base/logging.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
+#include "content/shell/renderer/test_runner/test_interfaces.h"
#include "third_party/WebKit/public/platform/WebAudioDestinationConsumer.h"
#include "third_party/WebKit/public/platform/WebAudioSourceProvider.h"
#include "third_party/WebKit/public/platform/WebMediaStream.h"
@@ -140,7 +140,7 @@ void MockWebMediaStreamCenter::didCreateMediaStream(
delete consumer;
}
}
- interfaces_->delegate()->postTask(new NewTrackTask(this, stream));
+ interfaces_->GetDelegate()->postTask(new NewTrackTask(this, stream));
}
blink::WebAudioSourceProvider*
diff --git a/content/shell/renderer/test_runner/mock_web_midi_accessor.cc b/content/shell/renderer/test_runner/mock_web_midi_accessor.cc
index 90f14c3..362c287 100644
--- a/content/shell/renderer/test_runner/mock_web_midi_accessor.cc
+++ b/content/shell/renderer/test_runner/mock_web_midi_accessor.cc
@@ -4,8 +4,8 @@
#include "content/shell/renderer/test_runner/mock_web_midi_accessor.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
+#include "content/shell/renderer/test_runner/test_interfaces.h"
#include "content/shell/renderer/test_runner/test_runner.h"
#include "content/shell/renderer/test_runner/web_test_runner.h"
#include "third_party/WebKit/public/platform/WebMIDIAccessorClient.h"
@@ -54,8 +54,8 @@ void MockWebMIDIAccessor::startSession() {
"MockOutputManufacturer",
"MockOutputName",
"MockOutputVersion");
- interfaces_->delegate()->postTask(new DidStartSessionTask(
- this, client_, interfaces_->testRunner()->midiAccessorResult()));
+ interfaces_->GetDelegate()->postTask(new DidStartSessionTask(
+ this, client_, interfaces_->GetTestRunner()->midiAccessorResult()));
}
} // namespace content
diff --git a/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc b/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc
index 1a610dc..52236d9 100644
--- a/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc
+++ b/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc
@@ -4,11 +4,11 @@
#include "content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "content/shell/renderer/test_runner/mock_constraints.h"
#include "content/shell/renderer/test_runner/mock_webrtc_data_channel_handler.h"
#include "content/shell/renderer/test_runner/mock_webrtc_dtmf_sender_handler.h"
+#include "content/shell/renderer/test_runner/test_interfaces.h"
#include "third_party/WebKit/public/platform/WebMediaConstraints.h"
#include "third_party/WebKit/public/platform/WebMediaStream.h"
#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
@@ -160,7 +160,7 @@ bool MockWebRTCPeerConnectionHandler::initialize(
const WebRTCConfiguration& configuration,
const WebMediaConstraints& constraints) {
if (MockConstraints::VerifyConstraints(constraints)) {
- interfaces_->delegate()->postTask(new RTCPeerConnectionStateTask(
+ interfaces_->GetDelegate()->postTask(new RTCPeerConnectionStateTask(
this,
client_,
WebRTCPeerConnectionHandlerClient::ICEConnectionStateCompleted,
@@ -179,18 +179,18 @@ void MockWebRTCPeerConnectionHandler::createOffer(
should_succeed == "true") {
WebRTCSessionDescription session_description;
session_description.initialize("offer", "local");
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCSessionDescriptionRequestSuccededTask(
this, request, session_description));
} else
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCSessionDescriptionRequestFailedTask(this, request));
}
void MockWebRTCPeerConnectionHandler::createOffer(
const WebRTCSessionDescriptionRequest& request,
const blink::WebRTCOfferOptions& options) {
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCSessionDescriptionRequestFailedTask(this, request));
}
@@ -200,11 +200,11 @@ void MockWebRTCPeerConnectionHandler::createAnswer(
if (!remote_description_.isNull()) {
WebRTCSessionDescription session_description;
session_description.initialize("answer", "local");
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCSessionDescriptionRequestSuccededTask(
this, request, session_description));
} else
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCSessionDescriptionRequestFailedTask(this, request));
}
@@ -213,10 +213,10 @@ void MockWebRTCPeerConnectionHandler::setLocalDescription(
const WebRTCSessionDescription& local_description) {
if (!local_description.isNull() && local_description.sdp() == "local") {
local_description_ = local_description;
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCVoidRequestTask(this, request, true));
} else
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCVoidRequestTask(this, request, false));
}
@@ -225,10 +225,10 @@ void MockWebRTCPeerConnectionHandler::setRemoteDescription(
const WebRTCSessionDescription& remote_description) {
if (!remote_description.isNull() && remote_description.sdp() == "remote") {
remote_description_ = remote_description;
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCVoidRequestTask(this, request, true));
} else
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCVoidRequestTask(this, request, false));
}
@@ -255,7 +255,7 @@ bool MockWebRTCPeerConnectionHandler::addICECandidate(
bool MockWebRTCPeerConnectionHandler::addICECandidate(
const WebRTCVoidRequest& request,
const WebRTCICECandidate& ice_candidate) {
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCVoidRequestTask(this, request, true));
return true;
}
@@ -277,7 +277,8 @@ void MockWebRTCPeerConnectionHandler::removeStream(
void MockWebRTCPeerConnectionHandler::getStats(
const WebRTCStatsRequest& request) {
WebRTCStatsResponse response = request.createResponse();
- double current_date = interfaces_->delegate()->getCurrentTimeInMillisecond();
+ double current_date =
+ interfaces_->GetDelegate()->getCurrentTimeInMillisecond();
if (request.hasSelector()) {
// FIXME: There is no check that the fetched values are valid.
size_t report_index =
@@ -292,22 +293,23 @@ void MockWebRTCPeerConnectionHandler::getStats(
response.addStatistic(report_index, "type", "video");
}
}
- interfaces_->delegate()->postTask(
+ interfaces_->GetDelegate()->postTask(
new RTCStatsRequestSucceededTask(this, request, response));
}
WebRTCDataChannelHandler* MockWebRTCPeerConnectionHandler::createDataChannel(
const WebString& label,
const blink::WebRTCDataChannelInit& init) {
- interfaces_->delegate()->postTask(
- new RemoteDataChannelTask(this, client_, interfaces_->delegate()));
+ interfaces_->GetDelegate()->postTask(
+ new RemoteDataChannelTask(this, client_, interfaces_->GetDelegate()));
- return new MockWebRTCDataChannelHandler(label, init, interfaces_->delegate());
+ return new MockWebRTCDataChannelHandler(
+ label, init, interfaces_->GetDelegate());
}
WebRTCDTMFSenderHandler* MockWebRTCPeerConnectionHandler::createDTMFSender(
const WebMediaStreamTrack& track) {
- return new MockWebRTCDTMFSenderHandler(track, interfaces_->delegate());
+ return new MockWebRTCDTMFSenderHandler(track, interfaces_->GetDelegate());
}
void MockWebRTCPeerConnectionHandler::stop() {
diff --git a/content/shell/renderer/test_runner/test_interfaces.cc b/content/shell/renderer/test_runner/test_interfaces.cc
new file mode 100644
index 0000000..38b675f
--- /dev/null
+++ b/content/shell/renderer/test_runner/test_interfaces.cc
@@ -0,0 +1,184 @@
+// Copyright 2014 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/shell/renderer/test_runner/test_interfaces.h"
+
+#include <string>
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
+#include "content/shell/common/shell_switches.h"
+#include "content/shell/renderer/test_runner/accessibility_controller.h"
+#include "content/shell/renderer/test_runner/event_sender.h"
+#include "content/shell/renderer/test_runner/gamepad_controller.h"
+#include "content/shell/renderer/test_runner/test_runner.h"
+#include "content/shell/renderer/test_runner/text_input_controller.h"
+#include "content/shell/renderer/test_runner/web_test_proxy.h"
+#include "third_party/WebKit/public/platform/WebURL.h"
+#include "third_party/WebKit/public/web/WebCache.h"
+#include "third_party/WebKit/public/web/WebKit.h"
+#include "third_party/WebKit/public/web/WebView.h"
+
+namespace content {
+
+TestInterfaces::TestInterfaces()
+ : accessibility_controller_(new AccessibilityController()),
+ event_sender_(new EventSender(this)),
+ gamepad_controller_(new GamepadController()),
+ text_input_controller_(new TextInputController()),
+ test_runner_(new TestRunner(this)),
+ delegate_(0) {
+ blink::setLayoutTestMode(true);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableFontAntialiasing))
+ blink::setFontAntialiasingEnabledForTest(true);
+
+ // NOTE: please don't put feature specific enable flags here,
+ // instead add them to RuntimeEnabledFeatures.in
+
+ ResetAll();
+}
+
+TestInterfaces::~TestInterfaces() {
+ accessibility_controller_->SetWebView(0);
+ event_sender_->SetWebView(0);
+ // gamepad_controller_ doesn't depend on WebView.
+ text_input_controller_->SetWebView(NULL);
+ test_runner_->SetWebView(0, 0);
+
+ accessibility_controller_->SetDelegate(0);
+ event_sender_->SetDelegate(0);
+ gamepad_controller_->SetDelegate(0);
+ // text_input_controller_ doesn't depend on WebTestDelegate.
+ test_runner_->SetDelegate(0);
+}
+
+void TestInterfaces::SetWebView(blink::WebView* web_view,
+ WebTestProxyBase* proxy) {
+ proxy_ = proxy;
+ accessibility_controller_->SetWebView(web_view);
+ event_sender_->SetWebView(web_view);
+ // gamepad_controller_ doesn't depend on WebView.
+ text_input_controller_->SetWebView(web_view);
+ test_runner_->SetWebView(web_view, proxy);
+}
+
+void TestInterfaces::SetDelegate(WebTestDelegate* delegate) {
+ accessibility_controller_->SetDelegate(delegate);
+ event_sender_->SetDelegate(delegate);
+ gamepad_controller_->SetDelegate(delegate);
+ // text_input_controller_ doesn't depend on WebTestDelegate.
+ test_runner_->SetDelegate(delegate);
+ delegate_ = delegate;
+}
+
+void TestInterfaces::BindTo(blink::WebFrame* frame) {
+ accessibility_controller_->Install(frame);
+ event_sender_->Install(frame);
+ gamepad_controller_->Install(frame);
+ text_input_controller_->Install(frame);
+ test_runner_->Install(frame);
+}
+
+void TestInterfaces::ResetTestHelperControllers() {
+ accessibility_controller_->Reset();
+ event_sender_->Reset();
+ gamepad_controller_->Reset();
+ // text_input_controller_ doesn't have any state to reset.
+ blink::WebCache::clear();
+}
+
+void TestInterfaces::ResetAll() {
+ ResetTestHelperControllers();
+ test_runner_->Reset();
+}
+
+void TestInterfaces::SetTestIsRunning(bool running) {
+ test_runner_->SetTestIsRunning(running);
+}
+
+void TestInterfaces::ConfigureForTestWithURL(const blink::WebURL& test_url,
+ bool generate_pixels) {
+ std::string spec = GURL(test_url).spec();
+ test_runner_->setShouldGeneratePixelResults(generate_pixels);
+ if (spec.find("loading/") != std::string::npos)
+ test_runner_->setShouldDumpFrameLoadCallbacks(true);
+ if (spec.find("/dumpAsText/") != std::string::npos) {
+ test_runner_->setShouldDumpAsText(true);
+ test_runner_->setShouldGeneratePixelResults(false);
+ }
+ if (spec.find("/inspector/") != std::string::npos ||
+ spec.find("/inspector-enabled/") != std::string::npos)
+ test_runner_->clearDevToolsLocalStorage();
+ if (spec.find("/inspector/") != std::string::npos) {
+ // Subfolder name determines default panel to open.
+ std::string settings = "";
+ std::string test_path = spec.substr(spec.find("/inspector/") + 11);
+ size_t slash_index = test_path.find("/");
+ if (slash_index != std::string::npos) {
+ settings = base::StringPrintf("{\"lastActivePanel\":\"\\\"%s\\\"\"}",
+ test_path.substr(0, slash_index).c_str());
+ }
+ test_runner_->showDevTools(settings, std::string());
+ }
+ if (spec.find("/viewsource/") != std::string::npos) {
+ test_runner_->setShouldEnableViewSource(true);
+ test_runner_->setShouldGeneratePixelResults(false);
+ test_runner_->setShouldDumpAsMarkup(true);
+ }
+}
+
+void TestInterfaces::WindowOpened(WebTestProxyBase* proxy) {
+ window_list_.push_back(proxy);
+}
+
+void TestInterfaces::WindowClosed(WebTestProxyBase* proxy) {
+ std::vector<WebTestProxyBase*>::iterator pos =
+ std::find(window_list_.begin(), window_list_.end(), proxy);
+ if (pos == window_list_.end()) {
+ NOTREACHED();
+ return;
+ }
+ window_list_.erase(pos);
+}
+
+AccessibilityController* TestInterfaces::GetAccessibilityController() {
+ return accessibility_controller_.get();
+}
+
+EventSender* TestInterfaces::GetEventSender() {
+ return event_sender_.get();
+}
+
+TestRunner* TestInterfaces::GetTestRunner() {
+ return test_runner_.get();
+}
+
+WebTestDelegate* TestInterfaces::GetDelegate() {
+ return delegate_;
+}
+
+WebTestProxyBase* TestInterfaces::GetProxy() {
+ return proxy_;
+}
+
+const std::vector<WebTestProxyBase*>& TestInterfaces::GetWindowList() {
+ return window_list_;
+}
+
+blink::WebThemeEngine* TestInterfaces::GetThemeEngine() {
+ if (!test_runner_->UseMockTheme())
+ return 0;
+#if defined(OS_MACOSX)
+ if (!theme_engine_.get())
+ theme_engine_.reset(new MockWebThemeEngineMac());
+#else
+ if (!theme_engine_.get())
+ theme_engine_.reset(new MockWebThemeEngine());
+#endif
+ return theme_engine_.get();
+}
+
+} // namespace content
diff --git a/content/shell/renderer/test_runner/test_interfaces.h b/content/shell/renderer/test_runner/test_interfaces.h
new file mode 100644
index 0000000..2edfda0
--- /dev/null
+++ b/content/shell/renderer/test_runner/test_interfaces.h
@@ -0,0 +1,83 @@
+// Copyright 2014 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_SHELL_RENDERER_TEST_RUNNER_TEST_INTERFACES_H_
+#define CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_INTERFACES_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "third_party/WebKit/public/platform/WebNonCopyable.h"
+
+#if defined(OS_MACOSX)
+#include "content/shell/renderer/test_runner/mock_web_theme_engine_mac.h"
+#else
+#include "content/shell/renderer/test_runner/mock_web_theme_engine.h"
+#endif
+
+namespace blink {
+class WebFrame;
+class WebThemeEngine;
+class WebURL;
+class WebView;
+}
+
+namespace content {
+
+class AccessibilityController;
+class EventSender;
+class GamepadController;
+class TestRunner;
+class TextInputController;
+class WebTestDelegate;
+class WebTestProxyBase;
+
+class TestInterfaces {
+ public:
+ TestInterfaces();
+ ~TestInterfaces();
+
+ void SetWebView(blink::WebView* web_view, WebTestProxyBase* proxy);
+ void SetDelegate(WebTestDelegate* delegate);
+ void BindTo(blink::WebFrame* frame);
+ void ResetTestHelperControllers();
+ void ResetAll();
+ void SetTestIsRunning(bool running);
+ void ConfigureForTestWithURL(const blink::WebURL& test_url,
+ bool generate_pixels);
+
+ void WindowOpened(WebTestProxyBase* proxy);
+ void WindowClosed(WebTestProxyBase* proxy);
+
+ AccessibilityController* GetAccessibilityController();
+ EventSender* GetEventSender();
+ TestRunner* GetTestRunner();
+ WebTestDelegate* GetDelegate();
+ WebTestProxyBase* GetProxy();
+ const std::vector<WebTestProxyBase*>& GetWindowList();
+ blink::WebThemeEngine* GetThemeEngine();
+
+ private:
+ scoped_ptr<AccessibilityController> accessibility_controller_;
+ scoped_ptr<EventSender> event_sender_;
+ scoped_ptr<GamepadController> gamepad_controller_;
+ scoped_ptr<TextInputController> text_input_controller_;
+ scoped_ptr<TestRunner> test_runner_;
+ WebTestDelegate* delegate_;
+ WebTestProxyBase* proxy_;
+
+ std::vector<WebTestProxyBase*> window_list_;
+#if defined(OS_MACOSX)
+ scoped_ptr<MockWebThemeEngineMac> theme_engine_;
+#else
+ scoped_ptr<MockWebThemeEngine> theme_engine_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(TestInterfaces);
+};
+
+} // namespace content
+
+#endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_INTERFACES_H_
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc
index 2c58b3a..1569e57 100644
--- a/content/shell/renderer/test_runner/test_runner.cc
+++ b/content/shell/renderer/test_runner/test_runner.cc
@@ -8,11 +8,11 @@
#include "base/logging.h"
#include "content/shell/common/test_runner/test_preferences.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "content/shell/renderer/test_runner/mock_web_push_client.h"
#include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h"
#include "content/shell/renderer/test_runner/notification_presenter.h"
+#include "content/shell/renderer/test_runner/test_interfaces.h"
#include "content/shell/renderer/test_runner/web_permissions.h"
#include "content/shell/renderer/test_runner/web_test_proxy.h"
#include "gin/arguments.h"
@@ -2076,7 +2076,7 @@ void TestRunner::WaitForPolicyDelegate() {
}
int TestRunner::WindowCount() {
- return test_interfaces_->windowList().size();
+ return test_interfaces_->GetWindowList().size();
}
void TestRunner::SetCloseRemainingWindowsWhenComplete(
@@ -2085,7 +2085,7 @@ void TestRunner::SetCloseRemainingWindowsWhenComplete(
}
void TestRunner::ResetTestHelperControllers() {
- test_interfaces_->resetTestHelperControllers();
+ test_interfaces_->ResetTestHelperControllers();
}
void TestRunner::SetTabKeyCyclesThroughElements(
@@ -2744,7 +2744,7 @@ void TestRunner::SetMIDIAccessorResult(bool result) {
void TestRunner::SetMIDISysexPermission(bool value) {
const std::vector<WebTestProxyBase*>& windowList =
- test_interfaces_->windowList();
+ test_interfaces_->GetWindowList();
for (unsigned i = 0; i < windowList.size(); ++i)
windowList.at(i)->GetMIDIClientMock()->setSysexPermission(value);
}
diff --git a/content/shell/renderer/test_runner/web_frame_test_proxy.h b/content/shell/renderer/test_runner/web_frame_test_proxy.h
index a280199..1a75dd4 100644
--- a/content/shell/renderer/test_runner/web_frame_test_proxy.h
+++ b/content/shell/renderer/test_runner/web_frame_test_proxy.h
@@ -6,9 +6,9 @@
#define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_
#include "base/basictypes.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "content/shell/renderer/test_runner/mock_screen_orientation_client.h"
+#include "content/shell/renderer/test_runner/test_interfaces.h"
#include "content/shell/renderer/test_runner/test_runner.h"
#include "content/shell/renderer/test_runner/web_test_proxy.h"
#include "content/test/test_media_stream_renderer_factory.h"
@@ -169,7 +169,7 @@ class WebFrameTestProxy : public Base {
const blink::WebString& message) {
base_proxy_->delegate_->printMessage(std::string("CONFIRM NAVIGATION: ") +
message.utf8().data() + "\n");
- return !base_proxy_->test_interfaces_->testRunner()
+ return !base_proxy_->test_interfaces_->GetTestRunner()
->shouldStayOnPageAfterHandlingBeforeUnload();
}
diff --git a/content/shell/renderer/test_runner/web_test_proxy.cc b/content/shell/renderer/test_runner/web_test_proxy.cc
index d4524ee..7e36976 100644
--- a/content/shell/renderer/test_runner/web_test_proxy.cc
+++ b/content/shell/renderer/test_runner/web_test_proxy.cc
@@ -10,7 +10,6 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/TestPlugin.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "content/shell/renderer/test_runner/WebTestInterfaces.h"
@@ -22,6 +21,7 @@
#include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h"
#include "content/shell/renderer/test_runner/mock_web_user_media_client.h"
#include "content/shell/renderer/test_runner/spell_check_client.h"
+#include "content/shell/renderer/test_runner/test_interfaces.h"
#include "content/shell/renderer/test_runner/test_runner.h"
#include "content/shell/renderer/test_runner/web_test_runner.h"
// FIXME: Including platform_canvas.h here is a layering violation.
@@ -299,7 +299,8 @@ std::string DumpFrameScrollPosition(blink::WebFrame* frame, bool recursive) {
std::string DumpAllBackForwardLists(TestInterfaces* interfaces,
WebTestDelegate* delegate) {
std::string result;
- const std::vector<WebTestProxyBase*>& window_list = interfaces->windowList();
+ const std::vector<WebTestProxyBase*>& window_list =
+ interfaces->GetWindowList();
for (size_t i = 0; i < window_list.size(); ++i)
result.append(delegate->dumpHistoryForWindow(window_list.at(i)));
return result;
@@ -316,7 +317,7 @@ WebTestProxyBase::WebTestProxyBase()
}
WebTestProxyBase::~WebTestProxyBase() {
- test_interfaces_->windowClosed(this);
+ test_interfaces_->WindowClosed(this);
// Tests must wait for readback requests to finish before notifying that
// they are done.
CHECK_EQ(0u, composite_and_readback_callbacks_.size());
@@ -324,7 +325,7 @@ WebTestProxyBase::~WebTestProxyBase() {
void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) {
test_interfaces_ = interfaces->testInterfaces();
- test_interfaces_->windowOpened(this);
+ test_interfaces_->WindowOpened(this);
}
void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) {
@@ -383,30 +384,31 @@ void WebTestProxyBase::ShowValidationMessage(
std::string WebTestProxyBase::CaptureTree(bool debug_render_tree) {
bool should_dump_custom_text =
- test_interfaces_->testRunner()->shouldDumpAsCustomText();
- bool should_dump_as_text = test_interfaces_->testRunner()->shouldDumpAsText();
+ test_interfaces_->GetTestRunner()->shouldDumpAsCustomText();
+ bool should_dump_as_text =
+ test_interfaces_->GetTestRunner()->shouldDumpAsText();
bool should_dump_as_markup =
- test_interfaces_->testRunner()->shouldDumpAsMarkup();
- bool should_dump_as_printed = test_interfaces_->testRunner()->isPrinting();
+ test_interfaces_->GetTestRunner()->shouldDumpAsMarkup();
+ bool should_dump_as_printed = test_interfaces_->GetTestRunner()->isPrinting();
blink::WebFrame* frame = GetWebView()->mainFrame();
std::string data_utf8;
if (should_dump_custom_text) {
// Append a newline for the test driver.
- data_utf8 = test_interfaces_->testRunner()->customDumpText() + "\n";
+ data_utf8 = test_interfaces_->GetTestRunner()->customDumpText() + "\n";
} else if (should_dump_as_text) {
bool recursive =
- test_interfaces_->testRunner()->shouldDumpChildFramesAsText();
+ test_interfaces_->GetTestRunner()->shouldDumpChildFramesAsText();
data_utf8 = should_dump_as_printed ?
DumpFramesAsPrintedText(frame, recursive) :
DumpFramesAsText(frame, recursive);
} else if (should_dump_as_markup) {
bool recursive =
- test_interfaces_->testRunner()->shouldDumpChildFramesAsMarkup();
+ test_interfaces_->GetTestRunner()->shouldDumpChildFramesAsMarkup();
// Append a newline for the test driver.
data_utf8 = DumpFramesAsMarkup(frame, recursive);
} else {
- bool recursive =
- test_interfaces_->testRunner()->shouldDumpChildFrameScrollPositions();
+ bool recursive = test_interfaces_->GetTestRunner()
+ ->shouldDumpChildFrameScrollPositions();
blink::WebFrame::RenderAsTextControls render_text_behavior =
blink::WebFrame::RenderAsTextNormal;
if (should_dump_as_printed)
@@ -417,7 +419,7 @@ std::string WebTestProxyBase::CaptureTree(bool debug_render_tree) {
data_utf8 += DumpFrameScrollPosition(frame, recursive);
}
- if (test_interfaces_->testRunner()->ShouldDumpBackForwardList())
+ if (test_interfaces_->GetTestRunner()->ShouldDumpBackForwardList())
data_utf8 += DumpAllBackForwardLists(test_interfaces_, delegate_);
return data_utf8;
@@ -427,7 +429,7 @@ void WebTestProxyBase::DrawSelectionRect(SkCanvas* canvas) {
// See if we need to draw the selection bounds rect. Selection bounds
// rect is the rect enclosing the (possibly transformed) selection.
// The rect should be drawn after everything is laid out and painted.
- if (!test_interfaces_->testRunner()->shouldDumpSelectionRect())
+ if (!test_interfaces_->GetTestRunner()->shouldDumpSelectionRect())
return;
// If there is a selection rect - draw a red 1px border enclosing rect
blink::WebRect wr = GetWebView()->mainFrame()->selectionBoundsRect();
@@ -521,7 +523,7 @@ void WebTestProxyBase::CapturePixelsAsync(
DCHECK(web_widget_->isAcceleratedCompositingActive());
DCHECK(!callback.is_null());
- if (test_interfaces_->testRunner()->isPrinting()) {
+ if (test_interfaces_->GetTestRunner()->isPrinting()) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(&WebTestProxyBase::CapturePixelsForPrinting,
@@ -589,7 +591,7 @@ MockWebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizerMock() {
}
void WebTestProxyBase::ScheduleAnimation() {
- if (!test_interfaces_->testRunner()->TestIsRunning())
+ if (!test_interfaces_->GetTestRunner()->TestIsRunning())
return;
if (!animate_scheduled_) {
@@ -615,11 +617,11 @@ void WebTestProxyBase::PostAccessibilityEvent(const blink::WebAXObject& obj,
// accessibility events,
// and AccessibilityController will hold on to their target nodes if we don't
// ignore them here.
- if (!test_interfaces_->testRunner()->TestIsRunning())
+ if (!test_interfaces_->GetTestRunner()->TestIsRunning())
return;
if (event == blink::WebAXEventFocus)
- test_interfaces_->accessibilityController()->SetFocusedElement(obj);
+ test_interfaces_->GetAccessibilityController()->SetFocusedElement(obj);
const char* event_name = NULL;
switch (event) {
@@ -712,10 +714,10 @@ void WebTestProxyBase::PostAccessibilityEvent(const blink::WebAXObject& obj,
break;
}
- test_interfaces_->accessibilityController()->NotificationReceived(obj,
- event_name);
+ test_interfaces_->GetAccessibilityController()->NotificationReceived(
+ obj, event_name);
- if (test_interfaces_->accessibilityController()
+ if (test_interfaces_->GetAccessibilityController()
->ShouldLogAccessibilityEvents()) {
std::string message("AccessibilityNotification - ");
message += event_name;
@@ -740,21 +742,21 @@ void WebTestProxyBase::StartDragging(blink::WebLocalFrame* frame,
const blink::WebPoint& point) {
// 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.
- test_interfaces_->eventSender()->DoDragDrop(data, mask);
+ test_interfaces_->GetEventSender()->DoDragDrop(data, mask);
}
// The output from these methods in layout test mode should match that
// expected by the layout tests. See EditingDelegate.m in DumpRenderTree.
void WebTestProxyBase::DidChangeSelection(bool is_empty_callback) {
- if (test_interfaces_->testRunner()->shouldDumpEditingCallbacks())
+ if (test_interfaces_->GetTestRunner()->shouldDumpEditingCallbacks())
delegate_->printMessage(
"EDITING DELEGATE: "
"webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n");
}
void WebTestProxyBase::DidChangeContents() {
- if (test_interfaces_->testRunner()->shouldDumpEditingCallbacks())
+ if (test_interfaces_->GetTestRunner()->shouldDumpEditingCallbacks())
delegate_->printMessage(
"EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n");
}
@@ -765,9 +767,9 @@ bool WebTestProxyBase::CreateView(blink::WebLocalFrame* frame,
const blink::WebString& frame_name,
blink::WebNavigationPolicy policy,
bool suppress_opener) {
- if (!test_interfaces_->testRunner()->canOpenWindows())
+ if (!test_interfaces_->GetTestRunner()->canOpenWindows())
return false;
- if (test_interfaces_->testRunner()->shouldDumpCreateView())
+ if (test_interfaces_->GetTestRunner()->shouldDumpCreateView())
delegate_->printMessage(std::string("createView(") +
URLDescription(request.url()) + ")\n");
return true;
@@ -782,7 +784,7 @@ blink::WebPlugin* WebTestProxyBase::CreatePlugin(
}
void WebTestProxyBase::SetStatusText(const blink::WebString& text) {
- if (!test_interfaces_->testRunner()->shouldDumpStatusCallbacks())
+ if (!test_interfaces_->GetTestRunner()->shouldDumpStatusCallbacks())
return;
delegate_->printMessage(
std::string("UI DELEGATE STATUS CALLBACK: setStatusText:") +
@@ -790,14 +792,14 @@ void WebTestProxyBase::SetStatusText(const blink::WebString& text) {
}
void WebTestProxyBase::DidStopLoading() {
- if (test_interfaces_->testRunner()->shouldDumpProgressFinishedCallback())
+ if (test_interfaces_->GetTestRunner()->shouldDumpProgressFinishedCallback())
delegate_->printMessage("postProgressFinishedNotification\n");
}
void WebTestProxyBase::ShowContextMenu(
blink::WebLocalFrame* frame,
const blink::WebContextMenuData& context_menu_data) {
- test_interfaces_->eventSender()->SetContextMenuData(context_menu_data);
+ test_interfaces_->GetEventSender()->SetContextMenuData(context_menu_data);
}
blink::WebUserMediaClient* WebTestProxyBase::GetUserMediaClient() {
@@ -817,7 +819,7 @@ void WebTestProxyBase::PrintPage(blink::WebLocalFrame* frame) {
}
blink::WebNotificationPresenter* WebTestProxyBase::GetNotificationPresenter() {
- return test_interfaces_->testRunner()->notification_presenter();
+ return test_interfaces_->GetTestRunner()->notification_presenter();
}
blink::WebMIDIClient* WebTestProxyBase::GetWebMIDIClient() {
@@ -829,15 +831,15 @@ blink::WebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizer() {
}
bool WebTestProxyBase::RequestPointerLock() {
- return test_interfaces_->testRunner()->RequestPointerLock();
+ return test_interfaces_->GetTestRunner()->RequestPointerLock();
}
void WebTestProxyBase::RequestPointerUnlock() {
- test_interfaces_->testRunner()->RequestPointerUnlock();
+ test_interfaces_->GetTestRunner()->RequestPointerUnlock();
}
bool WebTestProxyBase::IsPointerLocked() {
- return test_interfaces_->testRunner()->isPointerLocked();
+ return test_interfaces_->GetTestRunner()->isPointerLocked();
}
void WebTestProxyBase::DidFocus() {
@@ -850,7 +852,7 @@ void WebTestProxyBase::DidBlur() {
void WebTestProxyBase::SetToolTipText(const blink::WebString& text,
blink::WebTextDirection direction) {
- test_interfaces_->testRunner()->setToolTipText(text);
+ test_interfaces_->GetTestRunner()->setToolTipText(text);
}
void WebTestProxyBase::DidOpenChooser() {
@@ -870,7 +872,7 @@ void WebTestProxyBase::LoadURLExternally(
const blink::WebURLRequest& request,
blink::WebNavigationPolicy policy,
const blink::WebString& suggested_name) {
- if (test_interfaces_->testRunner()->shouldWaitUntilExternalURLLoad()) {
+ if (test_interfaces_->GetTestRunner()->shouldWaitUntilExternalURLLoad()) {
if (policy == blink::WebNavigationPolicyDownload) {
delegate_->printMessage(
std::string("Downloading URL with suggested filename \"") +
@@ -884,15 +886,15 @@ void WebTestProxyBase::LoadURLExternally(
}
void WebTestProxyBase::DidStartProvisionalLoad(blink::WebLocalFrame* frame) {
- if (!test_interfaces_->testRunner()->topLoadingFrame())
- test_interfaces_->testRunner()->setTopLoadingFrame(frame, false);
+ if (!test_interfaces_->GetTestRunner()->topLoadingFrame())
+ test_interfaces_->GetTestRunner()->setTopLoadingFrame(frame, false);
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(" - didStartProvisionalLoadForFrame\n");
}
- if (test_interfaces_->testRunner()
+ if (test_interfaces_->GetTestRunner()
->shouldDumpUserGestureInFrameLoadCallbacks()) {
PrintFrameuserGestureStatus(
delegate_, frame, " - in didStartProvisionalLoadForFrame\n");
@@ -901,7 +903,7 @@ void WebTestProxyBase::DidStartProvisionalLoad(blink::WebLocalFrame* frame) {
void WebTestProxyBase::DidReceiveServerRedirectForProvisionalLoad(
blink::WebLocalFrame* frame) {
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(
" - didReceiveServerRedirectForProvisionalLoadForFrame\n");
@@ -910,7 +912,7 @@ void WebTestProxyBase::DidReceiveServerRedirectForProvisionalLoad(
bool WebTestProxyBase::DidFailProvisionalLoad(blink::WebLocalFrame* frame,
const blink::WebURLError& error) {
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(" - didFailProvisionalLoadWithError\n");
}
@@ -922,7 +924,7 @@ void WebTestProxyBase::DidCommitProvisionalLoad(
blink::WebLocalFrame* frame,
const blink::WebHistoryItem& history_item,
blink::WebHistoryCommitType history_type) {
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(" - didCommitLoadForFrame\n");
}
@@ -933,27 +935,27 @@ void WebTestProxyBase::DidReceiveTitle(blink::WebLocalFrame* frame,
blink::WebTextDirection direction) {
blink::WebCString title8 = title.utf8();
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(std::string(" - didReceiveTitle: ") +
title8.data() + "\n");
}
- if (test_interfaces_->testRunner()->shouldDumpTitleChanges())
+ if (test_interfaces_->GetTestRunner()->shouldDumpTitleChanges())
delegate_->printMessage(std::string("TITLE CHANGED: '") + title8.data() +
"'\n");
}
void WebTestProxyBase::DidChangeIcon(blink::WebLocalFrame* frame,
blink::WebIconURL::Type icon_type) {
- if (test_interfaces_->testRunner()->shouldDumpIconChanges()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpIconChanges()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(std::string(" - didChangeIcons\n"));
}
}
void WebTestProxyBase::DidFinishDocumentLoad(blink::WebLocalFrame* frame) {
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(" - didFinishDocumentLoadForFrame\n");
} else {
@@ -967,7 +969,7 @@ void WebTestProxyBase::DidFinishDocumentLoad(blink::WebLocalFrame* frame) {
}
void WebTestProxyBase::DidHandleOnloadEvents(blink::WebLocalFrame* frame) {
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(" - didHandleOnloadEventsForFrame\n");
}
@@ -975,7 +977,7 @@ void WebTestProxyBase::DidHandleOnloadEvents(blink::WebLocalFrame* frame) {
void WebTestProxyBase::DidFailLoad(blink::WebLocalFrame* frame,
const blink::WebURLError& error) {
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(" - didFailLoadWithError\n");
}
@@ -983,7 +985,7 @@ void WebTestProxyBase::DidFailLoad(blink::WebLocalFrame* frame,
}
void WebTestProxyBase::DidFinishLoad(blink::WebLocalFrame* frame) {
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(" - didFinishLoadForFrame\n");
}
@@ -993,13 +995,13 @@ void WebTestProxyBase::DidFinishLoad(blink::WebLocalFrame* frame) {
void WebTestProxyBase::DidDetectXSS(blink::WebLocalFrame* frame,
const blink::WebURL& insecure_url,
bool did_block_entire_page) {
- if (test_interfaces_->testRunner()->shouldDumpFrameLoadCallbacks())
+ if (test_interfaces_->GetTestRunner()->shouldDumpFrameLoadCallbacks())
delegate_->printMessage("didDetectXSS\n");
}
void WebTestProxyBase::DidDispatchPingLoader(blink::WebLocalFrame* frame,
const blink::WebURL& url) {
- if (test_interfaces_->testRunner()->shouldDumpPingLoaderCallbacks())
+ if (test_interfaces_->GetTestRunner()->shouldDumpPingLoaderCallbacks())
delegate_->printMessage(std::string("PingLoader dispatched to '") +
URLDescription(url).c_str() + "'.\n");
}
@@ -1007,7 +1009,7 @@ void WebTestProxyBase::DidDispatchPingLoader(blink::WebLocalFrame* frame,
void WebTestProxyBase::WillRequestResource(
blink::WebLocalFrame* frame,
const blink::WebCachedURLRequest& request) {
- if (test_interfaces_->testRunner()->shouldDumpResourceRequestCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpResourceRequestCallbacks()) {
PrintFrameDescription(delegate_, frame);
delegate_->printMessage(std::string(" - ") +
request.initiatorName().utf8().data());
@@ -1029,15 +1031,15 @@ void WebTestProxyBase::WillSendRequest(
GURL main_document_url = request.firstPartyForCookies();
if (redirect_response.isNull() &&
- (test_interfaces_->testRunner()->shouldDumpResourceLoadCallbacks() ||
- test_interfaces_->testRunner()->shouldDumpResourcePriorities())) {
+ (test_interfaces_->GetTestRunner()->shouldDumpResourceLoadCallbacks() ||
+ test_interfaces_->GetTestRunner()->shouldDumpResourcePriorities())) {
DCHECK(resource_identifier_map_.find(identifier) ==
resource_identifier_map_.end());
resource_identifier_map_[identifier] =
DescriptionSuitableForTestResult(request_url);
}
- if (test_interfaces_->testRunner()->shouldDumpResourceLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpResourceLoadCallbacks()) {
if (resource_identifier_map_.find(identifier) ==
resource_identifier_map_.end())
delegate_->printMessage("<unknown>");
@@ -1055,7 +1057,7 @@ void WebTestProxyBase::WillSendRequest(
delegate_->printMessage("\n");
}
- if (test_interfaces_->testRunner()->shouldDumpResourcePriorities()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpResourcePriorities()) {
delegate_->printMessage(
DescriptionSuitableForTestResult(request_url).c_str());
delegate_->printMessage(" has priority ");
@@ -1063,9 +1065,9 @@ void WebTestProxyBase::WillSendRequest(
delegate_->printMessage("\n");
}
- if (test_interfaces_->testRunner()->httpHeadersToClear()) {
+ if (test_interfaces_->GetTestRunner()->httpHeadersToClear()) {
const std::set<std::string>* clearHeaders =
- test_interfaces_->testRunner()->httpHeadersToClear();
+ test_interfaces_->GetTestRunner()->httpHeadersToClear();
for (std::set<std::string>::const_iterator header = clearHeaders->begin();
header != clearHeaders->end();
++header)
@@ -1094,7 +1096,7 @@ void WebTestProxyBase::DidReceiveResponse(
blink::WebLocalFrame* frame,
unsigned identifier,
const blink::WebURLResponse& response) {
- if (test_interfaces_->testRunner()->shouldDumpResourceLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpResourceLoadCallbacks()) {
if (resource_identifier_map_.find(identifier) ==
resource_identifier_map_.end())
delegate_->printMessage("<unknown>");
@@ -1104,7 +1106,8 @@ void WebTestProxyBase::DidReceiveResponse(
PrintResponseDescription(delegate_, response);
delegate_->printMessage("\n");
}
- if (test_interfaces_->testRunner()->shouldDumpResourceResponseMIMETypes()) {
+ if (test_interfaces_->GetTestRunner()
+ ->shouldDumpResourceResponseMIMETypes()) {
GURL url = response.url();
blink::WebString mime_type = response.mimeType();
delegate_->printMessage(url.ExtractFileName());
@@ -1122,7 +1125,7 @@ void WebTestProxyBase::DidChangeResourcePriority(
unsigned identifier,
const blink::WebURLRequest::Priority& priority,
int intra_priority_value) {
- if (test_interfaces_->testRunner()->shouldDumpResourcePriorities()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpResourcePriorities()) {
if (resource_identifier_map_.find(identifier) ==
resource_identifier_map_.end())
delegate_->printMessage("<unknown>");
@@ -1137,7 +1140,7 @@ void WebTestProxyBase::DidChangeResourcePriority(
void WebTestProxyBase::DidFinishResourceLoad(blink::WebLocalFrame* frame,
unsigned identifier) {
- if (test_interfaces_->testRunner()->shouldDumpResourceLoadCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpResourceLoadCallbacks()) {
if (resource_identifier_map_.find(identifier) ==
resource_identifier_map_.end())
delegate_->printMessage("<unknown>");
@@ -1191,28 +1194,28 @@ void WebTestProxyBase::DidAddMessageToConsole(
}
void WebTestProxyBase::LocationChangeDone(blink::WebFrame* frame) {
- if (frame != test_interfaces_->testRunner()->topLoadingFrame())
+ if (frame != test_interfaces_->GetTestRunner()->topLoadingFrame())
return;
- test_interfaces_->testRunner()->setTopLoadingFrame(frame, true);
+ test_interfaces_->GetTestRunner()->setTopLoadingFrame(frame, true);
}
blink::WebNavigationPolicy WebTestProxyBase::DecidePolicyForNavigation(
const blink::WebFrameClient::NavigationPolicyInfo& info) {
blink::WebNavigationPolicy result;
- if (!test_interfaces_->testRunner()->policyDelegateEnabled())
+ if (!test_interfaces_->GetTestRunner()->policyDelegateEnabled())
return info.defaultPolicy;
delegate_->printMessage(std::string("Policy delegate: attempt to load ") +
URLDescription(info.urlRequest.url()) +
" with navigation type '" +
WebNavigationTypeToString(info.navigationType) + "'\n");
- if (test_interfaces_->testRunner()->policyDelegateIsPermissive())
+ if (test_interfaces_->GetTestRunner()->policyDelegateIsPermissive())
result = blink::WebNavigationPolicyCurrentTab;
else
result = blink::WebNavigationPolicyIgnore;
- if (test_interfaces_->testRunner()->policyDelegateShouldNotifyDone())
- test_interfaces_->testRunner()->policyDelegateDone();
+ if (test_interfaces_->GetTestRunner()->policyDelegateShouldNotifyDone())
+ test_interfaces_->GetTestRunner()->policyDelegateDone();
return result;
}
@@ -1221,7 +1224,7 @@ bool WebTestProxyBase::WillCheckAndDispatchMessageEvent(
blink::WebFrame* target_frame,
blink::WebSecurityOrigin target,
blink::WebDOMMessageEvent event) {
- if (test_interfaces_->testRunner()->shouldInterceptPostMessage()) {
+ if (test_interfaces_->GetTestRunner()->shouldInterceptPostMessage()) {
delegate_->printMessage("intercepted postMessage\n");
return true;
}
@@ -1230,7 +1233,7 @@ bool WebTestProxyBase::WillCheckAndDispatchMessageEvent(
}
void WebTestProxyBase::PostSpellCheckEvent(const blink::WebString& event_name) {
- if (test_interfaces_->testRunner()->shouldDumpSpellCheckCallbacks()) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpSpellCheckCallbacks()) {
delegate_->printMessage(std::string("SpellCheckEvent: ") +
event_name.utf8().data() + "\n");
}