| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 base::MessageLoop::current()->RunUntilIdle(); | 279 base::MessageLoop::current()->RunUntilIdle(); |
| 280 EXPECT_EQ(1, callback_count_); | 280 EXPECT_EQ(1, callback_count_); |
| 281 | 281 |
| 282 // Now we should have "dest-move". | 282 // Now we should have "dest-move". |
| 283 EXPECT_EQ(base::PLATFORM_FILE_OK, | 283 EXPECT_EQ(base::PLATFORM_FILE_OK, |
| 284 file_system_.DirectoryExists(URL("dest-move"))); | 284 file_system_.DirectoryExists(URL("dest-move"))); |
| 285 } | 285 } |
| 286 | 286 |
| 287 TEST_F(SyncableFileOperationRunnerTest, Write) { | 287 TEST_F(SyncableFileOperationRunnerTest, Write) { |
| 288 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateFile(URL(kFile))); | 288 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateFile(URL(kFile))); |
| 289 const GURL kBlobURL("blob:foo"); | |
| 290 const std::string kData("Lorem ipsum."); | 289 const std::string kData("Lorem ipsum."); |
| 291 ScopedTextBlob blob(url_request_context_, kBlobURL, kData); | 290 ScopedTextBlob blob(url_request_context_, "blob:foo", kData); |
| 292 | 291 |
| 293 sync_status()->StartSyncing(URL(kFile)); | 292 sync_status()->StartSyncing(URL(kFile)); |
| 294 | 293 |
| 295 ResetCallbackStatus(); | 294 ResetCallbackStatus(); |
| 296 file_system_.operation_runner()->Write( | 295 file_system_.operation_runner()->Write( |
| 297 &url_request_context_, | 296 &url_request_context_, |
| 298 URL(kFile), kBlobURL, 0, GetWriteCallback(FROM_HERE)); | 297 URL(kFile), blob.GetBlobDataHandle(), 0, GetWriteCallback(FROM_HERE)); |
| 299 base::MessageLoop::current()->RunUntilIdle(); | 298 base::MessageLoop::current()->RunUntilIdle(); |
| 300 EXPECT_EQ(0, callback_count_); | 299 EXPECT_EQ(0, callback_count_); |
| 301 | 300 |
| 302 sync_status()->EndSyncing(URL(kFile)); | 301 sync_status()->EndSyncing(URL(kFile)); |
| 303 ResetCallbackStatus(); | 302 ResetCallbackStatus(); |
| 304 | 303 |
| 305 while (!write_complete_) | 304 while (!write_complete_) |
| 306 base::MessageLoop::current()->RunUntilIdle(); | 305 base::MessageLoop::current()->RunUntilIdle(); |
| 307 | 306 |
| 308 EXPECT_EQ(base::PLATFORM_FILE_OK, write_status_); | 307 EXPECT_EQ(base::PLATFORM_FILE_OK, write_status_); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 file_system_.operation_runner()->Truncate( | 385 file_system_.operation_runner()->Truncate( |
| 387 URL(kFile), 10, | 386 URL(kFile), 10, |
| 388 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_ABORT)); | 387 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_ABORT)); |
| 389 file_system_.operation_runner()->Cancel( | 388 file_system_.operation_runner()->Cancel( |
| 390 id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); | 389 id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); |
| 391 base::MessageLoop::current()->RunUntilIdle(); | 390 base::MessageLoop::current()->RunUntilIdle(); |
| 392 EXPECT_EQ(2, callback_count_); | 391 EXPECT_EQ(2, callback_count_); |
| 393 } | 392 } |
| 394 | 393 |
| 395 } // namespace sync_file_system | 394 } // namespace sync_file_system |
| OLD | NEW |