| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/app/chrome_dll_resource.h" | 5 #include "chrome/app/chrome_dll_resource.h" |
| 6 #include "chrome/browser/views/find_bar_win.h" | 6 #include "chrome/browser/views/find_bar_win.h" |
| 7 #include "chrome/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
| 8 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
| 9 #include "chrome/test/automation/window_proxy.h" | 9 #include "chrome/test/automation/window_proxy.h" |
| 10 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 254 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 255 ASSERT_TRUE(browser.get() != NULL); | 255 ASSERT_TRUE(browser.get() != NULL); |
| 256 | 256 |
| 257 // Toggle the bookmark bar state. | 257 // Toggle the bookmark bar state. |
| 258 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR); | 258 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR); |
| 259 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); | 259 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); |
| 260 | 260 |
| 261 // Open the Find window and wait for it to animate. | 261 // Open the Find window and wait for it to animate. |
| 262 EXPECT_TRUE(tabA->OpenFindInPage()); | 262 EXPECT_TRUE(tabA->OpenFindInPage()); |
| 263 EXPECT_TRUE(WaitForFindWindowFullyVisible(tabA.get())); | 263 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tabA.get(), true)); |
| 264 | 264 |
| 265 // Find its location. | 265 // Find its location. |
| 266 int x = -1, y = -1; | 266 int x = -1, y = -1; |
| 267 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); | 267 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); |
| 268 | 268 |
| 269 // Open another tab (tab B). | 269 // Open another tab (tab B). |
| 270 EXPECT_TRUE(browser->AppendTab(url)); | 270 EXPECT_TRUE(browser->AppendTab(url)); |
| 271 scoped_ptr<TabProxy> tabB(GetActiveTab()); | 271 scoped_ptr<TabProxy> tabB(GetActiveTab()); |
| 272 | 272 |
| 273 // Close tab B. | 273 // Close tab B. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 293 | 293 |
| 294 // Close it. | 294 // Close it. |
| 295 EXPECT_TRUE(tabC->Close(true)); | 295 EXPECT_TRUE(tabC->Close(true)); |
| 296 | 296 |
| 297 // See if the Find window has moved. | 297 // See if the Find window has moved. |
| 298 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); | 298 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); |
| 299 | 299 |
| 300 EXPECT_EQ(x, new_x); | 300 EXPECT_EQ(x, new_x); |
| 301 EXPECT_EQ(y, new_y); | 301 EXPECT_EQ(y, new_y); |
| 302 } | 302 } |
| 303 |
| 304 // Make sure Find box disappears on Navigate but not on Refresh. |
| 305 TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { |
| 306 TestServer server(L"chrome/test/data"); |
| 307 |
| 308 GURL url = server.TestServerPageW(kUserSelectPage); |
| 309 scoped_ptr<TabProxy> tab(GetActiveTab()); |
| 310 ASSERT_TRUE(tab->NavigateToURL(url)); |
| 311 WaitUntilTabCount(1); |
| 312 |
| 313 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 314 ASSERT_TRUE(browser.get() != NULL); |
| 315 |
| 316 // Open the Find window and wait for it to animate. |
| 317 EXPECT_TRUE(tab->OpenFindInPage()); |
| 318 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), true)); |
| 319 |
| 320 // Reload the tab and make sure Find box doesn't go away. |
| 321 EXPECT_TRUE(tab->Reload()); |
| 322 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), true)); |
| 323 |
| 324 // Navigate and make sure the Find box goes away. |
| 325 EXPECT_TRUE(tab->NavigateToURL(url)); |
| 326 EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), false)); |
| 327 } |
| OLD | NEW |