Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4421)

Unified Diff: chrome/browser/ui/find_bar/find_bar_host_browsertest.cc

Issue 7063003: Make FindBar obey dialog bounds for GTK. Will fix other platforms in separate patches. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switched to container_->allocation.width Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar.h ('k') | chrome/browser/ui/gtk/find_bar_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+}
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar.h ('k') | chrome/browser/ui/gtk/find_bar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698