summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-17 23:00:59 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-17 23:00:59 +0000
commit2fab253a61e797b461b21671af7942521b749ee3 (patch)
tree6d61d2cbf0dd13956924fd7323a3c7506422dadd /webkit/tools/test_shell
parent5220e732b9c11a4309c6f5a45a27d4658087b1ed (diff)
downloadchromium_src-2fab253a61e797b461b21671af7942521b749ee3.zip
chromium_src-2fab253a61e797b461b21671af7942521b749ee3.tar.gz
chromium_src-2fab253a61e797b461b21671af7942521b749ee3.tar.bz2
Remove webview's dependency on webpreferences.
TEST=none BUG=none Review URL: http://codereview.chromium.org/165513 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell')
-rw-r--r--webkit/tools/test_shell/layout_test_controller.cc19
-rw-r--r--webkit/tools/test_shell/mac/webview_host.mm5
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc2
-rw-r--r--webkit/tools/test_shell/test_shell_mac.mm2
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc2
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc15
-rw-r--r--webkit/tools/test_shell/webview_host_gtk.cc5
-rw-r--r--webkit/tools/test_shell/webview_host_win.cc5
8 files changed, 30 insertions, 25 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index 63e6c63..ffe1e3e 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -16,6 +16,7 @@
#include "base/string_util.h"
#include "webkit/api/public/WebFrame.h"
#include "webkit/api/public/WebScriptSource.h"
+#include "webkit/api/public/WebSettings.h"
#include "webkit/glue/dom_operations.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
@@ -556,10 +557,8 @@ void LayoutTestController::setPopupBlockingEnabled(
const CppArgumentList& args, CppVariant* result) {
if (args.size() > 0 && args[0].isBool()) {
bool block_popups = args[0].ToBoolean();
- WebPreferences* prefs = shell_->GetWebPreferences();
- prefs->javascript_can_open_windows_automatically = !block_popups;
-
- shell_->webView()->SetPreferences(*prefs);
+ shell_->webView()->GetSettings()->setJavaScriptCanOpenWindowsAutomatically(
+ !block_popups);
}
result->SetNull();
}
@@ -706,10 +705,7 @@ void LayoutTestController::numberOfActiveAnimations(const CppArgumentList& args,
void LayoutTestController::disableImageLoading(const CppArgumentList& args,
CppVariant* result) {
- WebPreferences* prefs = shell_->GetWebPreferences();
- prefs->loads_images_automatically = false;
- shell_->webView()->SetPreferences(*prefs);
-
+ shell_->webView()->GetSettings()->setLoadsImagesAutomatically(false);
result->SetNull();
}
@@ -793,9 +789,8 @@ void LayoutTestController::setPrivateBrowsingEnabled(
void LayoutTestController::setXSSAuditorEnabled(
const CppArgumentList& args, CppVariant* result) {
if (args.size() > 0 && args[0].isBool()) {
- WebPreferences* preferences = shell_->GetWebPreferences();
- preferences->xss_auditor_enabled = args[0].value.boolValue;
- shell_->webView()->SetPreferences(*preferences);
+ bool enabled = args[0].value.boolValue;
+ shell_->webView()->GetSettings()->setXSSAuditorEnabled(enabled);
}
result->SetNull();
}
@@ -911,7 +906,7 @@ void LayoutTestController::overridePreference(
shell_->delegate()->AddMessageToConsole(shell_->webView(),
message, 0, L"");
}
- shell_->webView()->SetPreferences(*preferences);
+ preferences->Apply(shell_->webView());
}
result->SetNull();
}
diff --git a/webkit/tools/test_shell/mac/webview_host.mm b/webkit/tools/test_shell/mac/webview_host.mm
index 960a55b..2acc00c 100644
--- a/webkit/tools/test_shell/mac/webview_host.mm
+++ b/webkit/tools/test_shell/mac/webview_host.mm
@@ -11,6 +11,7 @@
#include "base/gfx/size.h"
#include "skia/ext/platform_canvas.h"
#include "webkit/api/public/WebSize.h"
+#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
using WebKit::WebSize;
@@ -33,7 +34,9 @@ WebViewHost* WebViewHost::Create(NSView* parent_view,
[parent_view addSubview:host->view_];
[host->view_ release];
- host->webwidget_ = WebView::Create(delegate, prefs);
+ host->webwidget_ = WebView::Create();
+ prefs.Apply(host->webview());
+ host->webview()->InitializeMainFrame(delegate);
host->webwidget_->resize(WebSize(content_rect.size.width,
content_rect.size.height));
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index cf35788..1f5931b 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -543,7 +543,7 @@ void TestShell::ResizeSubViews() {
// Clean up state between test runs.
webkit_glue::ResetBeforeTestRun(shell->webView());
ResetWebPreferences();
- shell->webView()->SetPreferences(*web_prefs_);
+ web_prefs_->Apply(shell->webView());
// TODO(agl): Maybe make the window hidden in the future. Window does this
// by positioning it off the screen but the GTK function to do this is
diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm
index e2a9139..dfd53f8 100644
--- a/webkit/tools/test_shell/test_shell_mac.mm
+++ b/webkit/tools/test_shell/test_shell_mac.mm
@@ -523,7 +523,7 @@ void TestShell::ResizeSubViews() {
// Clean up state between test runs.
webkit_glue::ResetBeforeTestRun(shell->webView());
ResetWebPreferences();
- shell->webView()->SetPreferences(*web_prefs_);
+ web_prefs_->Apply(shell->webView());
// Hide the window. We can't actually use NSWindow's |-setFrameTopLeftPoint:|
// because it leaves a chunk of the window visible instead of moving it
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index 0a9e141..d07e17d 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -254,7 +254,7 @@ bool TestShell::RunFileTest(const TestParams& params) {
// Clean up state between test runs.
webkit_glue::ResetBeforeTestRun(shell->webView());
ResetWebPreferences();
- shell->webView()->SetPreferences(*web_prefs_);
+ web_prefs_->Apply(shell->webView());
SetWindowPos(shell->m_mainWnd, NULL,
kTestWindowXLocation, kTestWindowYLocation, 0, 0,
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index dbd199b..2836a5f 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -27,6 +27,7 @@
#include "webkit/api/public/WebFrame.h"
#include "webkit/api/public/WebKit.h"
#include "webkit/api/public/WebScreenInfo.h"
+#include "webkit/api/public/WebSettings.h"
#include "webkit/api/public/WebString.h"
#include "webkit/api/public/WebURL.h"
#include "webkit/api/public/WebURLError.h"
@@ -805,16 +806,16 @@ int TestWebViewDelegate::GetHistoryForwardListCount() {
}
void TestWebViewDelegate::SetUserStyleSheetEnabled(bool is_enabled) {
- WebPreferences* prefs = shell_->GetWebPreferences();
- prefs->user_style_sheet_enabled = is_enabled;
- shell_->webView()->SetPreferences(*prefs);
+ // Disabling/enabling this is really just setting it to an empty URL or
+ // setting it to something else. From this location in the code, there's
+ // no way to know what it's supposed to be. Luckily, right now, this is only
+ // used to disable the user style sheet.
+ DCHECK(!is_enabled);
+ shell_->webView()->GetSettings()->setUserStyleSheetLocation(WebURL());
}
void TestWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) {
- WebPreferences* prefs = shell_->GetWebPreferences();
- prefs->user_style_sheet_enabled = true;
- prefs->user_style_sheet_location = location;
- shell_->webView()->SetPreferences(*prefs);
+ shell_->webView()->GetSettings()->setUserStyleSheetLocation(location);
}
// WebWidgetDelegate ---------------------------------------------------------
diff --git a/webkit/tools/test_shell/webview_host_gtk.cc b/webkit/tools/test_shell/webview_host_gtk.cc
index f9f030f..39a88ab 100644
--- a/webkit/tools/test_shell/webview_host_gtk.cc
+++ b/webkit/tools/test_shell/webview_host_gtk.cc
@@ -11,6 +11,7 @@
#include "base/gfx/size.h"
#include "skia/ext/platform_canvas.h"
#include "webkit/glue/plugins/gtk_plugin_container.h"
+#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
// static
@@ -22,7 +23,9 @@ WebViewHost* WebViewHost::Create(GtkWidget* parent_view,
host->view_ = WebWidgetHost::CreateWidget(parent_view, host);
host->plugin_container_manager_.set_host_widget(host->view_);
- host->webwidget_ = WebView::Create(delegate, prefs);
+ host->webwidget_ = WebView::Create();
+ prefs.Apply(host->webview());
+ host->webview()->InitializeMainFrame(delegate);
host->webwidget_->layout();
return host;
diff --git a/webkit/tools/test_shell/webview_host_win.cc b/webkit/tools/test_shell/webview_host_win.cc
index d5c18ef..79b46b5 100644
--- a/webkit/tools/test_shell/webview_host_win.cc
+++ b/webkit/tools/test_shell/webview_host_win.cc
@@ -8,6 +8,7 @@
#include "base/gfx/size.h"
#include "base/win_util.h"
#include "skia/ext/platform_canvas.h"
+#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
static const wchar_t kWindowClassName[] = L"WebViewHost";
@@ -37,7 +38,9 @@ WebViewHost* WebViewHost::Create(HWND parent_view,
GetModuleHandle(NULL), NULL);
win_util::SetWindowUserData(host->view_, host);
- host->webwidget_ = WebView::Create(delegate, prefs);
+ host->webwidget_ = WebView::Create();
+ prefs.Apply(host->webview());
+ host->webview()->InitializeMainFrame(delegate);
return host;
}