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 "chrome/browser/drive/fake_drive_service.h" | 5 #include "chrome/browser/drive/fake_drive_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 test_util::CreateCopyResultCallback(&error, &output_file_path), | 990 test_util::CreateCopyResultCallback(&error, &output_file_path), |
991 get_content_callback.callback(), | 991 get_content_callback.callback(), |
992 base::Bind(&test_util::AppendProgressCallbackResult, | 992 base::Bind(&test_util::AppendProgressCallbackResult, |
993 &download_progress_values)); | 993 &download_progress_values)); |
994 base::RunLoop().RunUntilIdle(); | 994 base::RunLoop().RunUntilIdle(); |
995 | 995 |
996 EXPECT_EQ(HTTP_SUCCESS, error); | 996 EXPECT_EQ(HTTP_SUCCESS, error); |
997 EXPECT_EQ(output_file_path, kOutputFilePath); | 997 EXPECT_EQ(output_file_path, kOutputFilePath); |
998 std::string content; | 998 std::string content; |
999 ASSERT_TRUE(base::ReadFileToString(output_file_path, &content)); | 999 ASSERT_TRUE(base::ReadFileToString(output_file_path, &content)); |
1000 // The content is "x"s of the file size specified in root_feed.json. | |
1001 EXPECT_EQ("This is some test content.", content); | 1000 EXPECT_EQ("This is some test content.", content); |
1002 ASSERT_TRUE(!download_progress_values.empty()); | 1001 ASSERT_TRUE(!download_progress_values.empty()); |
1003 EXPECT_TRUE(base::STLIsSorted(download_progress_values)); | 1002 EXPECT_TRUE(base::STLIsSorted(download_progress_values)); |
1004 EXPECT_LE(0, download_progress_values.front().first); | 1003 EXPECT_LE(0, download_progress_values.front().first); |
1005 EXPECT_GE(26, download_progress_values.back().first); | 1004 EXPECT_GE(26, download_progress_values.back().first); |
1006 EXPECT_EQ(content, get_content_callback.GetConcatenatedData()); | 1005 EXPECT_EQ(content, get_content_callback.GetConcatenatedData()); |
1007 } | 1006 } |
1008 | 1007 |
1009 TEST_F(FakeDriveServiceTest, DownloadFile_NonexistingFile) { | 1008 TEST_F(FakeDriveServiceTest, DownloadFile_NonexistingFile) { |
1010 ASSERT_TRUE(test_util::SetUpTestEntries(&fake_service_)); | 1009 ASSERT_TRUE(test_util::SetUpTestEntries(&fake_service_)); |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 test_util::CreateCopyResultCallback(&error, &resource_entry)); | 2245 test_util::CreateCopyResultCallback(&error, &resource_entry)); |
2247 base::RunLoop().RunUntilIdle(); | 2246 base::RunLoop().RunUntilIdle(); |
2248 | 2247 |
2249 EXPECT_EQ(GDATA_NO_CONNECTION, error); | 2248 EXPECT_EQ(GDATA_NO_CONNECTION, error); |
2250 EXPECT_FALSE(resource_entry); | 2249 EXPECT_FALSE(resource_entry); |
2251 } | 2250 } |
2252 | 2251 |
2253 } // namespace | 2252 } // namespace |
2254 | 2253 |
2255 } // namespace drive | 2254 } // namespace drive |
OLD | NEW |