diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 00:10:29 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 00:10:29 +0000 |
commit | 4f3dc3751d69f9db1f8ef533a3335201b3bc78bc (patch) | |
tree | e37efecf992ddd4e901c894273cbb1e5bf4260cc /chrome/test | |
parent | 5e7f161f73f1817b8a0c422c0e4b5eceae6954e7 (diff) | |
download | chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.zip chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.tar.gz chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.tar.bz2 |
The find bar should be owned and managed from the BrowserView, not the WebContentsView, since it's part of the "chrome".
Design Doc: http://dev.chromium.org/developers/design-documents/find-bar
Things done:
- Pulled all of the find bar stuff out of WebContentsView* since it's no longer needed.
- Moved OnFindReply delegate method from RenderViewHostDelegate::View to RenderViewHostDelegate, since it's no longer implemented on the view.
- Moved find control methods to WebContents.
- Added recent find result state to WebContents.
- Updated the UI tests to accommodate the changes in the state that is broadcast when results are discovered.
- Updated the find bar layout to obtain its bounding box from the BrowserView, which knows about toolbars, bookmark bars etc.
- Updated the find bar itself to handle the fact that it can be displayed for multiple different tabs.
- Moved the find bar manipulation methods for testing from TabProxy to BrowserProxy, since the find bar is now a feature of the window, not the tab.
- view.h: Don't lay out child views again if they have a layout manager, it already updated them.
TEST=Find box should work as before.
BUG=3245
Review URL: http://codereview.chromium.org/27025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 31 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.h | 12 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 29 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.h | 12 | ||||
-rw-r--r-- | chrome/test/test_browser_window.h | 4 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 9 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 4 |
7 files changed, 51 insertions, 50 deletions
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 87f2746..c13fd29 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -251,6 +251,35 @@ bool BrowserProxy::WaitForTabToBecomeActive(int tab, return false; } +bool BrowserProxy::OpenFindInPage() { + if (!is_valid()) + return false; + + return sender_->Send(new AutomationMsg_OpenFindInPage(0, handle_)); + // This message expects no response. +} + +bool BrowserProxy::GetFindWindowLocation(int* x, int* y) { + if (!is_valid() || !x || !y) + return false; + + return sender_->Send( + new AutomationMsg_FindWindowLocation(0, handle_, x, y)); +} + +bool BrowserProxy::IsFindWindowFullyVisible(bool* is_visible) { + if (!is_valid()) + return false; + + if (!is_visible) { + NOTREACHED(); + return false; + } + + return sender_->Send( + new AutomationMsg_FindWindowVisibility(0, handle_, is_visible)); +} + bool BrowserProxy::GetHWND(HWND* handle) const { if (!is_valid()) return false; @@ -319,7 +348,7 @@ bool BrowserProxy::GetBooleanPreference(const std::wstring& name, return false; bool result = false; - + sender_->Send(new AutomationMsg_GetBooleanPreference(0, handle_, name, value, &result)); return result; diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index 4df9269..9a61993 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -144,6 +144,18 @@ class BrowserProxy : public AutomationResourceProxy { // Returns false if the tab does not become active. bool WaitForTabToBecomeActive(int tab, int wait_timeout); + // Opens the FindInPage box. Note: If you just want to search within a tab + // you don't need to call this function, just use FindInPage(...) directly. + bool OpenFindInPage(); + + // Get the x, y coordinates for the Find window. If animating, |x| and |y| + // will be -1, -1. Returns false on failure. + bool GetFindWindowLocation(int* x, int* y); + + // Returns whether the Find window is fully visible If animating, |is_visible| + // will be false. Returns false on failure. + bool IsFindWindowFullyVisible(bool* is_visible); + // Gets the outermost HWND that corresponds to the given browser. // Returns true if the call was successful. // Note that ideally this should go and the version of WindowProxy should be diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index f0f9a72..e36d683 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -43,35 +43,6 @@ bool TabProxy::IsShelfVisible(bool* is_visible) { is_visible)); } -bool TabProxy::OpenFindInPage() { - if (!is_valid()) - return false; - - return sender_->Send(new AutomationMsg_OpenFindInPage(0, handle_)); - // This message expects no response. -} - -bool TabProxy::IsFindWindowFullyVisible(bool* is_visible) { - if (!is_valid()) - return false; - - if (!is_visible) { - NOTREACHED(); - return false; - } - - return sender_->Send(new AutomationMsg_FindWindowVisibility( - 0, handle_, is_visible)); -} - -bool TabProxy::GetFindWindowLocation(int* x, int* y) { - if (!is_valid() || !x || !y) - return false; - - return sender_->Send(new AutomationMsg_FindWindowLocation( - 0, handle_, x, y)); -} - int TabProxy::FindInPage(const std::wstring& search_string, FindInPageDirection forward, FindInPageCase match_case, diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index f9a8339..1e393f54 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -159,18 +159,6 @@ class TabProxy : public AutomationResourceProxy { // unchanged. bool IsShelfVisible(bool* is_visible); - // Opens the FindInPage box. Note: If you just want to search within a tab - // you don't need to call this function, just use FindInPage(...) directly. - bool OpenFindInPage(); - - // Returns whether the Find window is fully visible If animating, |is_visible| - // will be false. Returns false on failure. - bool IsFindWindowFullyVisible(bool* is_visible); - - // Get the x, y coordinates for the Find window. If animating, |x| and |y| - // will be -1, -1. Returns false on failure. - bool GetFindWindowLocation(int* x, int* y); - // Starts a search within the current tab. The parameter |search_string| // specifies what string to search for, |forward| specifies whether to search // in forward direction, and |match_case| specifies case sensitivity diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h index f474f71..e583400 100644 --- a/chrome/test/test_browser_window.h +++ b/chrome/test/test_browser_window.h @@ -48,6 +48,7 @@ class TestBrowserWindow : public BrowserWindow { virtual bool IsBookmarkBarVisible() const { return false; } virtual gfx::Rect GetRootWindowResizerRect() const { return gfx::Rect(); } virtual void ToggleBookmarkBar() {} + virtual void ShowFindBar() {} virtual void ShowAboutChromeDialog() {} virtual void ShowBookmarkManager() {} virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) {} @@ -60,7 +61,8 @@ class TestBrowserWindow : public BrowserWindow { virtual void ShowNewProfileDialog() {} virtual void ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, void* parent_window) {} - + virtual bool GetFindBarWindowInfo(gfx::Point* position, + bool* fully_visible) const { return false; } protected: virtual void DestroyBrowser() {} diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index fc3b9a0..ff30346 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -399,7 +399,6 @@ void UITest::QuitBrowser() { browsers.push_back(browser_proxy); } - //for (HandleVector::iterator iter = handles.begin(); iter != handles.end(); for (BrowserVector::iterator iter = browsers.begin(); iter != browsers.end(); ++iter) { // Use ApplyAccelerator since it doesn't wait @@ -518,12 +517,12 @@ bool UITest::WaitForDownloadShelfVisible(TabProxy* tab) { return false; } -bool UITest::WaitForFindWindowVisibilityChange(TabProxy* tab, +bool UITest::WaitForFindWindowVisibilityChange(BrowserProxy* browser, bool wait_for_open) { const int kCycles = 20; for (int i = 0; i < kCycles; i++) { bool visible = false; - if (!tab->IsFindWindowFullyVisible(&visible)) + if (!browser->IsFindWindowFullyVisible(&visible)) return false; // Some error. if (visible == wait_for_open) return true; // Find window visibility change complete. @@ -775,7 +774,7 @@ void UITest::WaitForFinish(const std::string &name, // The webpage being tested has javascript which sets a cookie // which signals completion of the test. The cookie name is // a concatenation of the test name and the test id. This allows - // us to run multiple tests within a single webpage and test + // us to run multiple tests within a single webpage and test // that they all c std::string cookie_name = name; cookie_name.append("."); @@ -785,7 +784,7 @@ void UITest::WaitForFinish(const std::string &name, scoped_ptr<TabProxy> tab(GetActiveTab()); - bool test_result = WaitUntilCookieValue(tab.get(), url, + bool test_result = WaitUntilCookieValue(tab.get(), url, cookie_name.c_str(), kIntervalMilliSeconds, wait_time, expected_cookie_value.c_str()); diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index 31ad827..a0436f9 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -145,7 +145,7 @@ class UITest : public testing::Test { // Waits until the Find window has become fully visible (if |wait_for_open| is // true) or fully hidden (if |wait_for_open| is false). This function can time // out (return false) if the window doesn't appear within a specific time. - bool WaitForFindWindowVisibilityChange(TabProxy* tab, + bool WaitForFindWindowVisibilityChange(BrowserProxy* browser, bool wait_for_open); // Waits until the Bookmark bar has stopped animating and become fully visible @@ -334,7 +334,7 @@ class UITest : public testing::Test { DictionaryValue* GetDefaultProfilePreferences(); // Generate the URL for testing a particular test. - // HTML for the tests is all located in + // HTML for the tests is all located in // test_root_directory\test_directory\<testcase> static GURL GetTestUrl(const std::wstring& test_directory, const std::wstring &test_case); |