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

Side by Side Diff: chrome/browser/ui/find_bar/find_bar_host_browsertest.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
OLDNEW
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/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // Find a very long string in a large page. 397 // Find a very long string in a large page.
398 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) { 398 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) {
399 WebContents* web_contents = 399 WebContents* web_contents =
400 browser()->tab_strip_model()->GetActiveWebContents(); 400 browser()->tab_strip_model()->GetActiveWebContents();
401 ui_test_utils::NavigateToURL(browser(), GetURL("largepage.html")); 401 ui_test_utils::NavigateToURL(browser(), GetURL("largepage.html"));
402 402
403 base::FilePath path = ui_test_utils::GetTestFilePath( 403 base::FilePath path = ui_test_utils::GetTestFilePath(
404 base::FilePath().AppendASCII("find_in_page"), 404 base::FilePath().AppendASCII("find_in_page"),
405 base::FilePath().AppendASCII("LongFind.txt")); 405 base::FilePath().AppendASCII("LongFind.txt"));
406 std::string query; 406 std::string query;
407 file_util::ReadFileToString(path, &query); 407 base::ReadFileToString(path, &query);
408 std::wstring search_string = UTF8ToWide(query); 408 std::wstring search_string = UTF8ToWide(query);
409 EXPECT_EQ(1, 409 EXPECT_EQ(1,
410 FindInPageWchar(web_contents, search_string.c_str(), 410 FindInPageWchar(web_contents, search_string.c_str(),
411 kFwd, kIgnoreCase, NULL)); 411 kFwd, kIgnoreCase, NULL));
412 } 412 }
413 413
414 // Find a big font string in a page. 414 // Find a big font string in a page.
415 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, BigString) { 415 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, BigString) {
416 WebContents* web_contents = 416 WebContents* web_contents =
417 browser()->tab_strip_model()->GetActiveWebContents(); 417 browser()->tab_strip_model()->GetActiveWebContents();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindWholeFileContent) { 460 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindWholeFileContent) {
461 WebContents* web_contents = 461 WebContents* web_contents =
462 browser()->tab_strip_model()->GetActiveWebContents(); 462 browser()->tab_strip_model()->GetActiveWebContents();
463 463
464 base::FilePath path = ui_test_utils::GetTestFilePath( 464 base::FilePath path = ui_test_utils::GetTestFilePath(
465 base::FilePath().AppendASCII("find_in_page"), 465 base::FilePath().AppendASCII("find_in_page"),
466 base::FilePath().AppendASCII("find_test.txt")); 466 base::FilePath().AppendASCII("find_test.txt"));
467 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(path)); 467 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(path));
468 468
469 std::string query; 469 std::string query;
470 file_util::ReadFileToString(path, &query); 470 base::ReadFileToString(path, &query);
471 std::wstring search_string = UTF8ToWide(query); 471 std::wstring search_string = UTF8ToWide(query);
472 EXPECT_EQ(1, 472 EXPECT_EQ(1,
473 FindInPageWchar(web_contents, search_string.c_str(), 473 FindInPageWchar(web_contents, search_string.c_str(),
474 false, false, NULL)); 474 false, false, NULL));
475 } 475 }
476 476
477 // Specifying a prototype so that we can add the WARN_UNUSED_RESULT attribute. 477 // Specifying a prototype so that we can add the WARN_UNUSED_RESULT attribute.
478 bool FocusedOnPage(WebContents* web_contents, std::string* result) 478 bool FocusedOnPage(WebContents* web_contents, std::string* result)
479 WARN_UNUSED_RESULT; 479 WARN_UNUSED_RESULT;
480 480
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 1598
1599 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); 1599 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT));
1600 WebContents* web_contents_incognito = 1600 WebContents* web_contents_incognito =
1601 browser_incognito->tab_strip_model()->GetActiveWebContents(); 1601 browser_incognito->tab_strip_model()->GetActiveWebContents();
1602 ui_test_utils::FindInPageNotificationObserver observer( 1602 ui_test_utils::FindInPageNotificationObserver observer(
1603 web_contents_incognito); 1603 web_contents_incognito);
1604 observer.Wait(); 1604 observer.Wait();
1605 EXPECT_EQ(ASCIIToUTF16("bar"), 1605 EXPECT_EQ(ASCIIToUTF16("bar"),
1606 GetFindBarTextForBrowser(browser_incognito)); 1606 GetFindBarTextForBrowser(browser_incognito));
1607 } 1607 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698