OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/keyboard_codes.h" | 5 #include "base/keyboard_codes.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/browser_window.h" | 8 #include "chrome/browser/browser_window.h" |
9 #include "chrome/browser/find_bar.h" | 9 #include "chrome/browser/find_bar.h" |
10 #include "chrome/browser/find_bar_controller.h" | 10 #include "chrome/browser/find_bar_controller.h" |
11 #include "chrome/browser/find_notification_details.h" | 11 #include "chrome/browser/find_notification_details.h" |
12 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
13 #include "chrome/browser/renderer_host/render_view_host.h" | 13 #include "chrome/browser/renderer_host/render_view_host.h" |
14 #include "chrome/browser/tab_contents/tab_contents.h" | 14 #include "chrome/browser/tab_contents/tab_contents.h" |
15 #include "chrome/browser/tab_contents/tab_contents_view.h" | 15 #include "chrome/browser/tab_contents/tab_contents_view.h" |
16 #include "chrome/common/notification_service.h" | 16 #include "chrome/common/notification_service.h" |
17 #include "chrome/test/in_process_browser_test.h" | 17 #include "chrome/test/in_process_browser_test.h" |
18 #include "chrome/test/ui_test_utils.h" | 18 #include "chrome/test/ui_test_utils.h" |
| 19 #include "net/test/test_server.h" |
19 | 20 |
20 #if defined(TOOLKIT_VIEWS) | 21 #if defined(TOOLKIT_VIEWS) |
21 #include "chrome/browser/views/find_bar_host.h" | 22 #include "chrome/browser/views/find_bar_host.h" |
22 #include "views/focus/focus_manager.h" | 23 #include "views/focus/focus_manager.h" |
23 #elif defined(TOOLKIT_GTK) | 24 #elif defined(TOOLKIT_GTK) |
24 #include "chrome/browser/gtk/slide_animator_gtk.h" | 25 #include "chrome/browser/gtk/slide_animator_gtk.h" |
25 #elif defined(OS_MACOSX) | 26 #elif defined(OS_MACOSX) |
26 #include "chrome/browser/cocoa/find_bar_bridge.h" | 27 #include "chrome/browser/cocoa/find_bar_bridge.h" |
27 #endif | 28 #endif |
28 | 29 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 bool forward, | 107 bool forward, |
107 bool case_sensitive, | 108 bool case_sensitive, |
108 int* ordinal) { | 109 int* ordinal) { |
109 return ui_test_utils::FindInPage( | 110 return ui_test_utils::FindInPage( |
110 tab, WideToUTF16(std::wstring(search_str)), | 111 tab, WideToUTF16(std::wstring(search_str)), |
111 forward, case_sensitive, ordinal); | 112 forward, case_sensitive, ordinal); |
112 } | 113 } |
113 | 114 |
114 // This test loads a page with frames and starts FindInPage requests. | 115 // This test loads a page with frames and starts FindInPage requests. |
115 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFrames) { | 116 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFrames) { |
116 HTTPTestServer* server = StartHTTPServer(); | 117 net::HTTPTestServer* server = StartHTTPServer(); |
117 ASSERT_TRUE(server); | 118 ASSERT_TRUE(server); |
118 | 119 |
119 // First we navigate to our frames page. | 120 // First we navigate to our frames page. |
120 GURL url = server->TestServerPage(kFramePage); | 121 GURL url = server->TestServerPage(kFramePage); |
121 ui_test_utils::NavigateToURL(browser(), url); | 122 ui_test_utils::NavigateToURL(browser(), url); |
122 | 123 |
123 // Try incremental search (mimicking user typing in). | 124 // Try incremental search (mimicking user typing in). |
124 int ordinal = 0; | 125 int ordinal = 0; |
125 TabContents* tab = browser()->GetSelectedTabContents(); | 126 TabContents* tab = browser()->GetSelectedTabContents(); |
126 EXPECT_EQ(18, FindInPageWchar(tab, L"g", | 127 EXPECT_EQ(18, FindInPageWchar(tab, L"g", |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 L"", | 200 L"", |
200 L"window.domAutomationController.send(getFocusedElement());", | 201 L"window.domAutomationController.send(getFocusedElement());", |
201 &result); | 202 &result); |
202 return result; | 203 return result; |
203 } | 204 } |
204 | 205 |
205 // This tests the FindInPage end-state, in other words: what is focused when you | 206 // This tests the FindInPage end-state, in other words: what is focused when you |
206 // close the Find box (ie. if you find within a link the link should be | 207 // close the Find box (ie. if you find within a link the link should be |
207 // focused). | 208 // focused). |
208 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { | 209 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { |
209 HTTPTestServer* server = StartHTTPServer(); | 210 net::HTTPTestServer* server = StartHTTPServer(); |
210 ASSERT_TRUE(server); | 211 ASSERT_TRUE(server); |
211 | 212 |
212 // First we navigate to our special focus tracking page. | 213 // First we navigate to our special focus tracking page. |
213 GURL url = server->TestServerPage(kEndState); | 214 GURL url = server->TestServerPage(kEndState); |
214 ui_test_utils::NavigateToURL(browser(), url); | 215 ui_test_utils::NavigateToURL(browser(), url); |
215 | 216 |
216 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 217 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
217 ASSERT_TRUE(NULL != tab_contents); | 218 ASSERT_TRUE(NULL != tab_contents); |
218 | 219 |
219 // Verify that nothing has focus. | 220 // Verify that nothing has focus. |
(...skipping 27 matching lines...) Expand all Loading... |
247 // End the find session. | 248 // End the find session. |
248 tab_contents->StopFinding(FindBarController::kKeepSelection); | 249 tab_contents->StopFinding(FindBarController::kKeepSelection); |
249 | 250 |
250 // Verify that link2 is not focused. | 251 // Verify that link2 is not focused. |
251 EXPECT_STREQ("", FocusedOnPage(tab_contents).c_str()); | 252 EXPECT_STREQ("", FocusedOnPage(tab_contents).c_str()); |
252 } | 253 } |
253 | 254 |
254 // This test loads a single-frame page and makes sure the ordinal returned makes | 255 // This test loads a single-frame page and makes sure the ordinal returned makes |
255 // sense as we FindNext over all the items. | 256 // sense as we FindNext over all the items. |
256 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageOrdinal) { | 257 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageOrdinal) { |
257 HTTPTestServer* server = StartHTTPServer(); | 258 net::HTTPTestServer* server = StartHTTPServer(); |
258 ASSERT_TRUE(server); | 259 ASSERT_TRUE(server); |
259 | 260 |
260 // First we navigate to our page. | 261 // First we navigate to our page. |
261 GURL url = server->TestServerPage(kFrameData); | 262 GURL url = server->TestServerPage(kFrameData); |
262 ui_test_utils::NavigateToURL(browser(), url); | 263 ui_test_utils::NavigateToURL(browser(), url); |
263 | 264 |
264 // Search for 'o', which should make the first item active and return | 265 // Search for 'o', which should make the first item active and return |
265 // '1 in 3' (1st ordinal of a total of 3 matches). | 266 // '1 in 3' (1st ordinal of a total of 3 matches). |
266 TabContents* tab = browser()->GetSelectedTabContents(); | 267 TabContents* tab = browser()->GetSelectedTabContents(); |
267 int ordinal = 0; | 268 int ordinal = 0; |
(...skipping 19 matching lines...) Expand all Loading... |
287 EXPECT_EQ(1, ordinal); | 288 EXPECT_EQ(1, ordinal); |
288 // This should go back to the end. | 289 // This should go back to the end. |
289 EXPECT_EQ(3, FindInPageWchar(tab, L"o", | 290 EXPECT_EQ(3, FindInPageWchar(tab, L"o", |
290 kBack, kIgnoreCase, &ordinal)); | 291 kBack, kIgnoreCase, &ordinal)); |
291 EXPECT_EQ(3, ordinal); | 292 EXPECT_EQ(3, ordinal); |
292 } | 293 } |
293 | 294 |
294 // This tests that the ordinal is correctly adjusted after a selection | 295 // This tests that the ordinal is correctly adjusted after a selection |
295 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 296 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
296 SelectChangesOrdinal_Issue20883) { | 297 SelectChangesOrdinal_Issue20883) { |
297 HTTPTestServer* server = StartHTTPServer(); | 298 net::HTTPTestServer* server = StartHTTPServer(); |
298 ASSERT_TRUE(server); | 299 ASSERT_TRUE(server); |
299 | 300 |
300 // First we navigate to our test content. | 301 // First we navigate to our test content. |
301 GURL url = server->TestServerPage(kSelectChangesOrdinal); | 302 GURL url = server->TestServerPage(kSelectChangesOrdinal); |
302 ui_test_utils::NavigateToURL(browser(), url); | 303 ui_test_utils::NavigateToURL(browser(), url); |
303 | 304 |
304 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 305 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
305 ASSERT_TRUE(NULL != tab_contents); | 306 ASSERT_TRUE(NULL != tab_contents); |
306 | 307 |
307 // Search for a text that exists within a link on the page. | 308 // Search for a text that exists within a link on the page. |
(...skipping 19 matching lines...) Expand all Loading... |
327 kFwd, kIgnoreCase, &ordinal)); | 328 kFwd, kIgnoreCase, &ordinal)); |
328 EXPECT_EQ(3, ordinal); | 329 EXPECT_EQ(3, ordinal); |
329 | 330 |
330 // End the find session. | 331 // End the find session. |
331 tab_contents->StopFinding(FindBarController::kKeepSelection); | 332 tab_contents->StopFinding(FindBarController::kKeepSelection); |
332 } | 333 } |
333 | 334 |
334 // This test loads a page with frames and makes sure the ordinal returned makes | 335 // This test loads a page with frames and makes sure the ordinal returned makes |
335 // sense. | 336 // sense. |
336 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) { | 337 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) { |
337 HTTPTestServer* server = StartHTTPServer(); | 338 net::HTTPTestServer* server = StartHTTPServer(); |
338 ASSERT_TRUE(server); | 339 ASSERT_TRUE(server); |
339 | 340 |
340 // First we navigate to our page. | 341 // First we navigate to our page. |
341 GURL url = server->TestServerPage(kFramePage); | 342 GURL url = server->TestServerPage(kFramePage); |
342 ui_test_utils::NavigateToURL(browser(), url); | 343 ui_test_utils::NavigateToURL(browser(), url); |
343 | 344 |
344 // Search for 'a', which should make the first item active and return | 345 // Search for 'a', which should make the first item active and return |
345 // '1 in 7' (1st ordinal of a total of 7 matches). | 346 // '1 in 7' (1st ordinal of a total of 7 matches). |
346 TabContents* tab = browser()->GetSelectedTabContents(); | 347 TabContents* tab = browser()->GetSelectedTabContents(); |
347 int ordinal = 0; | 348 int ordinal = 0; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 EXPECT_EQ(1, ordinal); | 380 EXPECT_EQ(1, ordinal); |
380 // Now we should wrap back to frame last frame. | 381 // Now we should wrap back to frame last frame. |
381 EXPECT_EQ(7, | 382 EXPECT_EQ(7, |
382 FindInPageWchar(tab, L"a", kBack, kIgnoreCase, &ordinal)); | 383 FindInPageWchar(tab, L"a", kBack, kIgnoreCase, &ordinal)); |
383 EXPECT_EQ(7, ordinal); | 384 EXPECT_EQ(7, ordinal); |
384 } | 385 } |
385 | 386 |
386 // We could get ordinals out of whack when restarting search in subframes. | 387 // We could get ordinals out of whack when restarting search in subframes. |
387 // See http://crbug.com/5132. | 388 // See http://crbug.com/5132. |
388 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPage_Issue5132) { | 389 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPage_Issue5132) { |
389 HTTPTestServer* server = StartHTTPServer(); | 390 net::HTTPTestServer* server = StartHTTPServer(); |
390 ASSERT_TRUE(server); | 391 ASSERT_TRUE(server); |
391 | 392 |
392 // First we navigate to our page. | 393 // First we navigate to our page. |
393 GURL url = server->TestServerPage(kFramePage); | 394 GURL url = server->TestServerPage(kFramePage); |
394 ui_test_utils::NavigateToURL(browser(), url); | 395 ui_test_utils::NavigateToURL(browser(), url); |
395 | 396 |
396 // Search for 'goa' three times (6 matches on page). | 397 // Search for 'goa' three times (6 matches on page). |
397 int ordinal = 0; | 398 int ordinal = 0; |
398 TabContents* tab = browser()->GetSelectedTabContents(); | 399 TabContents* tab = browser()->GetSelectedTabContents(); |
399 EXPECT_EQ(6, FindInPageWchar(tab, L"goa", | 400 EXPECT_EQ(6, FindInPageWchar(tab, L"goa", |
(...skipping 10 matching lines...) Expand all Loading... |
410 kFwd, kIgnoreCase, &ordinal)); | 411 kFwd, kIgnoreCase, &ordinal)); |
411 EXPECT_EQ(0, ordinal); | 412 EXPECT_EQ(0, ordinal); |
412 // Remove the space, should be back to '3 out of 6') | 413 // Remove the space, should be back to '3 out of 6') |
413 EXPECT_EQ(6, FindInPageWchar(tab, L"goa", | 414 EXPECT_EQ(6, FindInPageWchar(tab, L"goa", |
414 kFwd, kIgnoreCase, &ordinal)); | 415 kFwd, kIgnoreCase, &ordinal)); |
415 EXPECT_EQ(3, ordinal); | 416 EXPECT_EQ(3, ordinal); |
416 } | 417 } |
417 | 418 |
418 // Load a page with no selectable text and make sure we don't crash. | 419 // Load a page with no selectable text and make sure we don't crash. |
419 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindUnSelectableText) { | 420 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindUnSelectableText) { |
420 HTTPTestServer* server = StartHTTPServer(); | 421 net::HTTPTestServer* server = StartHTTPServer(); |
421 ASSERT_TRUE(server); | 422 ASSERT_TRUE(server); |
422 | 423 |
423 // First we navigate to our page. | 424 // First we navigate to our page. |
424 GURL url = server->TestServerPage(kUserSelectPage); | 425 GURL url = server->TestServerPage(kUserSelectPage); |
425 ui_test_utils::NavigateToURL(browser(), url); | 426 ui_test_utils::NavigateToURL(browser(), url); |
426 | 427 |
427 int ordinal = 0; | 428 int ordinal = 0; |
428 TabContents* tab = browser()->GetSelectedTabContents(); | 429 TabContents* tab = browser()->GetSelectedTabContents(); |
429 EXPECT_EQ(0, FindInPageWchar(tab, L"text", | 430 EXPECT_EQ(0, FindInPageWchar(tab, L"text", |
430 kFwd, kIgnoreCase, &ordinal)); | 431 kFwd, kIgnoreCase, &ordinal)); |
431 EXPECT_EQ(-1, ordinal); // Nothing is selected. | 432 EXPECT_EQ(-1, ordinal); // Nothing is selected. |
432 EXPECT_EQ(0, FindInPageWchar(tab, L"Non-existing string", | 433 EXPECT_EQ(0, FindInPageWchar(tab, L"Non-existing string", |
433 kFwd, kIgnoreCase, &ordinal)); | 434 kFwd, kIgnoreCase, &ordinal)); |
434 EXPECT_EQ(0, ordinal); | 435 EXPECT_EQ(0, ordinal); |
435 } | 436 } |
436 | 437 |
437 // Try to reproduce the crash seen in issue 1341577. | 438 // Try to reproduce the crash seen in issue 1341577. |
438 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { | 439 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { |
439 HTTPTestServer* server = StartHTTPServer(); | 440 net::HTTPTestServer* server = StartHTTPServer(); |
440 ASSERT_TRUE(server); | 441 ASSERT_TRUE(server); |
441 | 442 |
442 // First we navigate to our page. | 443 // First we navigate to our page. |
443 GURL url = server->TestServerPage(kCrashPage); | 444 GURL url = server->TestServerPage(kCrashPage); |
444 ui_test_utils::NavigateToURL(browser(), url); | 445 ui_test_utils::NavigateToURL(browser(), url); |
445 | 446 |
446 // This would crash the tab. These must be the first two find requests issued | 447 // This would crash the tab. These must be the first two find requests issued |
447 // against the frame, otherwise an active frame pointer is set and it wont | 448 // against the frame, otherwise an active frame pointer is set and it wont |
448 // produce the crash. | 449 // produce the crash. |
449 // We used to check the return value and |ordinal|. With ICU 4.2, FiP does | 450 // We used to check the return value and |ordinal|. With ICU 4.2, FiP does |
(...skipping 12 matching lines...) Expand all Loading... |
462 kFwd, kIgnoreCase, &ordinal)); | 463 kFwd, kIgnoreCase, &ordinal)); |
463 EXPECT_EQ(1, ordinal); | 464 EXPECT_EQ(1, ordinal); |
464 EXPECT_EQ(0, FindInPageWchar(tab, L"nostring", | 465 EXPECT_EQ(0, FindInPageWchar(tab, L"nostring", |
465 kFwd, kIgnoreCase, &ordinal)); | 466 kFwd, kIgnoreCase, &ordinal)); |
466 EXPECT_EQ(0, ordinal); | 467 EXPECT_EQ(0, ordinal); |
467 } | 468 } |
468 | 469 |
469 // Try to reproduce the crash seen in http://crbug.com/14491, where an assert | 470 // Try to reproduce the crash seen in http://crbug.com/14491, where an assert |
470 // hits in the BitStack size comparison in WebKit. | 471 // hits in the BitStack size comparison in WebKit. |
471 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue14491) { | 472 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue14491) { |
472 HTTPTestServer* server = StartHTTPServer(); | 473 net::HTTPTestServer* server = StartHTTPServer(); |
473 ASSERT_TRUE(server); | 474 ASSERT_TRUE(server); |
474 | 475 |
475 // First we navigate to our page. | 476 // First we navigate to our page. |
476 GURL url = server->TestServerPage(kBitstackCrash); | 477 GURL url = server->TestServerPage(kBitstackCrash); |
477 ui_test_utils::NavigateToURL(browser(), url); | 478 ui_test_utils::NavigateToURL(browser(), url); |
478 | 479 |
479 // This used to crash the tab. | 480 // This used to crash the tab. |
480 int ordinal = 0; | 481 int ordinal = 0; |
481 EXPECT_EQ(0, FindInPageWchar(browser()->GetSelectedTabContents(), | 482 EXPECT_EQ(0, FindInPageWchar(browser()->GetSelectedTabContents(), |
482 L"s", kFwd, kIgnoreCase, &ordinal)); | 483 L"s", kFwd, kIgnoreCase, &ordinal)); |
483 EXPECT_EQ(0, ordinal); | 484 EXPECT_EQ(0, ordinal); |
484 } | 485 } |
485 | 486 |
486 // Test to make sure Find does the right thing when restarting from a timeout. | 487 // Test to make sure Find does the right thing when restarting from a timeout. |
487 // We used to have a problem where we'd stop finding matches when all of the | 488 // We used to have a problem where we'd stop finding matches when all of the |
488 // following conditions were true: | 489 // following conditions were true: |
489 // 1) The page has a lot of text to search. | 490 // 1) The page has a lot of text to search. |
490 // 2) The page contains more than one match. | 491 // 2) The page contains more than one match. |
491 // 3) It takes longer than the time-slice given to each Find operation (100 | 492 // 3) It takes longer than the time-slice given to each Find operation (100 |
492 // ms) to find one or more of those matches (so Find times out and has to try | 493 // ms) to find one or more of those matches (so Find times out and has to try |
493 // again from where it left off). | 494 // again from where it left off). |
494 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindRestarts_Issue1155639) { | 495 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindRestarts_Issue1155639) { |
495 HTTPTestServer* server = StartHTTPServer(); | 496 net::HTTPTestServer* server = StartHTTPServer(); |
496 ASSERT_TRUE(server); | 497 ASSERT_TRUE(server); |
497 | 498 |
498 // First we navigate to our page. | 499 // First we navigate to our page. |
499 GURL url = server->TestServerPage(kTooFewMatchesPage); | 500 GURL url = server->TestServerPage(kTooFewMatchesPage); |
500 ui_test_utils::NavigateToURL(browser(), url); | 501 ui_test_utils::NavigateToURL(browser(), url); |
501 | 502 |
502 // This string appears 5 times at the bottom of a long page. If Find restarts | 503 // This string appears 5 times at the bottom of a long page. If Find restarts |
503 // properly after a timeout, it will find 5 matches, not just 1. | 504 // properly after a timeout, it will find 5 matches, not just 1. |
504 int ordinal = 0; | 505 int ordinal = 0; |
505 EXPECT_EQ(5, FindInPageWchar(browser()->GetSelectedTabContents(), | 506 EXPECT_EQ(5, FindInPageWchar(browser()->GetSelectedTabContents(), |
506 L"008.xml", | 507 L"008.xml", |
507 kFwd, kIgnoreCase, &ordinal)); | 508 kFwd, kIgnoreCase, &ordinal)); |
508 EXPECT_EQ(1, ordinal); | 509 EXPECT_EQ(1, ordinal); |
509 } | 510 } |
510 | 511 |
511 // This tests bug 11761: FindInPage terminates search prematurely. | 512 // This tests bug 11761: FindInPage terminates search prematurely. |
512 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FAILS_FindInPagePrematureEnd) { | 513 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FAILS_FindInPagePrematureEnd) { |
513 HTTPTestServer* server = StartHTTPServer(); | 514 net::HTTPTestServer* server = StartHTTPServer(); |
514 ASSERT_TRUE(server); | 515 ASSERT_TRUE(server); |
515 | 516 |
516 // First we navigate to our special focus tracking page. | 517 // First we navigate to our special focus tracking page. |
517 GURL url = server->TestServerPage(kPrematureEnd); | 518 GURL url = server->TestServerPage(kPrematureEnd); |
518 ui_test_utils::NavigateToURL(browser(), url); | 519 ui_test_utils::NavigateToURL(browser(), url); |
519 | 520 |
520 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 521 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
521 ASSERT_TRUE(NULL != tab_contents); | 522 ASSERT_TRUE(NULL != tab_contents); |
522 | 523 |
523 // Search for a text that exists within a link on the page. | 524 // Search for a text that exists within a link on the page. |
524 int ordinal = 0; | 525 int ordinal = 0; |
525 EXPECT_EQ(2, FindInPageWchar(tab_contents, L"html ", | 526 EXPECT_EQ(2, FindInPageWchar(tab_contents, L"html ", |
526 kFwd, kIgnoreCase, &ordinal)); | 527 kFwd, kIgnoreCase, &ordinal)); |
527 EXPECT_EQ(1, ordinal); | 528 EXPECT_EQ(1, ordinal); |
528 } | 529 } |
529 | 530 |
530 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { | 531 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { |
531 HTTPTestServer* server = StartHTTPServer(); | 532 net::HTTPTestServer* server = StartHTTPServer(); |
532 ASSERT_TRUE(server); | 533 ASSERT_TRUE(server); |
533 | 534 |
534 // First we navigate to our special focus tracking page. | 535 // First we navigate to our special focus tracking page. |
535 GURL url = server->TestServerPage(kSimplePage); | 536 GURL url = server->TestServerPage(kSimplePage); |
536 GURL url2 = server->TestServerPage(kFramePage); | 537 GURL url2 = server->TestServerPage(kFramePage); |
537 ui_test_utils::NavigateToURL(browser(), url); | 538 ui_test_utils::NavigateToURL(browser(), url); |
538 | 539 |
539 browser()->ShowFindBar(); | 540 browser()->ShowFindBar(); |
540 | 541 |
541 gfx::Point position; | 542 gfx::Point position; |
(...skipping 20 matching lines...) Expand all Loading... |
562 #if defined(OS_MACOSX) | 563 #if defined(OS_MACOSX) |
563 // FindDisappearOnNewTabAndHistory is flaky, at least on Mac. | 564 // FindDisappearOnNewTabAndHistory is flaky, at least on Mac. |
564 // See http://crbug.com/43072 | 565 // See http://crbug.com/43072 |
565 #define FindDisappearOnNewTabAndHistory FLAKY_FindDisappearOnNewTabAndHistory | 566 #define FindDisappearOnNewTabAndHistory FLAKY_FindDisappearOnNewTabAndHistory |
566 #endif | 567 #endif |
567 | 568 |
568 // Make sure Find box disappears when History/Downloads page is opened, and | 569 // Make sure Find box disappears when History/Downloads page is opened, and |
569 // when a New Tab is opened. | 570 // when a New Tab is opened. |
570 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 571 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
571 FindDisappearOnNewTabAndHistory) { | 572 FindDisappearOnNewTabAndHistory) { |
572 HTTPTestServer* server = StartHTTPServer(); | 573 net::HTTPTestServer* server = StartHTTPServer(); |
573 ASSERT_TRUE(server); | 574 ASSERT_TRUE(server); |
574 | 575 |
575 // First we navigate to our special focus tracking page. | 576 // First we navigate to our special focus tracking page. |
576 GURL url = server->TestServerPage(kSimplePage); | 577 GURL url = server->TestServerPage(kSimplePage); |
577 ui_test_utils::NavigateToURL(browser(), url); | 578 ui_test_utils::NavigateToURL(browser(), url); |
578 | 579 |
579 browser()->ShowFindBar(); | 580 browser()->ShowFindBar(); |
580 | 581 |
581 gfx::Point position; | 582 gfx::Point position; |
582 bool fully_visible = false; | 583 bool fully_visible = false; |
(...skipping 27 matching lines...) Expand all Loading... |
610 // TODO(rohitrao): The FindMovesWhenObscuring test does not pass on mac. | 611 // TODO(rohitrao): The FindMovesWhenObscuring test does not pass on mac. |
611 // http://crbug.com/22036 | 612 // http://crbug.com/22036 |
612 #if defined(OS_MACOSX) | 613 #if defined(OS_MACOSX) |
613 #define MAYBE_FindMovesWhenObscuring FAILS_FindMovesWhenObscuring | 614 #define MAYBE_FindMovesWhenObscuring FAILS_FindMovesWhenObscuring |
614 #else | 615 #else |
615 #define MAYBE_FindMovesWhenObscuring FindMovesWhenObscuring | 616 #define MAYBE_FindMovesWhenObscuring FindMovesWhenObscuring |
616 #endif | 617 #endif |
617 | 618 |
618 // Make sure Find box moves out of the way if it is obscuring the active match. | 619 // Make sure Find box moves out of the way if it is obscuring the active match. |
619 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FindMovesWhenObscuring) { | 620 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FindMovesWhenObscuring) { |
620 HTTPTestServer* server = StartHTTPServer(); | 621 net::HTTPTestServer* server = StartHTTPServer(); |
621 ASSERT_TRUE(server); | 622 ASSERT_TRUE(server); |
622 | 623 |
623 GURL url = server->TestServerPage(kMoveIfOver); | 624 GURL url = server->TestServerPage(kMoveIfOver); |
624 ui_test_utils::NavigateToURL(browser(), url); | 625 ui_test_utils::NavigateToURL(browser(), url); |
625 | 626 |
626 browser()->ShowFindBar(); | 627 browser()->ShowFindBar(); |
627 | 628 |
628 // This is needed on GTK because the reposition operation is asynchronous. | 629 // This is needed on GTK because the reposition operation is asynchronous. |
629 MessageLoop::current()->RunAllPending(); | 630 MessageLoop::current()->RunAllPending(); |
630 | 631 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 | 670 |
670 #if defined(OS_MACOSX) | 671 #if defined(OS_MACOSX) |
671 // FindNextInNewTabUsesPrepopulate times-out, at least on Mac. | 672 // FindNextInNewTabUsesPrepopulate times-out, at least on Mac. |
672 // See http://crbug.com/43070 | 673 // See http://crbug.com/43070 |
673 #define FindNextInNewTabUsesPrepopulate DISABLED_FindNextInNewTabUsesPrepopulate | 674 #define FindNextInNewTabUsesPrepopulate DISABLED_FindNextInNewTabUsesPrepopulate |
674 #endif | 675 #endif |
675 | 676 |
676 // Make sure F3 in a new tab works if Find has previous string to search for. | 677 // Make sure F3 in a new tab works if Find has previous string to search for. |
677 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 678 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
678 FindNextInNewTabUsesPrepopulate) { | 679 FindNextInNewTabUsesPrepopulate) { |
679 HTTPTestServer* server = StartHTTPServer(); | 680 net::HTTPTestServer* server = StartHTTPServer(); |
680 ASSERT_TRUE(server); | 681 ASSERT_TRUE(server); |
681 | 682 |
682 // First we navigate to any page. | 683 // First we navigate to any page. |
683 GURL url = server->TestServerPage(kSimplePage); | 684 GURL url = server->TestServerPage(kSimplePage); |
684 ui_test_utils::NavigateToURL(browser(), url); | 685 ui_test_utils::NavigateToURL(browser(), url); |
685 | 686 |
686 // Search for 'no_match'. No matches should be found. | 687 // Search for 'no_match'. No matches should be found. |
687 int ordinal = 0; | 688 int ordinal = 0; |
688 TabContents* tab = browser()->GetSelectedTabContents(); | 689 TabContents* tab = browser()->GetSelectedTabContents(); |
689 EXPECT_EQ(0, FindInPageWchar(tab, L"no_match", | 690 EXPECT_EQ(0, FindInPageWchar(tab, L"no_match", |
(...skipping 26 matching lines...) Expand all Loading... |
716 #if defined(OS_LINUX) | 717 #if defined(OS_LINUX) |
717 // TODO(oshima): On Gtk/Linux, a focus out event is asynchronous and | 718 // TODO(oshima): On Gtk/Linux, a focus out event is asynchronous and |
718 // hiding a find bar does not immediately update the target | 719 // hiding a find bar does not immediately update the target |
719 // accelerator. The last condition fails in most cases due to this | 720 // accelerator. The last condition fails in most cases due to this |
720 // behavior. See http://crbug.com/26870. | 721 // behavior. See http://crbug.com/26870. |
721 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 722 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
722 DISABLED_AcceleratorRestoring) { | 723 DISABLED_AcceleratorRestoring) { |
723 #else | 724 #else |
724 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, AcceleratorRestoring) { | 725 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, AcceleratorRestoring) { |
725 #endif | 726 #endif |
726 HTTPTestServer* server = StartHTTPServer(); | 727 net::HTTPTestServer* server = StartHTTPServer(); |
727 ASSERT_TRUE(server); | 728 ASSERT_TRUE(server); |
728 | 729 |
729 // First we navigate to any page. | 730 // First we navigate to any page. |
730 GURL url = server->TestServerPage(kSimplePage); | 731 GURL url = server->TestServerPage(kSimplePage); |
731 ui_test_utils::NavigateToURL(browser(), url); | 732 ui_test_utils::NavigateToURL(browser(), url); |
732 | 733 |
733 views::FocusManager* focus_manager = | 734 views::FocusManager* focus_manager = |
734 views::FocusManager::GetFocusManagerForNativeWindow( | 735 views::FocusManager::GetFocusManagerForNativeWindow( |
735 browser()->window()->GetNativeHandle()); | 736 browser()->window()->GetNativeHandle()); |
736 | 737 |
(...skipping 18 matching lines...) Expand all Loading... |
755 | 756 |
756 // The accelerator for Escape should be back to what it was before. | 757 // The accelerator for Escape should be back to what it was before. |
757 EXPECT_EQ(old_target, | 758 EXPECT_EQ(old_target, |
758 focus_manager->GetCurrentTargetForAccelerator(escape)); | 759 focus_manager->GetCurrentTargetForAccelerator(escape)); |
759 } | 760 } |
760 #endif // TOOLKIT_VIEWS | 761 #endif // TOOLKIT_VIEWS |
761 | 762 |
762 // Make sure Find box does not become UI-inactive when no text is in the box as | 763 // Make sure Find box does not become UI-inactive when no text is in the box as |
763 // we switch to a tab contents with an empty find string. See issue 13570. | 764 // we switch to a tab contents with an empty find string. See issue 13570. |
764 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, StayActive) { | 765 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, StayActive) { |
765 HTTPTestServer* server = StartHTTPServer(); | 766 net::HTTPTestServer* server = StartHTTPServer(); |
766 ASSERT_TRUE(server); | 767 ASSERT_TRUE(server); |
767 | 768 |
768 // First we navigate to any page. | 769 // First we navigate to any page. |
769 GURL url = server->TestServerPage(kSimplePage); | 770 GURL url = server->TestServerPage(kSimplePage); |
770 ui_test_utils::NavigateToURL(browser(), url); | 771 ui_test_utils::NavigateToURL(browser(), url); |
771 | 772 |
772 browser()->ShowFindBar(); | 773 browser()->ShowFindBar(); |
773 | 774 |
774 // Simulate a user clearing the search string. Ideally, we should be | 775 // Simulate a user clearing the search string. Ideally, we should be |
775 // simulating keypresses here for searching for something and pressing | 776 // simulating keypresses here for searching for something and pressing |
776 // backspace, but that's been proven flaky in the past, so we go straight to | 777 // backspace, but that's been proven flaky in the past, so we go straight to |
777 // tab_contents. | 778 // tab_contents. |
778 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 779 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
779 // Stop the (non-existing) find operation, and clear the selection (which | 780 // Stop the (non-existing) find operation, and clear the selection (which |
780 // signals the UI is still active). | 781 // signals the UI is still active). |
781 tab_contents->StopFinding(FindBarController::kClearSelection); | 782 tab_contents->StopFinding(FindBarController::kClearSelection); |
782 // Make sure the Find UI flag hasn't been cleared, it must be so that the UI | 783 // Make sure the Find UI flag hasn't been cleared, it must be so that the UI |
783 // still responds to browser window resizing. | 784 // still responds to browser window resizing. |
784 ASSERT_TRUE(tab_contents->find_ui_active()); | 785 ASSERT_TRUE(tab_contents->find_ui_active()); |
785 } | 786 } |
786 | 787 |
787 // Make sure F3 works after you FindNext a couple of times and end the Find | 788 // Make sure F3 works after you FindNext a couple of times and end the Find |
788 // session. See issue http://crbug.com/28306. | 789 // session. See issue http://crbug.com/28306. |
789 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, RestartSearchFromF3) { | 790 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, RestartSearchFromF3) { |
790 HTTPTestServer* server = StartHTTPServer(); | 791 net::HTTPTestServer* server = StartHTTPServer(); |
791 ASSERT_TRUE(server); | 792 ASSERT_TRUE(server); |
792 | 793 |
793 // First we navigate to a simple page. | 794 // First we navigate to a simple page. |
794 GURL url = server->TestServerPage(kSimple); | 795 GURL url = server->TestServerPage(kSimple); |
795 ui_test_utils::NavigateToURL(browser(), url); | 796 ui_test_utils::NavigateToURL(browser(), url); |
796 | 797 |
797 // Search for 'page'. Should have 1 match. | 798 // Search for 'page'. Should have 1 match. |
798 int ordinal = 0; | 799 int ordinal = 0; |
799 TabContents* tab = browser()->GetSelectedTabContents(); | 800 TabContents* tab = browser()->GetSelectedTabContents(); |
800 EXPECT_EQ(1, FindInPageWchar(tab, L"page", kFwd, kIgnoreCase, &ordinal)); | 801 EXPECT_EQ(1, FindInPageWchar(tab, L"page", kFwd, kIgnoreCase, &ordinal)); |
(...skipping 11 matching lines...) Expand all Loading... |
812 | 813 |
813 // Simulate F3 while Find box is closed. Should have 1 match. | 814 // Simulate F3 while Find box is closed. Should have 1 match. |
814 EXPECT_EQ(1, FindInPageWchar(tab, L"", kFwd, kIgnoreCase, &ordinal)); | 815 EXPECT_EQ(1, FindInPageWchar(tab, L"", kFwd, kIgnoreCase, &ordinal)); |
815 EXPECT_EQ(1, ordinal); | 816 EXPECT_EQ(1, ordinal); |
816 } | 817 } |
817 | 818 |
818 // When re-opening the find bar with F3, the find bar should be re-populated | 819 // When re-opening the find bar with F3, the find bar should be re-populated |
819 // with the last search from the same tab rather than the last overall search. | 820 // with the last search from the same tab rather than the last overall search. |
820 // http://crbug.com/30006 | 821 // http://crbug.com/30006 |
821 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) { | 822 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) { |
822 HTTPTestServer* server = StartHTTPServer(); | 823 net::HTTPTestServer* server = StartHTTPServer(); |
823 ASSERT_TRUE(server); | 824 ASSERT_TRUE(server); |
824 | 825 |
825 // First we navigate to any page. | 826 // First we navigate to any page. |
826 GURL url = server->TestServerPage(kSimplePage); | 827 GURL url = server->TestServerPage(kSimplePage); |
827 ui_test_utils::NavigateToURL(browser(), url); | 828 ui_test_utils::NavigateToURL(browser(), url); |
828 | 829 |
829 // Find "Default". | 830 // Find "Default". |
830 int ordinal = 0; | 831 int ordinal = 0; |
831 TabContents* tab1 = browser()->GetSelectedTabContents(); | 832 TabContents* tab1 = browser()->GetSelectedTabContents(); |
832 EXPECT_EQ(1, FindInPageWchar(tab1, L"Default", kFwd, kIgnoreCase, &ordinal)); | 833 EXPECT_EQ(1, FindInPageWchar(tab1, L"Default", kFwd, kIgnoreCase, &ordinal)); |
(...skipping 18 matching lines...) Expand all Loading... |
851 } | 852 } |
852 | 853 |
853 // This tests that whenever you close and reopen the Find bar, it should show | 854 // This tests that whenever you close and reopen the Find bar, it should show |
854 // the last search entered in that tab. http://crbug.com/40121. | 855 // the last search entered in that tab. http://crbug.com/40121. |
855 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateSameTab) { | 856 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateSameTab) { |
856 #if defined(OS_MACOSX) | 857 #if defined(OS_MACOSX) |
857 // FindInPage on Mac doesn't use prepopulated values. Search there is global. | 858 // FindInPage on Mac doesn't use prepopulated values. Search there is global. |
858 return; | 859 return; |
859 #endif | 860 #endif |
860 | 861 |
861 HTTPTestServer* server = StartHTTPServer(); | 862 net::HTTPTestServer* server = StartHTTPServer(); |
862 ASSERT_TRUE(server); | 863 ASSERT_TRUE(server); |
863 | 864 |
864 // First we navigate to any page. | 865 // First we navigate to any page. |
865 GURL url = server->TestServerPage(kSimple); | 866 GURL url = server->TestServerPage(kSimple); |
866 ui_test_utils::NavigateToURL(browser(), url); | 867 ui_test_utils::NavigateToURL(browser(), url); |
867 | 868 |
868 // Search for the word "page". | 869 // Search for the word "page". |
869 int ordinal = 0; | 870 int ordinal = 0; |
870 TabContents* tab1 = browser()->GetSelectedTabContents(); | 871 TabContents* tab1 = browser()->GetSelectedTabContents(); |
871 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); | 872 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); |
(...skipping 17 matching lines...) Expand all Loading... |
889 | 890 |
890 // This tests that whenever you open Find in a new tab it should prepopulate | 891 // This tests that whenever you open Find in a new tab it should prepopulate |
891 // with a previous search term (in any tab), if a search has not been issued in | 892 // with a previous search term (in any tab), if a search has not been issued in |
892 // this tab before. | 893 // this tab before. |
893 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateInNewTab) { | 894 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateInNewTab) { |
894 #if defined(OS_MACOSX) | 895 #if defined(OS_MACOSX) |
895 // FindInPage on Mac doesn't use prepopulated values. Search there is global. | 896 // FindInPage on Mac doesn't use prepopulated values. Search there is global. |
896 return; | 897 return; |
897 #endif | 898 #endif |
898 | 899 |
899 HTTPTestServer* server = StartHTTPServer(); | 900 net::HTTPTestServer* server = StartHTTPServer(); |
900 ASSERT_TRUE(server); | 901 ASSERT_TRUE(server); |
901 | 902 |
902 // First we navigate to any page. | 903 // First we navigate to any page. |
903 GURL url = server->TestServerPage(kSimple); | 904 GURL url = server->TestServerPage(kSimple); |
904 ui_test_utils::NavigateToURL(browser(), url); | 905 ui_test_utils::NavigateToURL(browser(), url); |
905 | 906 |
906 // Search for the word "page". | 907 // Search for the word "page". |
907 int ordinal = 0; | 908 int ordinal = 0; |
908 TabContents* tab1 = browser()->GetSelectedTabContents(); | 909 TabContents* tab1 = browser()->GetSelectedTabContents(); |
909 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); | 910 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); |
(...skipping 15 matching lines...) Expand all Loading... |
925 | 926 |
926 // This makes sure that we can search for A in tabA, then for B in tabB and | 927 // This makes sure that we can search for A in tabA, then for B in tabB and |
927 // when we come back to tabA we should still see A (because that was the last | 928 // when we come back to tabA we should still see A (because that was the last |
928 // search in that tab). | 929 // search in that tab). |
929 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) { | 930 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) { |
930 #if defined(OS_MACOSX) | 931 #if defined(OS_MACOSX) |
931 // FindInPage on Mac doesn't use prepopulated values. Search there is global. | 932 // FindInPage on Mac doesn't use prepopulated values. Search there is global. |
932 return; | 933 return; |
933 #endif | 934 #endif |
934 | 935 |
935 HTTPTestServer* server = StartHTTPServer(); | 936 net::HTTPTestServer* server = StartHTTPServer(); |
936 ASSERT_TRUE(server); | 937 ASSERT_TRUE(server); |
937 | 938 |
938 // First we navigate to any page. | 939 // First we navigate to any page. |
939 GURL url = server->TestServerPage(kSimple); | 940 GURL url = server->TestServerPage(kSimple); |
940 ui_test_utils::NavigateToURL(browser(), url); | 941 ui_test_utils::NavigateToURL(browser(), url); |
941 | 942 |
942 // Search for the word "page". | 943 // Search for the word "page". |
943 int ordinal = 0; | 944 int ordinal = 0; |
944 TabContents* tab1 = browser()->GetSelectedTabContents(); | 945 TabContents* tab1 = browser()->GetSelectedTabContents(); |
945 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); | 946 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 #endif | 1002 #endif |
1002 | 1003 |
1003 // This tests that search terms entered into an incognito find bar are not used | 1004 // This tests that search terms entered into an incognito find bar are not used |
1004 // as prepopulate terms for non-incognito windows. | 1005 // as prepopulate terms for non-incognito windows. |
1005 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) { | 1006 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) { |
1006 #if defined(OS_MACOSX) | 1007 #if defined(OS_MACOSX) |
1007 // FindInPage on Mac doesn't use prepopulated values. Search there is global. | 1008 // FindInPage on Mac doesn't use prepopulated values. Search there is global. |
1008 return; | 1009 return; |
1009 #endif | 1010 #endif |
1010 | 1011 |
1011 HTTPTestServer* server = StartHTTPServer(); | 1012 net::HTTPTestServer* server = StartHTTPServer(); |
1012 ASSERT_TRUE(server); | 1013 ASSERT_TRUE(server); |
1013 | 1014 |
1014 // First we navigate to the "simple" test page. | 1015 // First we navigate to the "simple" test page. |
1015 GURL url = server->TestServerPage(kSimple); | 1016 GURL url = server->TestServerPage(kSimple); |
1016 ui_test_utils::NavigateToURL(browser(), url); | 1017 ui_test_utils::NavigateToURL(browser(), url); |
1017 | 1018 |
1018 // Search for the word "page" in the normal browser tab. | 1019 // Search for the word "page" in the normal browser tab. |
1019 int ordinal = 0; | 1020 int ordinal = 0; |
1020 TabContents* tab1 = browser()->GetSelectedTabContents(); | 1021 TabContents* tab1 = browser()->GetSelectedTabContents(); |
1021 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); | 1022 EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 | 1068 |
1068 // See http://crbug.com/45594. On Windows, it crashes sometimes. | 1069 // See http://crbug.com/45594. On Windows, it crashes sometimes. |
1069 #if defined(OS_WIN) | 1070 #if defined(OS_WIN) |
1070 #define MAYBE_ActivateLinkNavigatesPage DISABLED_ActivateLinkNavigatesPage | 1071 #define MAYBE_ActivateLinkNavigatesPage DISABLED_ActivateLinkNavigatesPage |
1071 #else | 1072 #else |
1072 #define MAYBE_ActivateLinkNavigatesPage ActivateLinkNavigatesPage | 1073 #define MAYBE_ActivateLinkNavigatesPage ActivateLinkNavigatesPage |
1073 #endif | 1074 #endif |
1074 // This makes sure that dismissing the find bar with kActivateSelection works. | 1075 // This makes sure that dismissing the find bar with kActivateSelection works. |
1075 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 1076 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
1076 MAYBE_ActivateLinkNavigatesPage) { | 1077 MAYBE_ActivateLinkNavigatesPage) { |
1077 HTTPTestServer* server = StartHTTPServer(); | 1078 net::HTTPTestServer* server = StartHTTPServer(); |
1078 ASSERT_TRUE(server); | 1079 ASSERT_TRUE(server); |
1079 | 1080 |
1080 // First we navigate to our test content. | 1081 // First we navigate to our test content. |
1081 GURL url = server->TestServerPage(kLinkPage); | 1082 GURL url = server->TestServerPage(kLinkPage); |
1082 ui_test_utils::NavigateToURL(browser(), url); | 1083 ui_test_utils::NavigateToURL(browser(), url); |
1083 | 1084 |
1084 TabContents* tab = browser()->GetSelectedTabContents(); | 1085 TabContents* tab = browser()->GetSelectedTabContents(); |
1085 int ordinal = 0; | 1086 int ordinal = 0; |
1086 FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal); | 1087 FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal); |
1087 EXPECT_EQ(ordinal, 1); | 1088 EXPECT_EQ(ordinal, 1); |
1088 | 1089 |
1089 // End the find session, click on the link. | 1090 // End the find session, click on the link. |
1090 tab->StopFinding(FindBarController::kActivateSelection); | 1091 tab->StopFinding(FindBarController::kActivateSelection); |
1091 EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 1092 EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
1092 } | 1093 } |
OLD | NEW |