summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-03 19:41:56 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-03 19:41:56 +0000
commit96b80b47470c58f3adbd838856a14960db32ecaf (patch)
treea83b6d9d718566a55ecb701030ed4da33bc3b15a /content
parent0d461c5a3a9ced977416a7adb431feeaca46f662 (diff)
downloadchromium_src-96b80b47470c58f3adbd838856a14960db32ecaf.zip
chromium_src-96b80b47470c58f3adbd838856a14960db32ecaf.tar.gz
chromium_src-96b80b47470c58f3adbd838856a14960db32ecaf.tar.bz2
Expose windows.internals in content shell when running layout tests
Also, enable file access from files for layout tests BUG=111316 TEST="webkit/tools/layout_tests/run_webkit_tests.py --chromium --debug --driver-name=content_shell --no-retry-failures --additional-drt-flag=--dump-render-tree fast/dom/HTMLDocument/hasFocus.html" fails with TEXT instead of TIMEOUT Review URL: https://chromiumcodereview.appspot.com/10693081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/content_shell.gypi19
-rw-r--r--content/shell/config.h30
-rw-r--r--content/shell/layout_test_controller.cc6
-rw-r--r--content/shell/layout_test_controller.h1
-rw-r--r--content/shell/shell_main_delegate.cc5
5 files changed, 60 insertions, 1 deletions
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
index 78020d4..d68d13c 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -148,6 +148,25 @@
['exclude', 'shell/shell_gtk.cc'],
['exclude', 'shell/shell_win.cc'],
],
+ }], # use_aura==1
+ ['inside_chromium_build==0 or component!="shared_library"', {
+ 'dependencies': [
+ '<(webkit_src_dir)/Source/WebCore/WebCore.gyp/WebCore.gyp:webcore_test_support',
+ '<(webkit_src_dir)/Source/WTF/WTF.gyp/WTF.gyp:wtf',
+ ],
+ 'include_dirs': [
+ # Required for WebTestingSupport.cpp to find our custom config.h.
+ 'shell/',
+ '<(webkit_src_dir)/Source/WebKit/chromium/public',
+ # WARNING: Do not view this particular case as a precedent for
+ # including WebCore headers in the content shell.
+ '<(webkit_src_dir)/Source/WebCore/testing/v8', # for WebCoreTestSupport.h needed to link in window.internals code.
+ ],
+ 'sources': [
+ 'shell/config.h',
+ '<(webkit_src_dir)/Source/WebKit/chromium/src/WebTestingSupport.cpp',
+ '<(webkit_src_dir)/Source/WebKit/chromium/public/WebTestingSupport.h',
+ ],
}],
],
},
diff --git a/content/shell/config.h b/content/shell/config.h
new file mode 100644
index 0000000..386457e
--- /dev/null
+++ b/content/shell/config.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 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_CONFIG_H_
+#define CONTENT_SHELL_CONFIG_H_
+#pragma once
+
+// Required to build WebTestingSupport.
+
+// To avoid confict of LOG in wtf/Assertions.h and LOG in base/logging.h,
+// skip base/logging.h by defining BASE_LOGGING_H_ and define some macros
+// provided by base/logging.h.
+// FIXME: Remove this hack!
+#include <ostream>
+#define BASE_LOGGING_H_
+#define CHECK(condition) while (false && (condition)) std::cerr
+#define DCHECK(condition) while (false && (condition)) std::cerr
+#define DCHECK_EQ(a, b) while (false && (a) == (b)) std::cerr
+#define DCHECK_NE(a, b) while (false && (a) != (b)) std::cerr
+
+#include <wtf/Platform.h>
+#include <wtf/ExportMacros.h>
+
+#if OS(WINDOWS) && !COMPILER(GCC)
+// Allow 'this' to be used in base member initializer list.
+#pragma warning(disable : 4355)
+#endif
+
+#endif // CONTENT_SHELL_CONFIG_H_
diff --git a/content/shell/layout_test_controller.cc b/content/shell/layout_test_controller.cc
index 3a7439f..2ec0d3a 100644
--- a/content/shell/layout_test_controller.cc
+++ b/content/shell/layout_test_controller.cc
@@ -16,6 +16,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "webkit/glue/webkit_glue.h"
@@ -23,6 +24,7 @@ using WebKit::WebFrame;
using WebKit::WebElement;
using WebKit::WebRect;
using WebKit::WebSize;
+using WebKit::WebTestingSupport;
using WebKit::WebView;
namespace content {
@@ -141,6 +143,10 @@ LayoutTestController::LayoutTestController(RenderView* render_view)
LayoutTestController::~LayoutTestController() {
}
+void LayoutTestController::DidClearWindowObject(WebFrame* frame) {
+ WebTestingSupport::injectInternalsObject(frame);
+}
+
void LayoutTestController::DidFinishLoad(WebFrame* frame) {
if (!frame->parent())
Send(new ShellViewHostMsg_DidFinishLoad(routing_id()));
diff --git a/content/shell/layout_test_controller.h b/content/shell/layout_test_controller.h
index 1b3faae..22171ac 100644
--- a/content/shell/layout_test_controller.h
+++ b/content/shell/layout_test_controller.h
@@ -18,6 +18,7 @@ class LayoutTestController : public RenderViewObserver {
// RenderViewObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE;
private:
diff --git a/content/shell/shell_main_delegate.cc b/content/shell/shell_main_delegate.cc
index 12cb139..db6efc4 100644
--- a/content/shell/shell_main_delegate.cc
+++ b/content/shell/shell_main_delegate.cc
@@ -49,8 +49,11 @@ ShellMainDelegate::~ShellMainDelegate() {
}
bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
InitLogging();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kAllowFileAccessFromFiles);
+ }
#if defined(OS_MACOSX)
OverrideFrameworkBundlePath();
#endif