summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-31 21:27:18 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-31 21:27:18 +0000
commit6b1731c04c7855f0b03e0b52279f6ad114746158 (patch)
tree98032cf905ea77c9730c258a0f1df30ab2a0598f /webkit/tools/test_shell
parentf095abfa66d4ec79d71079e3d89fd192fafaf82f (diff)
downloadchromium_src-6b1731c04c7855f0b03e0b52279f6ad114746158.zip
chromium_src-6b1731c04c7855f0b03e0b52279f6ad114746158.tar.gz
chromium_src-6b1731c04c7855f0b03e0b52279f6ad114746158.tar.bz2
Get fonts to render in a somewhat recognisable form on Linux.
Review URL: http://codereview.chromium.org/8936 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell')
-rw-r--r--webkit/tools/test_shell/SConscript2
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc6
-rw-r--r--webkit/tools/test_shell/gtk/test_shell.cc283
-rw-r--r--webkit/tools/test_shell/gtk/test_webview_delegate.cc5
-rw-r--r--webkit/tools/test_shell/gtk/webview_host.cc13
-rw-r--r--webkit/tools/test_shell/gtk/webwidget_host.cc52
-rw-r--r--webkit/tools/test_shell/test_shell_main_gtk.cc3
-rw-r--r--webkit/tools/test_shell/webwidget_host.h10
8 files changed, 343 insertions, 31 deletions
diff --git a/webkit/tools/test_shell/SConscript b/webkit/tools/test_shell/SConscript
index 92e9d0d..30c4f96 100644
--- a/webkit/tools/test_shell/SConscript
+++ b/webkit/tools/test_shell/SConscript
@@ -93,6 +93,7 @@ elif env['PLATFORM'] in ('posix', 'darwin'):
)
input_files = [
+ 'event_sending_controller.cc',
'layout_test_controller.cc',
'simple_resource_loader_bridge.cc',
'test_navigation_controller.cc',
@@ -104,7 +105,6 @@ if env['PLATFORM'] == 'win32':
input_files.extend([
'drag_delegate.cc',
'drop_delegate.cc',
- 'event_sending_controller.cc',
'test_shell.cc',
'test_shell_win.cc',
'test_webview_delegate.cc',
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index 12e69d3..ac10803 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -21,6 +21,7 @@
#endif
#include <queue>
+#include "base/logging.h"
#include "base/ref_counted.h"
#include "base/string_util.h"
#include "base/time.h"
@@ -400,6 +401,11 @@ int EventSendingController::GetButtonNumberFromSingleArg(
} else if (L"delete" == code_str) {
code = 0x33;
}
+#elif defined(OS_LINUX)
+ // TODO(agl): We obviously need to do something about keycodes here
+ if (true) {
+ NOTIMPLEMENTED();
+ }
#endif
else {
DCHECK(code_str.length() == 1);
diff --git a/webkit/tools/test_shell/gtk/test_shell.cc b/webkit/tools/test_shell/gtk/test_shell.cc
index c048f04..8a72e86 100644
--- a/webkit/tools/test_shell/gtk/test_shell.cc
+++ b/webkit/tools/test_shell/gtk/test_shell.cc
@@ -4,17 +4,24 @@
#include "webkit/tools/test_shell/test_shell.h"
+#include <errno.h>
+#include <fcntl.h>
#include <gtk/gtk.h>
+#include <unistd.h>
+#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
#include "net/base/mime_util.h"
+#include "webkit/glue/plugins/plugin_list.h"
+#include "webkit/glue/resource_loader_bridge.h"
+#include "webkit/glue/webdatasource.h"
#include "webkit/glue/webframe.h"
+#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
-#include "webkit/glue/plugins/plugin_list.h"
-#include "webkit/glue/resource_loader_bridge.h"
#include "webkit/tools/test_shell/test_navigation_controller.h"
#include "webkit/tools/test_shell/test_webview_delegate.h"
@@ -25,6 +32,7 @@ WindowList* TestShell::window_list_;
TestShell::TestShell()
: delegate_(new TestWebViewDelegate(this)) {
layout_test_controller_.reset(new LayoutTestController(this));
+ event_sending_controller_.reset(new EventSendingController(this));
navigation_controller_.reset(new TestNavigationController(this));
}
@@ -52,6 +60,44 @@ bool TestShell::CreateNewWindow(const std::wstring& startingURL,
return true;
}
+void TestShell::ResetWebPreferences() {
+ DCHECK(web_prefs_);
+
+ // Match the settings used by Mac DumpRenderTree.
+ if (web_prefs_) {
+ *web_prefs_ = WebPreferences();
+ web_prefs_->standard_font_family = L"Times";
+ web_prefs_->fixed_font_family = L"Courier";
+ web_prefs_->serif_font_family = L"Times";
+ web_prefs_->sans_serif_font_family = L"Helvetica";
+ // These two fonts are picked from the intersection of
+ // Win XP font list and Vista font list :
+ // http://www.microsoft.com/typography/fonts/winxp.htm
+ // http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx
+ // Some of them are installed only with CJK and complex script
+ // support enabled on Windows XP and are out of consideration here.
+ // (although we enabled both on our buildbots.)
+ // They (especially Impact for fantasy) are not typical cursive
+ // and fantasy fonts, but it should not matter for layout tests
+ // as long as they're available.
+ web_prefs_->cursive_font_family = L"Comic Sans MS";
+ web_prefs_->fantasy_font_family = L"Impact";
+ web_prefs_->default_encoding = L"ISO-8859-1";
+ web_prefs_->default_font_size = 16;
+ web_prefs_->default_fixed_font_size = 13;
+ web_prefs_->minimum_font_size = 1;
+ web_prefs_->minimum_logical_font_size = 9;
+ web_prefs_->javascript_can_open_windows_automatically = true;
+ web_prefs_->dom_paste_enabled = true;
+ web_prefs_->developer_extras_enabled = interactive_;
+ web_prefs_->shrinks_standalone_images_to_fit = false;
+ web_prefs_->uses_universal_detector = false;
+ web_prefs_->text_areas_are_resizable = false;
+ web_prefs_->java_enabled = true;
+ web_prefs_->allow_scripts_to_close_windows = false;
+ }
+}
+
bool TestShell::Initialize(const std::wstring& startingURL) {
m_mainWnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(m_mainWnd), "Test Shell");
@@ -84,7 +130,7 @@ bool TestShell::Initialize(const std::wstring& startingURL) {
-1 /* append */);
gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
- m_webViewHost.reset(WebViewHost::Create(vbox, NULL, *TestShell::web_prefs_));
+ m_webViewHost.reset(WebViewHost::Create(vbox, delegate_, *TestShell::web_prefs_));
if (!startingURL.empty())
LoadURL(startingURL.c_str());
@@ -99,6 +145,21 @@ void TestShell::TestFinished() {
NOTIMPLEMENTED();
}
+void TestShell::WaitTestFinished() {
+ DCHECK(!test_is_pending_) << "cannot be used recursively";
+
+ test_is_pending_ = true;
+
+ // TODO(agl): Here windows forks a watchdog thread, but I'm punting on that
+ // for the moment. On POSIX systems we probably want to install a signal
+ // handler and use alarm(2).
+
+ // TestFinished() will post a quit message to break this loop when the page
+ // finishes loading.
+ while (test_is_pending_)
+ MessageLoop::current()->Run();
+}
+
void TestShell::Show(WebView* webview, WindowOpenDisposition disposition) {
delegate_->Show(webview, disposition);
}
@@ -126,6 +187,139 @@ WebWidget* TestShell::CreatePopupWidget(WebView* webview) {
return NULL;
}
+void TestShell::ResizeSubViews() {
+ // The GTK functions to do this are deprecated because it's not really
+ // something that X windows supports. It's not clear exactly what should be
+ // done here.
+ NOTIMPLEMENTED();
+}
+
+/* static */ std::string TestShell::DumpImage(
+ WebFrame* web_frame,
+ const std::wstring& file_name) {
+ // Windows uses some platform specific bitmap functions here.
+ // TODO(agl): port
+ NOTIMPLEMENTED();
+ return "00000000000000000000000000000000";
+}
+
+/* static */ void TestShell::DumpBackForwardList(std::wstring* result) {
+ result->clear();
+ for (WindowList::iterator iter = TestShell::windowList()->begin();
+ iter != TestShell::windowList()->end(); iter++) {
+ GtkWidget* window = *iter;
+ TestShell* shell =
+ static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell"));
+ webkit_glue::DumpBackForwardList(shell->webView(), NULL, result);
+ }
+}
+
+/* static */ bool TestShell::RunFileTest(const char *filename,
+ const TestParams& params) {
+ // Load the test file into the first available window.
+ if (TestShell::windowList()->empty()) {
+ LOG(ERROR) << "No windows open.";
+ return false;
+ }
+
+ GtkWidget* window = *(TestShell::windowList()->begin());
+ TestShell* shell =
+ static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell"));
+ shell->ResetTestController();
+
+ // ResetTestController may have closed the window we were holding on to.
+ // Grab the first window again.
+ window = *(TestShell::windowList()->begin());
+ shell = static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell"));
+ DCHECK(shell);
+
+ // Clear focus between tests.
+ shell->m_focusedWidgetHost = NULL;
+
+ // Make sure the previous load is stopped.
+ shell->webView()->StopLoading();
+ shell->navigation_controller()->Reset();
+
+ // Clean up state between test runs.
+ webkit_glue::ResetBeforeTestRun(shell->webView());
+ ResetWebPreferences();
+ shell->webView()->SetPreferences(*web_prefs_);
+
+ // 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
+ // deprecated and appears to have been removed.
+
+ shell->ResizeSubViews();
+
+ if (strstr(filename, "loading/") || strstr(filename, "loading\\"))
+ shell->layout_test_controller()->SetShouldDumpFrameLoadCallbacks(true);
+
+ shell->test_is_preparing_ = true;
+
+ const std::wstring wstr = UTF8ToWide(filename);
+ shell->LoadURL(wstr.c_str());
+
+ shell->test_is_preparing_ = false;
+ shell->WaitTestFinished();
+
+ // Echo the url in the output so we know we're not getting out of sync.
+ printf("#URL:%s\n", filename);
+
+ // Dump the requested representation.
+ WebFrame* webFrame = shell->webView()->GetMainFrame();
+ if (webFrame) {
+ bool should_dump_as_text =
+ shell->layout_test_controller_->ShouldDumpAsText();
+ bool dumped_anything = false;
+ if (params.dump_tree) {
+ dumped_anything = true;
+ // Text output: the test page can request different types of output
+ // which we handle here.
+ if (!should_dump_as_text) {
+ // Plain text pages should be dumped as text
+ std::wstring mime_type = webFrame->GetDataSource()->GetResponseMimeType();
+ should_dump_as_text = (mime_type == L"text/plain");
+ }
+ if (should_dump_as_text) {
+ bool recursive = shell->layout_test_controller_->
+ ShouldDumpChildFramesAsText();
+ std::string data_utf8 = WideToUTF8(
+ webkit_glue::DumpFramesAsText(webFrame, recursive));
+ fwrite(data_utf8.c_str(), 1, data_utf8.size(), stdout);
+ } else {
+ printf("%s", WideToUTF8(
+ webkit_glue::DumpRenderer(webFrame)).c_str());
+
+ bool recursive = shell->layout_test_controller_->
+ ShouldDumpChildFrameScrollPositions();
+ printf("%s", WideToUTF8(
+ webkit_glue::DumpFrameScrollPosition(webFrame, recursive)).
+ c_str());
+ }
+
+ if (shell->layout_test_controller_->ShouldDumpBackForwardList()) {
+ std::wstring bfDump;
+ DumpBackForwardList(&bfDump);
+ printf("%s", WideToUTF8(bfDump).c_str());
+ }
+ }
+
+ if (params.dump_pixels && !should_dump_as_text) {
+ // Image output: we write the image data to the file given on the
+ // command line (for the dump pixels argument), and the MD5 sum to
+ // stdout.
+ dumped_anything = true;
+ std::string md5sum = DumpImage(webFrame, params.pixel_file_name);
+ printf("#MD5:%s\n", md5sum.c_str());
+ }
+ if (dumped_anything)
+ printf("#EOF\n");
+ fflush(stdout);
+ }
+
+ return true;
+}
+
void TestShell::LoadURL(const wchar_t* url)
{
LoadURLForFrame(url, NULL);
@@ -140,6 +334,9 @@ void TestShell::LoadURLForFrame(const wchar_t* url,
if (frame_name)
frame_string = frame_name;
+ LOG(INFO) << "Loading " << WideToUTF8(url) << " in frame '"
+ << WideToUTF8(frame_string) << "'";
+
navigation_controller_->LoadEntry(new TestNavigationEntry(
-1, GURL(WideToUTF8(url)), std::wstring(), frame_string));
}
@@ -187,13 +384,89 @@ void TestShell::GoBackOrForward(int offset) {
navigation_controller_->GoToOffset(offset);
}
+static void WriteTextToFile(const std::wstring& data,
+ const FilePath& filepath)
+{
+ // This function does the same thing as the Windows version except that it
+ // takes a FilePath. We should be using WriteFile in base/file_util.h, but
+ // the patch to add the FilePath version of that file hasn't landed yet, so
+ // this is another TODO(agl) for the merging.
+ const int fd = open(filepath.value().c_str(), O_TRUNC | O_WRONLY | O_CREAT, 0600);
+ if (fd < 0)
+ return;
+ const std::string data_utf8 = WideToUTF8(data);
+ ssize_t n;
+ do {
+ n = write(fd, data_utf8.data(), data.size());
+ } while (n == -1 && errno == EINTR);
+ close(fd);
+}
+
+
+std::wstring TestShell::GetDocumentText()
+{
+ return webkit_glue::DumpDocumentText(webView()->GetMainFrame());
+}
+
+// TODO(agl):
+// This version of PromptForSaveFile uses FilePath, which is what the real
+// version should be using. However, I don't want to step on tony's toes (as he
+// is also editing this file), so this is a hack until we merge the files again.
+// (There is also a PromptForSaveFile member in TestShell which returns a wstring)
+static bool PromptForSaveFile(const char* prompt_title,
+ FilePath* result)
+{
+ char filenamebuffer[512];
+ printf("Enter filename for \"%s\"\n", prompt_title);
+ fgets(filenamebuffer, sizeof(filenamebuffer), stdin);
+ *result = FilePath(filenamebuffer);
+ return true;
+}
+
+void TestShell::DumpDocumentText()
+{
+ FilePath file_path;
+ if (!::PromptForSaveFile("Dump document text", &file_path))
+ return;
+
+ WriteTextToFile(webkit_glue::DumpDocumentText(webView()->GetMainFrame()),
+ file_path);
+}
+
+void TestShell::DumpRenderTree()
+{
+ FilePath file_path;
+ if (!::PromptForSaveFile("Dump render tree", &file_path))
+ return;
+
+ WriteTextToFile(webkit_glue::DumpRenderer(webView()->GetMainFrame()),
+ file_path);
+}
+
void TestShell::Reload() {
navigation_controller_->Reload();
}
std::string TestShell::RewriteLocalUrl(const std::string& url) {
- NOTIMPLEMENTED();
- return "";
+ // Convert file:///tmp/LayoutTests urls to the actual location on disk.
+ const char kPrefix[] = "file:///tmp/LayoutTests/";
+ const int kPrefixLen = arraysize(kPrefix) - 1;
+
+ std::string new_url(url);
+ if (url.compare(0, kPrefixLen, kPrefix, kPrefixLen) == 0) {
+ std::wstring replace_url;
+ PathService::Get(base::DIR_EXE, &replace_url);
+ file_util::UpOneDirectory(&replace_url);
+ file_util::UpOneDirectory(&replace_url);
+ file_util::AppendToPath(&replace_url, L"webkit");
+ file_util::AppendToPath(&replace_url, L"data");
+ file_util::AppendToPath(&replace_url, L"layout_tests");
+ file_util::AppendToPath(&replace_url, L"LayoutTests");
+ replace_url.push_back(file_util::kPathSeparator);
+ new_url = std::string("file:///") +
+ WideToUTF8(replace_url).append(url.substr(kPrefixLen));
+ }
+ return new_url;
}
//-----------------------------------------------------------------------------
diff --git a/webkit/tools/test_shell/gtk/test_webview_delegate.cc b/webkit/tools/test_shell/gtk/test_webview_delegate.cc
index 739b459..92079a8 100644
--- a/webkit/tools/test_shell/gtk/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/gtk/test_webview_delegate.cc
@@ -576,7 +576,9 @@ gfx::ViewHandle TestWebViewDelegate::GetContainingWindow(WebWidget* webwidget) {
void TestWebViewDelegate::DidInvalidateRect(WebWidget* webwidget,
const gfx::Rect& rect) {
- NOTIMPLEMENTED();
+ WebWidgetHost* host = GetHostForWidget(webwidget);
+ if (host)
+ host->DidInvalidateRect(rect);
}
void TestWebViewDelegate::DidScrollRect(WebWidget* webwidget, int dx, int dy,
@@ -668,6 +670,7 @@ void TestWebViewDelegate::UpdateAddressBar(WebView* webView) {
return;
std::string frameURL = dataSource->GetRequest().GetMainDocumentURL().spec();
+ LOG(INFO) << " -- Address bar " << frameURL;
NOTIMPLEMENTED();
}
diff --git a/webkit/tools/test_shell/gtk/webview_host.cc b/webkit/tools/test_shell/gtk/webview_host.cc
index 4eecae1..e21099d 100644
--- a/webkit/tools/test_shell/gtk/webview_host.cc
+++ b/webkit/tools/test_shell/gtk/webview_host.cc
@@ -9,6 +9,7 @@
#include "base/gfx/platform_canvas.h"
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
+#include "base/logging.h"
#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webview.h"
@@ -16,13 +17,13 @@
WebViewHost* WebViewHost::Create(GtkWidget* box,
WebViewDelegate* delegate,
const WebPreferences& prefs) {
- // TODO(agl):
- // /usr/local/google/agl/src/chrome/src/webkit/tools/test_shell/gtk/webview_host.cc:19: error: no matching function for call to 'WebWidgetHost::Create(GtkWidget*&, WebViewDelegate*&)'
- WebViewHost* host = reinterpret_cast<WebViewHost *>(WebWidgetHost::Create(box, NULL));
+ WebViewHost* host = new WebViewHost();
+
+ LOG(INFO) << "In WebViewHost::Create";
+
+ host->view_ = WebWidgetHost::CreateWindow(box, host);
+ g_object_set_data(G_OBJECT(host->view_), "webwidgethost", host);
- // TODO(erg):
- // - Set "host->view_"
- // - Call "host->webwidget_->Resize"
host->webwidget_ = WebView::Create(delegate, prefs);
host->webwidget_->Resize(gfx::Size(640, 480));
host->webwidget_->Layout();
diff --git a/webkit/tools/test_shell/gtk/webwidget_host.cc b/webkit/tools/test_shell/gtk/webwidget_host.cc
index 847a0a7..edc0a92 100644
--- a/webkit/tools/test_shell/gtk/webwidget_host.cc
+++ b/webkit/tools/test_shell/gtk/webwidget_host.cc
@@ -66,30 +66,47 @@ gboolean FocusOut(GtkWidget* widget, GdkEventFocus* focus, gpointer userdata) {
// -----------------------------------------------------------------------------
+gfx::WindowHandle WebWidgetHost::CreateWindow(gfx::WindowHandle box,
+ void* host) {
+ GtkWidget* widget = gtk_drawing_area_new();
+ gtk_box_pack_start(GTK_BOX(box), widget, TRUE, TRUE, 0);
+
+ gtk_widget_add_events(widget, GDK_EXPOSURE_MASK |
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_KEY_PRESS_MASK |
+ GDK_KEY_RELEASE_MASK);
+ // TODO(agl): set GTK_CAN_FOCUS flag
+ g_signal_connect(widget, "configure-event", G_CALLBACK(ConfigureEvent), host);
+ g_signal_connect(widget, "expose-event", G_CALLBACK(ExposeEvent), host);
+ g_signal_connect(widget, "destroy-event", G_CALLBACK(DestroyEvent), host);
+ g_signal_connect(widget, "key-press-event", G_CALLBACK(KeyPressEvent), host);
+ g_signal_connect(widget, "focus-in-event", G_CALLBACK(FocusIn), host);
+ g_signal_connect(widget, "focus-out-event", G_CALLBACK(FocusOut), host);
+
+ return widget;
+}
+
WebWidgetHost* WebWidgetHost::Create(gfx::WindowHandle box,
WebWidgetDelegate* delegate) {
+ LOG(INFO) << "In WebWidgetHost::Create";
+
WebWidgetHost* host = new WebWidgetHost();
- host->view_ = gtk_drawing_area_new();
- gtk_widget_add_events(host->view_, GDK_EXPOSURE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_KEY_PRESS_MASK |
- GDK_KEY_RELEASE_MASK);
- // TODO(agl): set GTK_CAN_FOCUS flag
+ host->view_ = CreateWindow(box, host);
host->webwidget_ = WebWidget::Create(delegate);
- g_object_set_data(G_OBJECT(host->view_), "webwidgethost", host);
- g_signal_connect(host->view_, "configure-event", G_CALLBACK(ConfigureEvent), host);
- g_signal_connect(host->view_, "expose-event", G_CALLBACK(ExposeEvent), host);
- g_signal_connect(host->view_, "destroy-event", G_CALLBACK(DestroyEvent), host);
- g_signal_connect(host->view_, "key-press-event", G_CALLBACK(KeyPressEvent), host);
- g_signal_connect(host->view_, "focus-in-event", G_CALLBACK(FocusIn), host);
- g_signal_connect(host->view_, "focus-out-event", G_CALLBACK(FocusOut), host);
+ return host;
+}
- gtk_box_pack_start(GTK_BOX(box), host->view_, TRUE, TRUE, 0);
+void WebWidgetHost::DidInvalidateRect(const gfx::Rect& rect) {
+ LOG(INFO) << " -- Invalidate " << rect.x() << " "
+ << rect.y() << " "
+ << rect.width() << " "
+ << rect.height() << " ";
- return host;
+ gtk_widget_queue_draw_area(GTK_WIDGET(view_), rect.x(), rect.y(), rect.width(),
+ rect.height());
}
void WebWidgetHost::DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect) {
@@ -167,7 +184,6 @@ void WebWidgetHost::Paint() {
LOG(INFO) << "Using pixel data at " << (void *) gdk_pixbuf_get_pixels(bitdev->pixbuf());
gdk_draw_pixbuf(view_->window, NULL, bitdev->pixbuf(),
0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0);
- gdk_pixbuf_save(bitdev->pixbuf(), "output.png", "png", NULL, NULL);
}
void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
diff --git a/webkit/tools/test_shell/test_shell_main_gtk.cc b/webkit/tools/test_shell/test_shell_main_gtk.cc
index 48cf47a..57b94ed 100644
--- a/webkit/tools/test_shell/test_shell_main_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_main_gtk.cc
@@ -46,6 +46,9 @@ int main(int argc, char* argv[]) {
file_util::AppendToPath(&uri, L"data");
file_util::AppendToPath(&uri, L"test_shell");
file_util::AppendToPath(&uri, L"index.html");
+ // For now, loading from disk doesn't work so we set the URI to the
+ // homepage.
+ uri = L"http://www.google.com";
}
if (parsed_command_line.GetLooseValueCount() > 0) {
diff --git a/webkit/tools/test_shell/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h
index eb52bc0..583c9bf 100644
--- a/webkit/tools/test_shell/webwidget_host.h
+++ b/webkit/tools/test_shell/webwidget_host.h
@@ -71,6 +71,16 @@ class WebWidgetHost {
protected:
#elif defined(OS_LINUX)
public:
+ // ---------------------------------------------------------------------------
+ // This is needed on Linux because the GtkWidget creation is the same between
+ // both web view hosts and web widget hosts. The Windows code manages this by
+ // reusing the WndProc function (static, above). However, GTK doesn't use a
+ // single big callback function like that so we have a static function that
+ // sets up a GtkWidget correctly.
+ // parent: a GtkBox to pack the new widget at the end of
+ // host: a pointer to a WebWidgetHost (or subclass thereof)
+ // ---------------------------------------------------------------------------
+ static gfx::WindowHandle CreateWindow(gfx::WindowHandle parent, void* host);
void WindowDestroyed();
void Resize(const gfx::Size& size);
#endif