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

Unified Diff: content/shell/renderer/test_runner/TestInterfaces.cpp

Issue 458723002: TestInterfaces to chromium c++ style, rename methods and remove un-used header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated Created 6 years, 4 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
Index: content/shell/renderer/test_runner/TestInterfaces.cpp
diff --git a/content/shell/renderer/test_runner/TestInterfaces.cpp b/content/shell/renderer/test_runner/TestInterfaces.cpp
deleted file mode 100644
index 9f086d79955d274626cd391a161b2d1bf55e9776..0000000000000000000000000000000000000000
--- 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
« no previous file with comments | « content/shell/renderer/test_runner/TestInterfaces.h ('k') | content/shell/renderer/test_runner/WebTestInterfaces.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698