diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 16:31:57 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 16:31:57 +0000 |
commit | 20e93d1f20dc0e3c626a2500c96f85e89cf184c9 (patch) | |
tree | 80307da7589ce802e88ca79c6b60493496770e80 /chrome/browser/find_in_page_controller_uitest.cc | |
parent | 50664fdc92a8d1db14d83c902f67b7a8dce76480 (diff) | |
download | chromium_src-20e93d1f20dc0e3c626a2500c96f85e89cf184c9.zip chromium_src-20e93d1f20dc0e3c626a2500c96f85e89cf184c9.tar.gz chromium_src-20e93d1f20dc0e3c626a2500c96f85e89cf184c9.tar.bz2 |
Adding a test to catch regressions where the Find box moves when you open and close a tab. Test is disabled until we fix the bug.
Also made the error message for when tests fails because crash_service isn't running a bit explicit (unrelated to the rest of this change).
BUG=1343052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/find_in_page_controller_uitest.cc')
-rw-r--r-- | chrome/browser/find_in_page_controller_uitest.cc | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/chrome/browser/find_in_page_controller_uitest.cc b/chrome/browser/find_in_page_controller_uitest.cc index 2845c07..c20a220 100644 --- a/chrome/browser/find_in_page_controller_uitest.cc +++ b/chrome/browser/find_in_page_controller_uitest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/find_in_page_controller.h" +#include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" +#include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/ui_test.h" #include "net/url_request/url_request_unittest.h" @@ -116,3 +119,63 @@ TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1341577) { // properly after a timeout, it will find 5 matches, not just 1. EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false)); } + +// The find window should not change its location just because we open and close +// a new tab. +TEST_F(FindInPageControllerTest, DISABLED_FindMovesOnTabClose_Issue1343052) { + TestServer server(L"chrome/test/data"); + + GURL url = server.TestServerPageW(kFramePage); + scoped_ptr<TabProxy> tabA(GetActiveTab()); + ASSERT_TRUE(tabA->NavigateToURL(url)); + + scoped_ptr<WindowProxy> window(automation()->GetActiveWindow()); + EXPECT_TRUE(window.get() != NULL); + + scoped_ptr<BrowserProxy> browser( + automation()->GetBrowserForWindow(window.get())); + + // Toggle the bookmark bar state. + browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); + + // Open the Find window and wait for it to animate. + EXPECT_TRUE(tabA->OpenFindInPage()); + EXPECT_TRUE(WaitForFindWindowFullyVisible(tabA.get())); + + // Find its location. + int x = -1, y = -1; + EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); + + // Open another tab (tab B). + EXPECT_TRUE(browser->AppendTab(url)); + scoped_ptr<TabProxy> tabB(GetActiveTab()); + + // Close tab B. + EXPECT_TRUE(tabB->Close(true)); + + // See if the Find window has moved. + int new_x = -1, new_y = -1; + EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); + + EXPECT_EQ(x, new_x); + EXPECT_EQ(y, new_y); + + // Now reset the bookmarks bar state and try the same again. + browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); + + // Bookmark bar has moved, reset our coordinates. + EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); + + // Open another tab (tab C). + EXPECT_TRUE(browser->AppendTab(url)); + scoped_ptr<TabProxy> tabC(GetActiveTab()); + + // Close it. + EXPECT_TRUE(tabC->Close(true)); + + // See if the Find window has moved. + EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); + + EXPECT_EQ(x, new_x); + EXPECT_EQ(y, new_y); +} |