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