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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 ResetCallbackStatus(); | 328 ResetCallbackStatus(); |
329 | 329 |
330 // This shouldn't crash nor leak memory. | 330 // This shouldn't crash nor leak memory. |
331 sync_context_->ShutdownOnUIThread(); | 331 sync_context_->ShutdownOnUIThread(); |
332 sync_context_ = NULL; | 332 sync_context_ = NULL; |
333 base::MessageLoop::current()->RunUntilIdle(); | 333 base::MessageLoop::current()->RunUntilIdle(); |
334 EXPECT_EQ(2, callback_count_); | 334 EXPECT_EQ(2, callback_count_); |
335 } | 335 } |
336 | 336 |
337 // Test if CopyInForeignFile runs cooperatively with other Sync operations | 337 // Test if CopyInForeignFile runs cooperatively with other Sync operations. |
338 // when it is called directly via AsFileSystemOperationImpl. | |
339 TEST_F(SyncableFileOperationRunnerTest, CopyInForeignFile) { | 338 TEST_F(SyncableFileOperationRunnerTest, CopyInForeignFile) { |
340 const std::string kTestData("test data"); | 339 const std::string kTestData("test data"); |
341 | 340 |
342 base::FilePath temp_path; | 341 base::FilePath temp_path; |
343 ASSERT_TRUE(CreateTempFile(&temp_path)); | 342 ASSERT_TRUE(CreateTempFile(&temp_path)); |
344 ASSERT_EQ(static_cast<int>(kTestData.size()), | 343 ASSERT_EQ(static_cast<int>(kTestData.size()), |
345 file_util::WriteFile( | 344 file_util::WriteFile( |
346 temp_path, kTestData.data(), kTestData.size())); | 345 temp_path, kTestData.data(), kTestData.size())); |
347 | 346 |
348 sync_status()->StartSyncing(URL(kFile)); | 347 sync_status()->StartSyncing(URL(kFile)); |
(...skipping 38 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_OK)); | 388 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); |
390 file_system_.operation_runner()->Cancel( | 389 file_system_.operation_runner()->Cancel( |
391 id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_INVALID_OPERATION)); | 390 id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_INVALID_OPERATION)); |
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 |