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

Side by Side Diff: chrome/browser/views/find_bar_win_uitest.cc

Issue 28162: Fix 8063: Find-in-page remains open on History/Downloads page... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/find_bar_win.cc ('k') | chrome/browser/views/frame/browser_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "net/url_request/url_request_unittest.h" 11 #include "net/url_request/url_request_unittest.h"
12 12
13 class FindInPageControllerTest : public UITest { 13 class FindInPageControllerTest : public UITest {
14 public: 14 public:
15 FindInPageControllerTest() { 15 FindInPageControllerTest() {
16 show_window_ = true; 16 show_window_ = true;
17 } 17 }
18 }; 18 };
19 19
20 const std::wstring kSimplePage = L"404_is_enough_for_us.html";
20 const std::wstring kFramePage = L"files/find_in_page/frames.html"; 21 const std::wstring kFramePage = L"files/find_in_page/frames.html";
21 const std::wstring kFrameData = L"files/find_in_page/framedata_general.html"; 22 const std::wstring kFrameData = L"files/find_in_page/framedata_general.html";
22 const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html"; 23 const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html";
23 const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html"; 24 const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html";
24 const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html"; 25 const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html";
25 26
26 // This test loads a single-frame page and makes sure the ordinal returned makes 27 // This test loads a single-frame page and makes sure the ordinal returned makes
27 // sense as we FindNext over all the items. 28 // sense as we FindNext over all the items.
28 TEST_F(FindInPageControllerTest, FindInPageOrdinal) { 29 TEST_F(FindInPageControllerTest, FindInPageOrdinal) {
29 scoped_refptr<HTTPTestServer> server = 30 scoped_refptr<HTTPTestServer> server =
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false, NULL)); 192 EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false, NULL));
192 } 193 }
193 194
194 // The find window should not change its location just because we open and close 195 // The find window should not change its location just because we open and close
195 // a new tab. 196 // a new tab.
196 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { 197 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) {
197 scoped_refptr<HTTPTestServer> server = 198 scoped_refptr<HTTPTestServer> server =
198 HTTPTestServer::CreateServer(L"chrome/test/data", NULL); 199 HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
199 ASSERT_TRUE(NULL != server.get()); 200 ASSERT_TRUE(NULL != server.get());
200 201
201 GURL url = server->TestServerPageW(kFramePage); 202 GURL url = server->TestServerPageW(kSimplePage);
202 scoped_ptr<TabProxy> tabA(GetActiveTab()); 203 scoped_ptr<TabProxy> tabA(GetActiveTab());
203 ASSERT_TRUE(tabA->NavigateToURL(url)); 204 ASSERT_TRUE(tabA->NavigateToURL(url));
204 WaitUntilTabCount(1); 205 WaitUntilTabCount(1);
205 206
206 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 207 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
207 ASSERT_TRUE(browser.get() != NULL); 208 ASSERT_TRUE(browser.get() != NULL);
208 209
209 // Toggle the bookmark bar state. 210 // Toggle the bookmark bar state.
210 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR); 211 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR);
211 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); 212 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 EXPECT_EQ(x, new_x); 253 EXPECT_EQ(x, new_x);
253 EXPECT_EQ(y, new_y); 254 EXPECT_EQ(y, new_y);
254 } 255 }
255 256
256 // Make sure Find box disappears on Navigate but not on Refresh. 257 // Make sure Find box disappears on Navigate but not on Refresh.
257 TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { 258 TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
258 scoped_refptr<HTTPTestServer> server = 259 scoped_refptr<HTTPTestServer> server =
259 HTTPTestServer::CreateServer(L"chrome/test/data", NULL); 260 HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
260 ASSERT_TRUE(NULL != server.get()); 261 ASSERT_TRUE(NULL != server.get());
261 262
262 GURL url = server->TestServerPageW(kUserSelectPage); 263 GURL url = server->TestServerPageW(kSimplePage);
263 GURL url2 = server->TestServerPageW(kFramePage); 264 GURL url2 = server->TestServerPageW(kFramePage);
264 scoped_ptr<TabProxy> tab(GetActiveTab()); 265 scoped_ptr<TabProxy> tab(GetActiveTab());
265 ASSERT_TRUE(tab->NavigateToURL(url)); 266 ASSERT_TRUE(tab->NavigateToURL(url));
266 WaitUntilTabCount(1); 267 WaitUntilTabCount(1);
267 268
268 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 269 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
269 ASSERT_TRUE(browser.get() != NULL); 270 ASSERT_TRUE(browser.get() != NULL);
270 271
271 // Open the Find window and wait for it to animate. 272 // Open the Find window and wait for it to animate.
272 EXPECT_TRUE(browser->OpenFindInPage()); 273 EXPECT_TRUE(browser->OpenFindInPage());
273 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true)); 274 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true));
274 275
275 // Reload the tab and make sure Find box doesn't go away. 276 // Reload the tab and make sure Find box doesn't go away.
276 EXPECT_TRUE(tab->Reload()); 277 EXPECT_TRUE(tab->Reload());
277 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true)); 278 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true));
278 279
279 // Navigate and make sure the Find box goes away. 280 // Navigate and make sure the Find box goes away.
280 EXPECT_TRUE(tab->NavigateToURL(url2)); 281 EXPECT_TRUE(tab->NavigateToURL(url2));
281 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), false)); 282 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), false));
282 } 283 }
284
285 // Make sure Find box disappears when History/Downloads page is opened, and
286 // when a New Tab is opened.
287 TEST_F(FindInPageControllerTest, FindDisappearOnNewTabAndHistory) {
288 scoped_refptr<HTTPTestServer> server =
289 HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
290 ASSERT_TRUE(NULL != server.get());
291
292 GURL url = server->TestServerPageW(kSimplePage);
293 scoped_ptr<TabProxy> tab(GetActiveTab());
294 ASSERT_TRUE(tab->NavigateToURL(url));
295 WaitUntilTabCount(1);
296
297 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
298 ASSERT_TRUE(browser.get() != NULL);
299
300 // Open the Find window and wait for it to animate.
301 EXPECT_TRUE(browser->OpenFindInPage());
302 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true));
303
304 // Open another tab (tab B).
305 EXPECT_TRUE(browser->AppendTab(url));
306 scoped_ptr<TabProxy> tabB(GetActiveTab());
307
308 // Wait for the Find box to disappear.
309 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), false));
310
311 // Close tab B.
312 EXPECT_TRUE(tabB->Close(true));
313
314 // Wait for the Find box to appear again.
315 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true));
316
317 // Open History page.
318 EXPECT_TRUE(browser->RunCommand(IDC_SHOW_HISTORY));
319
320 // Wait for the Find box to disappear.
321 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), false));
322 }
OLDNEW
« no previous file with comments | « chrome/browser/views/find_bar_win.cc ('k') | chrome/browser/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698