| Index: chrome/browser/ui/views/web_dialog_view_browsertest.cc
|
| diff --git a/chrome/browser/ui/views/web_dialog_view_browsertest.cc b/chrome/browser/ui/views/web_dialog_view_browsertest.cc
|
| index dafe6baa39104f8f0cf9f1f0d6e8844e12719449..3b86a115f2bc214e9976f24ce671843f4874fc5b 100644
|
| --- a/chrome/browser/ui/views/web_dialog_view_browsertest.cc
|
| +++ b/chrome/browser/ui/views/web_dialog_view_browsertest.cc
|
| @@ -84,24 +84,24 @@ class WebDialogBrowserTest : public InProcessBrowserTest {
|
| WebDialogBrowserTest() {}
|
| };
|
|
|
| -// http://code.google.com/p/chromium/issues/detail?id=52602
|
| -// Windows has some issues resizing windows- an off by one problem,
|
| -// and a minimum size that seems too big. This file isn't included in
|
| -// Mac builds yet. On Chrome OS, this test doesn't apply since ChromeOS
|
| -// doesn't allow resizing of windows.
|
| -IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, DISABLED_SizeWindow) {
|
| - ui::test::TestWebDialogDelegate* delegate =
|
| - new ui::test::TestWebDialogDelegate(
|
| - GURL(chrome::kChromeUIChromeURLsURL));
|
| - delegate->set_size(kInitialWidth, kInitialHeight);
|
| +// Windows has some issues resizing windows. An off by one problem, and a
|
| +// minimum size that seems too big. See http://crbug.com/52602.
|
| +#if defined(OS_WIN)
|
| +#define MAYBE_SizeWindow DISABLED_SizeWindow
|
| +#else
|
| +#define MAYBE_SizeWindow SizeWindow
|
| +#endif
|
| +IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) {
|
| + ui::test::TestWebDialogDelegate delegate(
|
| + (GURL(chrome::kChromeUIChromeURLsURL)));
|
| + delegate.set_size(kInitialWidth, kInitialHeight);
|
|
|
| TestWebDialogView* view =
|
| - new TestWebDialogView(browser()->profile(), delegate);
|
| + new TestWebDialogView(browser()->profile(), &delegate);
|
| WebContents* web_contents =
|
| browser()->tab_strip_model()->GetActiveWebContents();
|
| ASSERT_TRUE(web_contents != NULL);
|
| - views::Widget::CreateWindowWithParent(
|
| - view, web_contents->GetTopLevelNativeWindow());
|
| + views::Widget::CreateWindowWithParent(view, web_contents->GetNativeView());
|
| view->GetWidget()->Show();
|
|
|
| // TestWebDialogView should quit current message loop on size change.
|
| @@ -145,7 +145,10 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, DISABLED_SizeWindow) {
|
| EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
|
|
|
| // Get very small.
|
| - gfx::Size min_size = view->GetWidget()->GetMinimumSize();
|
| + const gfx::Size min_size = view->GetWidget()->GetMinimumSize();
|
| + EXPECT_LT(0, min_size.width());
|
| + EXPECT_LT(0, min_size.height());
|
| +
|
| set_bounds.set_size(min_size);
|
|
|
| view->MoveContents(web_contents, set_bounds);
|
| @@ -160,13 +163,28 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, DISABLED_SizeWindow) {
|
| EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
|
| EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
|
|
|
| - // Check to make sure we can't get to 0x0
|
| + // Check to make sure we can't get to 0x0. First expand beyond the minimum
|
| + // size that was set above so that TestWebDialogView has a change to pick up.
|
| + set_bounds.set_height(250);
|
| + view->MoveContents(web_contents, set_bounds);
|
| + content::RunMessageLoop(); // TestWebDialogView will quit.
|
| + actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
|
| + EXPECT_EQ(set_bounds, actual_bounds);
|
| +
|
| + // Now verify that attempts to re-size to 0x0 enforces the minimum size.
|
| set_bounds.set_width(0);
|
| set_bounds.set_height(0);
|
|
|
| view->MoveContents(web_contents, set_bounds);
|
| content::RunMessageLoop(); // TestWebDialogView will quit.
|
| actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
|
| - EXPECT_LT(0, actual_bounds.width());
|
| - EXPECT_LT(0, actual_bounds.height());
|
| + EXPECT_EQ(min_size, actual_bounds.size());
|
| +
|
| + // And that the render view is also non-zero.
|
| + rwhv_bounds =
|
| + view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
|
| + EXPECT_LT(0, rwhv_bounds.width());
|
| + EXPECT_LT(0, rwhv_bounds.height());
|
| +
|
| + view->GetWidget()->CloseNow();
|
| }
|
|
|