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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.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 // File contains browser tests for the fileBrowserHandler api. 5 // File contains browser tests for the fileBrowserHandler api.
6 6
7 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler_a pi.h" 7 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler_a pi.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool success; 52 bool success;
53 // The path file selector should return back to the function. 53 // The path file selector should return back to the function.
54 base::FilePath selected_path; 54 base::FilePath selected_path;
55 }; 55 };
56 56
57 // Checks that file under path |selected_path| contains |expected_contents|. 57 // Checks that file under path |selected_path| contains |expected_contents|.
58 // Must be called on the file thread. 58 // Must be called on the file thread.
59 void ExpectFileContentEquals(const base::FilePath& selected_path, 59 void ExpectFileContentEquals(const base::FilePath& selected_path,
60 const std::string& expected_contents) { 60 const std::string& expected_contents) {
61 std::string test_file_contents; 61 std::string test_file_contents;
62 ASSERT_TRUE(file_util::ReadFileToString(selected_path, &test_file_contents)); 62 ASSERT_TRUE(base::ReadFileToString(selected_path, &test_file_contents));
63 EXPECT_EQ(expected_contents, test_file_contents); 63 EXPECT_EQ(expected_contents, test_file_contents);
64 } 64 }
65 65
66 // Mocks FileSelector used by FileBrowserHandlerInternalSelectFileFunction. 66 // Mocks FileSelector used by FileBrowserHandlerInternalSelectFileFunction.
67 // When |SelectFile| is called, it will check that file name suggestion is as 67 // When |SelectFile| is called, it will check that file name suggestion is as
68 // expected, and respond to the extension function with specified selection 68 // expected, and respond to the extension function with specified selection
69 // results. 69 // results.
70 class MockFileSelector : public file_manager::FileSelector { 70 class MockFileSelector : public file_manager::FileSelector {
71 public: 71 public:
72 MockFileSelector(const base::FilePath& suggested_name, 72 MockFileSelector(const base::FilePath& suggested_name,
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 select_file_function.get(), 366 select_file_function.get(),
367 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", 367 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]",
368 browser()))); 368 browser())));
369 369
370 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); 370 EXPECT_FALSE(utils::GetBoolean(result.get(), "success"));
371 DictionaryValue* entry_info; 371 DictionaryValue* entry_info;
372 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); 372 EXPECT_FALSE(result->GetDictionary("entry", &entry_info));
373 } 373 }
374 374
375 } // namespace 375 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698