| 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/drive_file_stream_reader.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_stream_reader.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 google_apis::test_util::CreateCopyResultCallback(&error, &entry))); | 486 google_apis::test_util::CreateCopyResultCallback(&error, &entry))); |
| 487 run_loop.Run(); | 487 run_loop.Run(); |
| 488 } | 488 } |
| 489 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, error); | 489 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, error); |
| 490 EXPECT_FALSE(entry); | 490 EXPECT_FALSE(entry); |
| 491 } | 491 } |
| 492 | 492 |
| 493 TEST_F(DriveFileStreamReaderTest, ZeroByteFileRead) { | 493 TEST_F(DriveFileStreamReaderTest, ZeroByteFileRead) { |
| 494 // Prepare an empty file | 494 // Prepare an empty file |
| 495 { | 495 { |
| 496 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 496 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
| 497 scoped_ptr<google_apis::FileResource> entry; | 497 scoped_ptr<google_apis::FileResource> entry; |
| 498 fake_drive_service_->AddNewFile( | 498 fake_drive_service_->AddNewFile( |
| 499 "text/plain", | 499 "text/plain", |
| 500 "", // empty | 500 "", // empty |
| 501 fake_drive_service_->GetRootResourceId(), | 501 fake_drive_service_->GetRootResourceId(), |
| 502 "EmptyFile.txt", | 502 "EmptyFile.txt", |
| 503 false, // shared_with_me | 503 false, // shared_with_me |
| 504 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 504 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
| 505 content::RunAllBlockingPoolTasksUntilIdle(); | 505 content::RunAllBlockingPoolTasksUntilIdle(); |
| 506 ASSERT_EQ(google_apis::HTTP_CREATED, error); | 506 ASSERT_EQ(google_apis::HTTP_CREATED, error); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 ASSERT_TRUE(entry); | 560 ASSERT_TRUE(entry); |
| 561 EXPECT_TRUE(reader->IsInitialized()); | 561 EXPECT_TRUE(reader->IsInitialized()); |
| 562 | 562 |
| 563 // Read data from the reader, again. | 563 // Read data from the reader, again. |
| 564 std::string second_content; | 564 std::string second_content; |
| 565 ASSERT_EQ(net::OK, test_util::ReadAllData(reader.get(), &second_content)); | 565 ASSERT_EQ(net::OK, test_util::ReadAllData(reader.get(), &second_content)); |
| 566 EXPECT_EQ(0u, second_content.size()); | 566 EXPECT_EQ(0u, second_content.size()); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace drive | 569 } // namespace drive |
| OLD | NEW |