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/file_util.h" | 5 #include "base/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 | 325 |
326 GURL download_url = ui_test_utils::GetTestUrl( | 326 GURL download_url = ui_test_utils::GetTestUrl( |
327 base::FilePath().AppendASCII("downloads"), | 327 base::FilePath().AppendASCII("downloads"), |
328 base::FilePath().AppendASCII("a_zip_file.zip")); | 328 base::FilePath().AppendASCII("a_zip_file.zip")); |
329 ui_test_utils::DownloadURL(browser(), download_url); | 329 ui_test_utils::DownloadURL(browser(), download_url); |
330 | 330 |
331 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); | 331 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); |
332 FlushHistoryService(); | 332 FlushHistoryService(); |
333 EXPECT_EQ(1, | 333 EXPECT_EQ(1, |
334 FindInPageWchar(web_contents, | 334 FindInPageWchar(web_contents, |
335 ASCIIToWide(download_url.spec()).c_str(), kFwd, | 335 base::ASCIIToWide(download_url.spec()).c_str(), |
336 kIgnoreCase, NULL)); | 336 kFwd, kIgnoreCase, NULL)); |
337 } | 337 } |
338 | 338 |
339 // Verify search selection coordinates. The data file used is set-up such that | 339 // Verify search selection coordinates. The data file used is set-up such that |
340 // the text occurs on the same line, and we verify their positions by verifying | 340 // the text occurs on the same line, and we verify their positions by verifying |
341 // their relative positions. | 341 // their relative positions. |
342 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageSpecialURLs) { | 342 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageSpecialURLs) { |
343 std::wstring search_string(L"\u5728\u897f\u660c\u536b\u661f\u53d1"); | 343 std::wstring search_string(L"\u5728\u897f\u660c\u536b\u661f\u53d1"); |
344 gfx::Rect first, second, first_reverse; | 344 gfx::Rect first, second, first_reverse; |
345 WebContents* web_contents = | 345 WebContents* web_contents = |
346 browser()->tab_strip_model()->GetActiveWebContents(); | 346 browser()->tab_strip_model()->GetActiveWebContents(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) { | 409 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) { |
410 WebContents* web_contents = | 410 WebContents* web_contents = |
411 browser()->tab_strip_model()->GetActiveWebContents(); | 411 browser()->tab_strip_model()->GetActiveWebContents(); |
412 ui_test_utils::NavigateToURL(browser(), GetURL("largepage.html")); | 412 ui_test_utils::NavigateToURL(browser(), GetURL("largepage.html")); |
413 | 413 |
414 base::FilePath path = ui_test_utils::GetTestFilePath( | 414 base::FilePath path = ui_test_utils::GetTestFilePath( |
415 base::FilePath().AppendASCII("find_in_page"), | 415 base::FilePath().AppendASCII("find_in_page"), |
416 base::FilePath().AppendASCII("LongFind.txt")); | 416 base::FilePath().AppendASCII("LongFind.txt")); |
417 std::string query; | 417 std::string query; |
418 base::ReadFileToString(path, &query); | 418 base::ReadFileToString(path, &query); |
419 std::wstring search_string = UTF8ToWide(query); | 419 std::wstring search_string = base::UTF8ToWide(query); |
420 EXPECT_EQ(1, | 420 EXPECT_EQ(1, |
421 FindInPageWchar(web_contents, search_string.c_str(), | 421 FindInPageWchar(web_contents, search_string.c_str(), |
422 kFwd, kIgnoreCase, NULL)); | 422 kFwd, kIgnoreCase, NULL)); |
423 } | 423 } |
424 | 424 |
425 // Find a big font string in a page. | 425 // Find a big font string in a page. |
426 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, BigString) { | 426 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, BigString) { |
427 WebContents* web_contents = | 427 WebContents* web_contents = |
428 browser()->tab_strip_model()->GetActiveWebContents(); | 428 browser()->tab_strip_model()->GetActiveWebContents(); |
429 ui_test_utils::NavigateToURL(browser(), GetURL("BigText.html")); | 429 ui_test_utils::NavigateToURL(browser(), GetURL("BigText.html")); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 WebContents* web_contents = | 472 WebContents* web_contents = |
473 browser()->tab_strip_model()->GetActiveWebContents(); | 473 browser()->tab_strip_model()->GetActiveWebContents(); |
474 | 474 |
475 base::FilePath path = ui_test_utils::GetTestFilePath( | 475 base::FilePath path = ui_test_utils::GetTestFilePath( |
476 base::FilePath().AppendASCII("find_in_page"), | 476 base::FilePath().AppendASCII("find_in_page"), |
477 base::FilePath().AppendASCII("find_test.txt")); | 477 base::FilePath().AppendASCII("find_test.txt")); |
478 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(path)); | 478 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(path)); |
479 | 479 |
480 std::string query; | 480 std::string query; |
481 base::ReadFileToString(path, &query); | 481 base::ReadFileToString(path, &query); |
482 std::wstring search_string = UTF8ToWide(query); | 482 std::wstring search_string = base::UTF8ToWide(query); |
483 EXPECT_EQ(1, | 483 EXPECT_EQ(1, |
484 FindInPageWchar(web_contents, search_string.c_str(), | 484 FindInPageWchar(web_contents, search_string.c_str(), |
485 false, false, NULL)); | 485 false, false, NULL)); |
486 } | 486 } |
487 | 487 |
488 // Specifying a prototype so that we can add the WARN_UNUSED_RESULT attribute. | 488 // Specifying a prototype so that we can add the WARN_UNUSED_RESULT attribute. |
489 bool FocusedOnPage(WebContents* web_contents, std::string* result) | 489 bool FocusedOnPage(WebContents* web_contents, std::string* result) |
490 WARN_UNUSED_RESULT; | 490 WARN_UNUSED_RESULT; |
491 | 491 |
492 bool FocusedOnPage(WebContents* web_contents, std::string* result) { | 492 bool FocusedOnPage(WebContents* web_contents, std::string* result) { |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 ASSERT_EQ(result, SIMPLEREGION); | 1680 ASSERT_EQ(result, SIMPLEREGION); |
1681 bool rects_equal = | 1681 bool rects_equal = |
1682 region_before.left == region_after.left && | 1682 region_before.left == region_after.left && |
1683 region_before.top == region_after.top && | 1683 region_before.top == region_after.top && |
1684 region_before.right == region_after.right && | 1684 region_before.right == region_after.right && |
1685 region_before.bottom == region_after.bottom; | 1685 region_before.bottom == region_after.bottom; |
1686 ASSERT_FALSE(rects_equal); | 1686 ASSERT_FALSE(rects_equal); |
1687 } | 1687 } |
1688 | 1688 |
1689 #endif | 1689 #endif |
OLD | NEW |