OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 ui_test_utils::DownloadURL(browser(), download_url); | 325 ui_test_utils::DownloadURL(browser(), download_url); |
326 | 326 |
327 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); | 327 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); |
328 FlushHistoryService(); | 328 FlushHistoryService(); |
329 EXPECT_EQ(1, | 329 EXPECT_EQ(1, |
330 FindInPageWchar(web_contents, | 330 FindInPageWchar(web_contents, |
331 base::ASCIIToWide(download_url.spec()).c_str(), | 331 base::ASCIIToWide(download_url.spec()).c_str(), |
332 kFwd, kIgnoreCase, NULL)); | 332 kFwd, kIgnoreCase, NULL)); |
333 } | 333 } |
334 | 334 |
| 335 #if defined(OS_MACOSX) |
| 336 // Disabled due to http://crbug.com/419769. |
| 337 #define MAYBE_FindInPageSpecialURLs DISABLED_FindInPageSpecialURLs |
| 338 #else |
| 339 #define MAYBE_FindInPageSpecialURLs FindInPageSpecialURLs |
| 340 #endif |
335 // Verify search selection coordinates. The data file used is set-up such that | 341 // Verify search selection coordinates. The data file used is set-up such that |
336 // the text occurs on the same line, and we verify their positions by verifying | 342 // the text occurs on the same line, and we verify their positions by verifying |
337 // their relative positions. | 343 // their relative positions. |
338 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageSpecialURLs) { | 344 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FindInPageSpecialURLs) { |
339 std::wstring search_string(L"\u5728\u897f\u660c\u536b\u661f\u53d1"); | 345 std::wstring search_string(L"\u5728\u897f\u660c\u536b\u661f\u53d1"); |
340 gfx::Rect first, second, first_reverse; | 346 gfx::Rect first, second, first_reverse; |
341 WebContents* web_contents = | 347 WebContents* web_contents = |
342 browser()->tab_strip_model()->GetActiveWebContents(); | 348 browser()->tab_strip_model()->GetActiveWebContents(); |
343 ui_test_utils::NavigateToURL(browser(), GetURL("specialchar.html")); | 349 ui_test_utils::NavigateToURL(browser(), GetURL("specialchar.html")); |
344 ui_test_utils::FindInPage(web_contents, WideToUTF16(search_string), | 350 ui_test_utils::FindInPage(web_contents, WideToUTF16(search_string), |
345 kFwd, kIgnoreCase, NULL, &first); | 351 kFwd, kIgnoreCase, NULL, &first); |
346 ui_test_utils::FindInPage(web_contents, WideToUTF16(search_string), | 352 ui_test_utils::FindInPage(web_contents, WideToUTF16(search_string), |
347 kFwd, kIgnoreCase, NULL, &second); | 353 kFwd, kIgnoreCase, NULL, &second); |
348 | 354 |
349 // We have search occurrence in the same row, so top-bottom coordinates should | 355 // We have search occurrence in the same row, so top-bottom coordinates should |
350 // be the same even for second search. | 356 // be the same even for second search. |
351 ASSERT_EQ(first.y(), second.y()); | 357 ASSERT_EQ(first.y(), second.y()); |
352 ASSERT_EQ(first.bottom(), second.bottom()); | 358 ASSERT_EQ(first.bottom(), second.bottom()); |
353 ASSERT_LT(first.x(), second.x()); | 359 ASSERT_LT(first.x(), second.x()); |
354 ASSERT_LT(first.right(), second.right()); | 360 ASSERT_LT(first.right(), second.right()); |
355 | 361 |
356 ui_test_utils::FindInPage( | 362 ui_test_utils::FindInPage( |
357 web_contents, WideToUTF16(search_string), kBack, kIgnoreCase, NULL, | 363 web_contents, WideToUTF16(search_string), kBack, kIgnoreCase, NULL, |
358 &first_reverse); | 364 &first_reverse); |
359 // We find next and we go back so find coordinates should be the same as | 365 // We find next and we go back so find coordinates should be the same as |
360 // previous ones. | 366 // previous ones. |
361 ASSERT_EQ(first, first_reverse); | 367 ASSERT_EQ(first, first_reverse); |
362 } | 368 } |
363 | 369 |
| 370 #if defined(OS_MACOSX) |
| 371 // Disabled due to http://crbug.com/419769. |
| 372 #define MAYBE_CommentsAndMetaDataNotSearchable \ |
| 373 DISABLED_CommentsAndMetaDataNotSearchable |
| 374 #else |
| 375 #define MAYBE_CommentsAndMetaDataNotSearchable CommentsAndMetaDataNotSearchable |
| 376 #endif |
364 // Verifies that comments and meta data are not searchable. | 377 // Verifies that comments and meta data are not searchable. |
365 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 378 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
366 CommentsAndMetaDataNotSearchable) { | 379 MAYBE_CommentsAndMetaDataNotSearchable) { |
367 WebContents* web_contents = | 380 WebContents* web_contents = |
368 browser()->tab_strip_model()->GetActiveWebContents(); | 381 browser()->tab_strip_model()->GetActiveWebContents(); |
369 ui_test_utils::NavigateToURL(browser(), GetURL("specialchar.html")); | 382 ui_test_utils::NavigateToURL(browser(), GetURL("specialchar.html")); |
370 | 383 |
371 std::wstring search_string = | 384 std::wstring search_string = |
372 L"\u4e2d\u65b0\u793e\u8bb0\u8005\u5b8b\u5409\u6cb3\u6444\u4e2d\u65b0\u7f51
"; | 385 L"\u4e2d\u65b0\u793e\u8bb0\u8005\u5b8b\u5409\u6cb3\u6444\u4e2d\u65b0\u7f51
"; |
373 EXPECT_EQ(0, ui_test_utils::FindInPage( | 386 EXPECT_EQ(0, ui_test_utils::FindInPage( |
374 web_contents, WideToUTF16(search_string), kFwd, kIgnoreCase, NULL, NULL)); | 387 web_contents, WideToUTF16(search_string), kFwd, kIgnoreCase, NULL, NULL)); |
375 } | 388 } |
376 | 389 |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 | 1566 |
1554 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); | 1567 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); |
1555 WebContents* web_contents_incognito = | 1568 WebContents* web_contents_incognito = |
1556 browser_incognito->tab_strip_model()->GetActiveWebContents(); | 1569 browser_incognito->tab_strip_model()->GetActiveWebContents(); |
1557 ui_test_utils::FindInPageNotificationObserver observer( | 1570 ui_test_utils::FindInPageNotificationObserver observer( |
1558 web_contents_incognito); | 1571 web_contents_incognito); |
1559 observer.Wait(); | 1572 observer.Wait(); |
1560 EXPECT_EQ(ASCIIToUTF16("bar"), | 1573 EXPECT_EQ(ASCIIToUTF16("bar"), |
1561 GetFindBarTextForBrowser(browser_incognito)); | 1574 GetFindBarTextForBrowser(browser_incognito)); |
1562 } | 1575 } |
OLD | NEW |