| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/fake_file_system.h" | 5 #include "chrome/browser/chromeos/drive/fake_file_system.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 10 #include "chrome/browser/drive/fake_drive_service.h" | 10 #include "chrome/browser/drive/fake_drive_service.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Cache file should be available. | 87 // Cache file should be available. |
| 88 ASSERT_FALSE(cache_file_path.empty()); | 88 ASSERT_FALSE(cache_file_path.empty()); |
| 89 | 89 |
| 90 // There should be a cache file so no data should be downloaded. | 90 // There should be a cache file so no data should be downloaded. |
| 91 EXPECT_TRUE(get_content_callback.data().empty()); | 91 EXPECT_TRUE(get_content_callback.data().empty()); |
| 92 EXPECT_EQ(FILE_ERROR_OK, completion_error); | 92 EXPECT_EQ(FILE_ERROR_OK, completion_error); |
| 93 | 93 |
| 94 // Make sure the cached file's content. | 94 // Make sure the cached file's content. |
| 95 std::string cache_file_content; | 95 std::string cache_file_content; |
| 96 ASSERT_TRUE( | 96 ASSERT_TRUE( |
| 97 file_util::ReadFileToString(cache_file_path, &cache_file_content)); | 97 base::ReadFileToString(cache_file_path, &cache_file_content)); |
| 98 EXPECT_EQ(content, cache_file_content); | 98 EXPECT_EQ(content, cache_file_content); |
| 99 } | 99 } |
| 100 | 100 |
| 101 TEST_F(FakeFileSystemTest, GetFileContentByPath_Directory) { | 101 TEST_F(FakeFileSystemTest, GetFileContentByPath_Directory) { |
| 102 FileError initialize_error = FILE_ERROR_FAILED; | 102 FileError initialize_error = FILE_ERROR_FAILED; |
| 103 scoped_ptr<ResourceEntry> entry; | 103 scoped_ptr<ResourceEntry> entry; |
| 104 base::FilePath cache_file_path; | 104 base::FilePath cache_file_path; |
| 105 google_apis::test_util::TestGetContentCallback get_content_callback; | 105 google_apis::test_util::TestGetContentCallback get_content_callback; |
| 106 FileError completion_error = FILE_ERROR_FAILED; | 106 FileError completion_error = FILE_ERROR_FAILED; |
| 107 base::Closure cancel_download; | 107 base::Closure cancel_download; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 util::GetDriveMyDriveRootPath().AppendASCII("Invalid File Name"), | 153 util::GetDriveMyDriveRootPath().AppendASCII("Invalid File Name"), |
| 154 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 154 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
| 155 base::RunLoop().RunUntilIdle(); | 155 base::RunLoop().RunUntilIdle(); |
| 156 | 156 |
| 157 ASSERT_EQ(FILE_ERROR_NOT_FOUND, error); | 157 ASSERT_EQ(FILE_ERROR_NOT_FOUND, error); |
| 158 ASSERT_FALSE(entry); | 158 ASSERT_FALSE(entry); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace test_util | 161 } // namespace test_util |
| 162 } // namespace drive | 162 } // namespace drive |
| OLD | NEW |