Commit cdb80672 authored by jochen@chromium.org's avatar jochen@chromium.org

[content shell] W3C SVG tests need to run in a smaller window

BUG=111316
TEST=W3C SVG tests pass
R=marja@chromium.org
TBR=jam@chromium.org


Review URL: https://chromiumcodereview.appspot.com/11828028

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176068 0039d316-1c4b-4281-b951-d872f2087c98
parent 72030697
...@@ -57,7 +57,7 @@ void LaunchShell(JNIEnv* env, jclass clazz, jstring jurl) { ...@@ -57,7 +57,7 @@ void LaunchShell(JNIEnv* env, jclass clazz, jstring jurl) {
url, url,
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
} }
} // namespace content } // namespace content
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "content/shell/shell_messages.h" #include "content/shell/shell_messages.h"
#include "content/shell/shell_switches.h" #include "content/shell/shell_switches.h"
#include "content/shell/webkit_test_controller.h" #include "content/shell/webkit_test_controller.h"
#include "ui/gfx/size.h"
// Content area size for newly created windows. // Content area size for newly created windows.
static const int kTestWindowWidth = 800; static const int kTestWindowWidth = 800;
...@@ -121,15 +120,13 @@ Shell* Shell::CreateNewWindow(BrowserContext* browser_context, ...@@ -121,15 +120,13 @@ Shell* Shell::CreateNewWindow(BrowserContext* browser_context,
const GURL& url, const GURL& url,
SiteInstance* site_instance, SiteInstance* site_instance,
int routing_id, int routing_id,
WebContents* base_web_contents) { const gfx::Size& initial_size) {
WebContents::CreateParams create_params(browser_context, site_instance); WebContents::CreateParams create_params(browser_context, site_instance);
create_params.routing_id = routing_id; create_params.routing_id = routing_id;
if (base_web_contents) { if (!initial_size.IsEmpty())
create_params.initial_size = create_params.initial_size = initial_size;
base_web_contents->GetView()->GetContainerSize(); else
} else {
create_params.initial_size = gfx::Size(kTestWindowWidth, kTestWindowHeight); create_params.initial_size = gfx::Size(kTestWindowWidth, kTestWindowHeight);
}
WebContents* web_contents = WebContents::Create(create_params); WebContents* web_contents = WebContents::Create(create_params);
Shell* shell = CreateShell(web_contents); Shell* shell = CreateShell(web_contents);
if (!url.is_empty()) if (!url.is_empty())
...@@ -185,7 +182,7 @@ void Shell::ShowDevTools() { ...@@ -185,7 +182,7 @@ void Shell::ShowDevTools() {
DevToolsAgentHost::GetFor(web_contents()->GetRenderViewHost())); DevToolsAgentHost::GetFor(web_contents()->GetRenderViewHost()));
dev_tools_ = CreateNewWindow( dev_tools_ = CreateNewWindow(
web_contents()->GetBrowserContext(), web_contents()->GetBrowserContext(),
url, NULL, MSG_ROUTING_NONE, NULL); url, NULL, MSG_ROUTING_NONE, gfx::Size());
} }
void Shell::CloseDevTools() { void Shell::CloseDevTools() {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_delegate.h"
#include "ipc/ipc_channel.h" #include "ipc/ipc_channel.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"
#if defined(TOOLKIT_GTK) #if defined(TOOLKIT_GTK)
#include <gtk/gtk.h> #include <gtk/gtk.h>
...@@ -68,7 +69,7 @@ class Shell : public WebContentsDelegate, ...@@ -68,7 +69,7 @@ class Shell : public WebContentsDelegate,
const GURL& url, const GURL& url,
SiteInstance* site_instance, SiteInstance* site_instance,
int routing_id, int routing_id,
WebContents* base_web_contents); const gfx::Size& initial_size);
// Returns the Shell object corresponding to the given RenderViewHost. // Returns the Shell object corresponding to the given RenderViewHost.
static Shell* FromRenderViewHost(RenderViewHost* rvh); static Shell* FromRenderViewHost(RenderViewHost* rvh);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
GURL("about:blank"), GURL("about:blank"),
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
} }
@end @end
...@@ -134,7 +134,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { ...@@ -134,7 +134,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
GetStartupURL(), GetStartupURL(),
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
} }
if (parameters_.ui_task) { if (parameters_.ui_task) {
......
...@@ -69,7 +69,7 @@ RenderViewHost* ShellDevToolsDelegate::CreateNewTarget() { ...@@ -69,7 +69,7 @@ RenderViewHost* ShellDevToolsDelegate::CreateNewTarget() {
GURL(chrome::kAboutBlankURL), GURL(chrome::kAboutBlankURL),
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
return shell->web_contents()->GetRenderViewHost(); return shell->web_contents()->GetRenderViewHost();
} }
......
...@@ -275,7 +275,7 @@ gboolean Shell::OnNewWindowKeyPressed(GtkAccelGroup* accel_group, ...@@ -275,7 +275,7 @@ gboolean Shell::OnNewWindowKeyPressed(GtkAccelGroup* accel_group,
GURL(), GURL(),
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
return TRUE; return TRUE;
} }
......
...@@ -219,7 +219,7 @@ void ShellWebContentsViewDelegate::OnOpenURLMenuActivated(GtkWidget* widget) { ...@@ -219,7 +219,7 @@ void ShellWebContentsViewDelegate::OnOpenURLMenuActivated(GtkWidget* widget) {
params_.link_url, params_.link_url,
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
} }
void ShellWebContentsViewDelegate::OnCutMenuActivated(GtkWidget* widget) { void ShellWebContentsViewDelegate::OnCutMenuActivated(GtkWidget* widget) {
...@@ -250,7 +250,7 @@ void ShellWebContentsViewDelegate::OnInspectMenuActivated(GtkWidget* widget) { ...@@ -250,7 +250,7 @@ void ShellWebContentsViewDelegate::OnInspectMenuActivated(GtkWidget* widget) {
url, url,
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
} }
} // namespace content } // namespace content
...@@ -245,7 +245,7 @@ void ShellWebContentsViewDelegate::ActionPerformed(int tag) { ...@@ -245,7 +245,7 @@ void ShellWebContentsViewDelegate::ActionPerformed(int tag) {
params_.link_url, params_.link_url,
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
break; break;
} }
case ShellContextMenuItemBackTag: case ShellContextMenuItemBackTag:
...@@ -273,7 +273,7 @@ void ShellWebContentsViewDelegate::ActionPerformed(int tag) { ...@@ -273,7 +273,7 @@ void ShellWebContentsViewDelegate::ActionPerformed(int tag) {
url, url,
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
break; break;
} }
} }
......
...@@ -213,7 +213,7 @@ void ShellWebContentsViewDelegate::MenuItemSelected(int selection) { ...@@ -213,7 +213,7 @@ void ShellWebContentsViewDelegate::MenuItemSelected(int selection) {
params_.link_url, params_.link_url,
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
break; break;
} }
case ShellContextMenuItemBackId: case ShellContextMenuItemBackId:
...@@ -240,7 +240,7 @@ void ShellWebContentsViewDelegate::MenuItemSelected(int selection) { ...@@ -240,7 +240,7 @@ void ShellWebContentsViewDelegate::MenuItemSelected(int selection) {
url, url,
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
break; break;
} }
} }
......
...@@ -201,7 +201,7 @@ LRESULT CALLBACK Shell::WndProc(HWND hwnd, UINT message, WPARAM wParam, ...@@ -201,7 +201,7 @@ LRESULT CALLBACK Shell::WndProc(HWND hwnd, UINT message, WPARAM wParam,
case IDM_NEW_WINDOW: case IDM_NEW_WINDOW:
CreateNewWindow( CreateNewWindow(
shell->web_contents()->GetBrowserContext(), shell->web_contents()->GetBrowserContext(),
GURL(), NULL, MSG_ROUTING_NONE, NULL); GURL(), NULL, MSG_ROUTING_NONE, gfx::Size());
break; break;
case IDM_CLOSE_WINDOW: case IDM_CLOSE_WINDOW:
DestroyWindow(hwnd); DestroyWindow(hwnd);
......
...@@ -164,12 +164,16 @@ bool WebKitTestController::PrepareForLayoutTest( ...@@ -164,12 +164,16 @@ bool WebKitTestController::PrepareForLayoutTest(
content::ShellBrowserContext* browser_context = content::ShellBrowserContext* browser_context =
static_cast<content::ShellContentBrowserClient*>( static_cast<content::ShellContentBrowserClient*>(
content::GetContentClient()->browser())->browser_context(); content::GetContentClient()->browser())->browser_context();
gfx::Size initial_size;
// The W3C SVG layout tests use a different size than the other layout tests.
if (test_url.spec().find("W3C-SVG-1.1") != std::string::npos)
initial_size = gfx::Size(480, 360);
main_window_ = content::Shell::CreateNewWindow( main_window_ = content::Shell::CreateNewWindow(
browser_context, browser_context,
GURL(), GURL(),
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); initial_size);
WebContentsObserver::Observe(main_window_->web_contents()); WebContentsObserver::Observe(main_window_->web_contents());
main_window_->LoadURL(test_url); main_window_->LoadURL(test_url);
if (test_url.spec().find("/dumpAsText/") != std::string::npos || if (test_url.spec().find("/dumpAsText/") != std::string::npos ||
......
...@@ -138,7 +138,7 @@ Shell* ContentBrowserTest::CreateBrowser() { ...@@ -138,7 +138,7 @@ Shell* ContentBrowserTest::CreateBrowser() {
GURL(chrome::kAboutBlankURL), GURL(chrome::kAboutBlankURL),
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
} }
Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { Shell* ContentBrowserTest::CreateOffTheRecordBrowser() {
...@@ -149,7 +149,7 @@ Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { ...@@ -149,7 +149,7 @@ Shell* ContentBrowserTest::CreateOffTheRecordBrowser() {
GURL(chrome::kAboutBlankURL), GURL(chrome::kAboutBlankURL),
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); gfx::Size());
} }
} // namespace content } // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment