diff options
author | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-21 04:36:46 +0000 |
---|---|---|
committer | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-21 04:38:32 +0000 |
commit | ec988d7d06f2fccac506cc1d9380d6d6d2cfe9f6 (patch) | |
tree | 685a865387032ac382fc7e687e8c13ab55e3810c | |
parent | 266b7b779aa7c3f35468097729588e2bb3b4b8d7 (diff) | |
download | chromium_src-ec988d7d06f2fccac506cc1d9380d6d6d2cfe9f6.zip chromium_src-ec988d7d06f2fccac506cc1d9380d6d6d2cfe9f6.tar.gz chromium_src-ec988d7d06f2fccac506cc1d9380d6d6d2cfe9f6.tar.bz2 |
MacViews: Fix WebDialogBrowserTest.SizeWindow to get browser_tests compiling on MacViews
gyp changes are made to filter out toolkit-views browser_tests that
aren't yet compiled in to a toolkit-views Chrome binary on Mac.
One, WebDialogBrowserTest.SizeWindow, was a disabled test (disabled for
4 years :o). It was preventing browser_tests compiling on MacViews
because it was passing a gfx::NativeWindow to CreateWindowWithParent,
which takes a view.
The parent isn't important for the test - it's just adding widget
context. This CL changes the parent to be web_contents->GetNativeView()
instead so the test compiles.
To ensure nothing breaks, the test needs to be enabled. According to the
comment, the reasons for it being disabled on Windows still seem
relevant. However, on Linux the test was just timing out due to a quirk
of the test. So the quirk is fixed, and WebDialogBrowserTest.SizeWindow
is enabled on Linux Aura.
The test is also enabled on Mac, but currently fails because
NativeViewHost isn't implemented yet. That's coming, and leaving the
test enabled will ensure we check it.
With this change browser_tests compiles and links on toolkit-views Mac.
BUG=404979, 399191, 52602
TEST=browser_tests
Review URL: https://codereview.chromium.org/486063002
Cr-Commit-Position: refs/heads/master@{#290998}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290998 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/views/web_dialog_view_browsertest.cc | 41 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 22 |
2 files changed, 45 insertions, 18 deletions
diff --git a/chrome/browser/ui/views/web_dialog_view_browsertest.cc b/chrome/browser/ui/views/web_dialog_view_browsertest.cc index dafe6ba..2751922 100644 --- a/chrome/browser/ui/views/web_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/web_dialog_view_browsertest.cc @@ -84,12 +84,14 @@ 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) { +// 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 = new ui::test::TestWebDialogDelegate( GURL(chrome::kChromeUIChromeURLsURL)); @@ -100,8 +102,7 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, DISABLED_SizeWindow) { 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 +146,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 +164,26 @@ 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()); } diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index bed49cf..f799b94 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1943,6 +1943,7 @@ '../third_party/ocmock/ocmock.gyp:ocmock', ], 'sources': [ + 'browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc', 'browser/renderer_host/chrome_render_widget_host_view_mac_delegate_browsertest.cc', 'browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm', 'browser/spellchecker/spellcheck_message_filter_mac_browsertest.cc', @@ -1951,6 +1952,20 @@ # TODO(groby): This test depends on hunspell and we cannot run it on # Mac, which does not use hunspell by default. 'browser/spellchecker/spellcheck_service_browsertest.cc', + + # TODO(tapted): Enable toolkit-views browser_tests on Mac when their + # respective implementations are linked in. http://crbug.com/404979. + 'browser/ui/views/autofill/autofill_dialog_view_tester_views.cc', + 'browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc', + 'browser/ui/views/extensions/extension_install_dialog_view_browsertest.cc', + 'browser/ui/views/frame/browser_view_browsertest.cc', + 'browser/ui/views/location_bar/zoom_bubble_view_browsertest.cc', + 'browser/ui/views/profiles/avatar_menu_button_browsertest.cc', + 'browser/ui/views/profiles/new_avatar_menu_button_browsertest.cc', + 'browser/ui/views/profiles/profile_chooser_view_browsertest.cc', + 'browser/ui/views/toolbar/browser_actions_container_browsertest.cc', + 'browser/ui/views/translate/translate_bubble_view_browsertest.cc', + # TODO(rouslan): This test depends on the custom dictionary UI, # which is disabled on Mac. 'browser/ui/webui/options/edit_dictionary_browsertest.js', @@ -1968,18 +1983,13 @@ 'renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc', 'renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc', ], - }], + }], # OS=="mac" ['OS=="mac" or OS=="win"', { 'sources': [ 'browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc', 'browser/media_galleries/fileapi/picasa_data_provider_browsertest.cc', ], }], - ['OS=="mac"', { - 'sources': [ - 'browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc', - ], - }], ['os_posix == 0 or chromeos == 1', { 'sources!': [ 'common/time_format_browsertest.cc', |