| Index: chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
|
| diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
|
| index 30f2f701c577551a5ac16780664f7e418730efc1..921f577f7916a3534a910b6a46c25eb571fdda8e 100644
|
| --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
|
| +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
|
| @@ -15,6 +15,7 @@
|
| #include "chrome/browser/ui/find_bar/find_notification_details.h"
|
| #include "chrome/browser/ui/find_bar/find_tab_helper.h"
|
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
|
| +#include "chrome/common/url_constants.h"
|
| #include "chrome/test/in_process_browser_test.h"
|
| #include "chrome/test/ui_test_utils.h"
|
| #include "content/browser/renderer_host/render_view_host.h"
|
| @@ -94,7 +95,7 @@ class FindInPageControllerTest : public InProcessBrowserTest {
|
|
|
| string16 GetFindBarMatchCountTextForBrowser(Browser* browser) {
|
| FindBarTesting* find_bar =
|
| - browser->GetFindBarController()->find_bar()->GetFindBarTesting();
|
| + browser->GetFindBarController()->find_bar()->GetFindBarTesting();
|
| return find_bar->GetMatchCountText();
|
| }
|
|
|
| @@ -102,6 +103,12 @@ class FindInPageControllerTest : public InProcessBrowserTest {
|
| return GetFindBarMatchCountTextForBrowser(browser());
|
| }
|
|
|
| + int GetFindBarWidthForBrowser(Browser* browser) {
|
| + FindBarTesting* find_bar =
|
| + browser->GetFindBarController()->find_bar()->GetFindBarTesting();
|
| + return find_bar->GetWidth();
|
| + }
|
| +
|
| void EnsureFindBoxOpenForBrowser(Browser* browser) {
|
| browser->ShowFindBar();
|
| gfx::Point position;
|
| @@ -1080,3 +1087,28 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, ActivateLinkNavigatesPage) {
|
| tab->find_tab_helper()->StopFinding(FindBarController::kActivateSelection);
|
| EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
|
| }
|
| +
|
| +// Tests that FindBar fits within a narrow browser window.
|
| +IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) {
|
| + Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile());
|
| + params.initial_bounds = gfx::Rect(0, 0, 250, 500);
|
| + Browser* popup = Browser::CreateWithParams(params);
|
| + popup->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL),
|
| + PageTransition::LINK);
|
| +
|
| + // Wait for the page to finish loading.
|
| + ui_test_utils::WaitForNavigation(
|
| + &popup->GetSelectedTabContents()->controller());
|
| + popup->window()->Show();
|
| +
|
| + // On GTK, bounds change is asynchronous.
|
| + MessageLoop::current()->RunAllPending();
|
| +
|
| + EnsureFindBoxOpenForBrowser(popup);
|
| +
|
| + // GTK adjusts FindBar size asynchronously.
|
| + MessageLoop::current()->RunAllPending();
|
| +
|
| + ASSERT_LE(GetFindBarWidthForBrowser(popup),
|
| + popup->window()->GetBounds().width());
|
| +}
|
|
|