Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc

Issue 610223002: [SyncFS] Use nullptr instead of NULL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/sync_file_system/local/local_file_sync_context.h" 5 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 virtual void TearDown() OVERRIDE { 75 virtual void TearDown() OVERRIDE {
76 RevokeSyncableFileSystem(); 76 RevokeSyncableFileSystem();
77 } 77 }
78 78
79 void StartPrepareForSync(FileSystemContext* file_system_context, 79 void StartPrepareForSync(FileSystemContext* file_system_context,
80 const FileSystemURL& url, 80 const FileSystemURL& url,
81 LocalFileSyncContext::SyncMode sync_mode, 81 LocalFileSyncContext::SyncMode sync_mode,
82 SyncFileMetadata* metadata, 82 SyncFileMetadata* metadata,
83 FileChangeList* changes, 83 FileChangeList* changes,
84 storage::ScopedFile* snapshot) { 84 storage::ScopedFile* snapshot) {
85 ASSERT_TRUE(changes != NULL); 85 ASSERT_TRUE(changes != nullptr);
86 ASSERT_FALSE(has_inflight_prepare_for_sync_); 86 ASSERT_FALSE(has_inflight_prepare_for_sync_);
87 status_ = SYNC_STATUS_UNKNOWN; 87 status_ = SYNC_STATUS_UNKNOWN;
88 has_inflight_prepare_for_sync_ = true; 88 has_inflight_prepare_for_sync_ = true;
89 sync_context_->PrepareForSync( 89 sync_context_->PrepareForSync(
90 file_system_context, 90 file_system_context,
91 url, 91 url,
92 sync_mode, 92 sync_mode,
93 base::Bind(&LocalFileSyncContextTest::DidPrepareForSync, 93 base::Bind(&LocalFileSyncContextTest::DidPrepareForSync,
94 base::Unretained(this), metadata, changes, snapshot)); 94 base::Unretained(this), metadata, changes, snapshot));
95 } 95 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 SyncFileType expected_file_type) { 142 SyncFileType expected_file_type) {
143 SCOPED_TRACE(testing::Message() << "ApplyChange for " << 143 SCOPED_TRACE(testing::Message() << "ApplyChange for " <<
144 url.DebugString()); 144 url.DebugString());
145 145
146 // First we should call PrepareForSync to disable writing. 146 // First we should call PrepareForSync to disable writing.
147 SyncFileMetadata metadata; 147 SyncFileMetadata metadata;
148 FileChangeList changes; 148 FileChangeList changes;
149 EXPECT_EQ(SYNC_STATUS_OK, 149 EXPECT_EQ(SYNC_STATUS_OK,
150 PrepareForSync(file_system_context, url, 150 PrepareForSync(file_system_context, url,
151 LocalFileSyncContext::SYNC_EXCLUSIVE, 151 LocalFileSyncContext::SYNC_EXCLUSIVE,
152 &metadata, &changes, NULL)); 152 &metadata, &changes, nullptr));
153 EXPECT_EQ(expected_file_type, metadata.file_type); 153 EXPECT_EQ(expected_file_type, metadata.file_type);
154 154
155 status_ = SYNC_STATUS_UNKNOWN; 155 status_ = SYNC_STATUS_UNKNOWN;
156 sync_context_->ApplyRemoteChange( 156 sync_context_->ApplyRemoteChange(
157 file_system_context, change, local_path, url, 157 file_system_context, change, local_path, url,
158 base::Bind(&LocalFileSyncContextTest::DidApplyRemoteChange, 158 base::Bind(&LocalFileSyncContextTest::DidApplyRemoteChange,
159 base::Unretained(this), 159 base::Unretained(this),
160 make_scoped_refptr(file_system_context), url)); 160 make_scoped_refptr(file_system_context), url));
161 base::MessageLoop::current()->Run(); 161 base::MessageLoop::current()->Run();
162 return status_; 162 return status_;
163 } 163 }
164 164
165 void DidApplyRemoteChange(FileSystemContext* file_system_context, 165 void DidApplyRemoteChange(FileSystemContext* file_system_context,
166 const FileSystemURL& url, 166 const FileSystemURL& url,
167 SyncStatusCode status) { 167 SyncStatusCode status) {
168 status_ = status; 168 status_ = status;
169 sync_context_->FinalizeExclusiveSync( 169 sync_context_->FinalizeExclusiveSync(
170 file_system_context, url, 170 file_system_context, url,
171 status == SYNC_STATUS_OK /* clear_local_changes */, 171 status == SYNC_STATUS_OK /* clear_local_changes */,
172 base::MessageLoop::QuitClosure()); 172 base::MessageLoop::QuitClosure());
173 } 173 }
174 174
175 void StartModifyFileOnIOThread(CannedSyncableFileSystem* file_system, 175 void StartModifyFileOnIOThread(CannedSyncableFileSystem* file_system,
176 const FileSystemURL& url) { 176 const FileSystemURL& url) {
177 ASSERT_TRUE(file_system != NULL); 177 ASSERT_TRUE(file_system != nullptr);
178 if (!io_task_runner_->RunsTasksOnCurrentThread()) { 178 if (!io_task_runner_->RunsTasksOnCurrentThread()) {
179 async_modify_finished_ = false; 179 async_modify_finished_ = false;
180 ASSERT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread()); 180 ASSERT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread());
181 io_task_runner_->PostTask( 181 io_task_runner_->PostTask(
182 FROM_HERE, 182 FROM_HERE,
183 base::Bind(&LocalFileSyncContextTest::StartModifyFileOnIOThread, 183 base::Bind(&LocalFileSyncContextTest::StartModifyFileOnIOThread,
184 base::Unretained(this), file_system, url)); 184 base::Unretained(this), file_system, url));
185 return; 185 return;
186 } 186 }
187 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); 187 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 sync_context_.get())); 242 sync_context_.get()));
243 ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem()); 243 ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
244 244
245 const FileSystemURL kFile(file_system.URL("file")); 245 const FileSystemURL kFile(file_system.URL("file"));
246 EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kFile)); 246 EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kFile));
247 247
248 SyncFileMetadata metadata; 248 SyncFileMetadata metadata;
249 FileChangeList changes; 249 FileChangeList changes;
250 EXPECT_EQ(SYNC_STATUS_OK, 250 EXPECT_EQ(SYNC_STATUS_OK,
251 PrepareForSync(file_system.file_system_context(), kFile, 251 PrepareForSync(file_system.file_system_context(), kFile,
252 sync_mode, &metadata, &changes, NULL)); 252 sync_mode, &metadata, &changes, nullptr));
253 EXPECT_EQ(1U, changes.size()); 253 EXPECT_EQ(1U, changes.size());
254 EXPECT_TRUE(changes.list().back().IsFile()); 254 EXPECT_TRUE(changes.list().back().IsFile());
255 EXPECT_TRUE(changes.list().back().IsAddOrUpdate()); 255 EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
256 256
257 // We should see the same set of changes. 257 // We should see the same set of changes.
258 file_system.GetChangesForURLInTracker(kFile, &changes); 258 file_system.GetChangesForURLInTracker(kFile, &changes);
259 EXPECT_EQ(1U, changes.size()); 259 EXPECT_EQ(1U, changes.size());
260 EXPECT_TRUE(changes.list().back().IsFile()); 260 EXPECT_TRUE(changes.list().back().IsFile());
261 EXPECT_TRUE(changes.list().back().IsAddOrUpdate()); 261 EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
262 262
263 SimulateFinishSync(file_system.file_system_context(), kFile, 263 SimulateFinishSync(file_system.file_system_context(), kFile,
264 simulate_sync_finish_status, sync_mode); 264 simulate_sync_finish_status, sync_mode);
265 265
266 file_system.GetChangesForURLInTracker(kFile, &changes); 266 file_system.GetChangesForURLInTracker(kFile, &changes);
267 if (simulate_sync_finish_status == SYNC_STATUS_OK) { 267 if (simulate_sync_finish_status == SYNC_STATUS_OK) {
268 // The change's cleared. 268 // The change's cleared.
269 EXPECT_TRUE(changes.empty()); 269 EXPECT_TRUE(changes.empty());
270 } else { 270 } else {
271 EXPECT_EQ(1U, changes.size()); 271 EXPECT_EQ(1U, changes.size());
272 EXPECT_TRUE(changes.list().back().IsFile()); 272 EXPECT_TRUE(changes.list().back().IsFile());
273 EXPECT_TRUE(changes.list().back().IsAddOrUpdate()); 273 EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
274 } 274 }
275 275
276 sync_context_->ShutdownOnUIThread(); 276 sync_context_->ShutdownOnUIThread();
277 sync_context_ = NULL; 277 sync_context_ = nullptr;
278 278
279 file_system.TearDown(); 279 file_system.TearDown();
280 } 280 }
281 281
282 void PrepareForSync_WriteDuringSync( 282 void PrepareForSync_WriteDuringSync(
283 LocalFileSyncContext::SyncMode sync_mode) { 283 LocalFileSyncContext::SyncMode sync_mode) {
284 CannedSyncableFileSystem file_system(GURL(kOrigin1), 284 CannedSyncableFileSystem file_system(GURL(kOrigin1),
285 in_memory_env_.get(), 285 in_memory_env_.get(),
286 io_task_runner_.get(), 286 io_task_runner_.get(),
287 file_task_runner_.get()); 287 file_task_runner_.get());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 EXPECT_EQ(base::File::FILE_OK, WaitUntilModifyFileIsDone()); 332 EXPECT_EQ(base::File::FILE_OK, WaitUntilModifyFileIsDone());
333 333
334 // Sync succeeded, but the other change that was made during or 334 // Sync succeeded, but the other change that was made during or
335 // after sync is recorded. 335 // after sync is recorded.
336 file_system.GetChangesForURLInTracker(kFile, &changes); 336 file_system.GetChangesForURLInTracker(kFile, &changes);
337 EXPECT_EQ(1U, changes.size()); 337 EXPECT_EQ(1U, changes.size());
338 EXPECT_TRUE(changes.list().back().IsFile()); 338 EXPECT_TRUE(changes.list().back().IsFile());
339 EXPECT_TRUE(changes.list().back().IsAddOrUpdate()); 339 EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
340 340
341 sync_context_->ShutdownOnUIThread(); 341 sync_context_->ShutdownOnUIThread();
342 sync_context_ = NULL; 342 sync_context_ = nullptr;
343 343
344 file_system.TearDown(); 344 file_system.TearDown();
345 } 345 }
346 346
347 base::ScopedTempDir dir_; 347 base::ScopedTempDir dir_;
348 scoped_ptr<leveldb::Env> in_memory_env_; 348 scoped_ptr<leveldb::Env> in_memory_env_;
349 349
350 // These need to remain until the very end. 350 // These need to remain until the very end.
351 content::TestBrowserThreadBundle thread_bundle_; 351 content::TestBrowserThreadBundle thread_bundle_;
352 352
(...skipping 27 matching lines...) Expand all
380 sync_context_ = new LocalFileSyncContext( 380 sync_context_ = new LocalFileSyncContext(
381 dir_.path(), in_memory_env_.get(), 381 dir_.path(), in_memory_env_.get(),
382 ui_task_runner_.get(), io_task_runner_.get()); 382 ui_task_runner_.get(), io_task_runner_.get());
383 383
384 // Initializes file_system using |sync_context_|. 384 // Initializes file_system using |sync_context_|.
385 EXPECT_EQ(SYNC_STATUS_OK, 385 EXPECT_EQ(SYNC_STATUS_OK,
386 file_system.MaybeInitializeFileSystemContext(sync_context_.get())); 386 file_system.MaybeInitializeFileSystemContext(sync_context_.get()));
387 387
388 // Make sure everything's set up for file_system to be able to handle 388 // Make sure everything's set up for file_system to be able to handle
389 // syncable file system operations. 389 // syncable file system operations.
390 EXPECT_TRUE(file_system.backend()->sync_context() != NULL); 390 EXPECT_TRUE(file_system.backend()->sync_context() != nullptr);
391 EXPECT_TRUE(file_system.backend()->change_tracker() != NULL); 391 EXPECT_TRUE(file_system.backend()->change_tracker() != nullptr);
392 EXPECT_EQ(sync_context_.get(), file_system.backend()->sync_context()); 392 EXPECT_EQ(sync_context_.get(), file_system.backend()->sync_context());
393 393
394 // Calling MaybeInitialize for the same context multiple times must be ok. 394 // Calling MaybeInitialize for the same context multiple times must be ok.
395 EXPECT_EQ(SYNC_STATUS_OK, 395 EXPECT_EQ(SYNC_STATUS_OK,
396 file_system.MaybeInitializeFileSystemContext(sync_context_.get())); 396 file_system.MaybeInitializeFileSystemContext(sync_context_.get()));
397 EXPECT_EQ(sync_context_.get(), file_system.backend()->sync_context()); 397 EXPECT_EQ(sync_context_.get(), file_system.backend()->sync_context());
398 398
399 // Opens the file_system, perform some operation and see if the change tracker 399 // Opens the file_system, perform some operation and see if the change tracker
400 // correctly captures the change. 400 // correctly captures the change.
401 EXPECT_EQ(base::File::FILE_OK, file_system.OpenFileSystem()); 401 EXPECT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 urls.clear(); 468 urls.clear();
469 file_system2.GetChangedURLsInTracker(&urls); 469 file_system2.GetChangedURLsInTracker(&urls);
470 ASSERT_EQ(1U, urls.size()); 470 ASSERT_EQ(1U, urls.size());
471 EXPECT_TRUE(ContainsKey(urls, kURL2)); 471 EXPECT_TRUE(ContainsKey(urls, kURL2));
472 472
473 SyncFileMetadata metadata; 473 SyncFileMetadata metadata;
474 FileChangeList changes; 474 FileChangeList changes;
475 EXPECT_EQ(SYNC_STATUS_OK, 475 EXPECT_EQ(SYNC_STATUS_OK,
476 PrepareForSync(file_system1.file_system_context(), kURL1, 476 PrepareForSync(file_system1.file_system_context(), kURL1,
477 LocalFileSyncContext::SYNC_EXCLUSIVE, 477 LocalFileSyncContext::SYNC_EXCLUSIVE,
478 &metadata, &changes, NULL)); 478 &metadata, &changes, nullptr));
479 EXPECT_EQ(1U, changes.size()); 479 EXPECT_EQ(1U, changes.size());
480 EXPECT_TRUE(changes.list().back().IsFile()); 480 EXPECT_TRUE(changes.list().back().IsFile());
481 EXPECT_TRUE(changes.list().back().IsAddOrUpdate()); 481 EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
482 EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type); 482 EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type);
483 EXPECT_EQ(0, metadata.size); 483 EXPECT_EQ(0, metadata.size);
484 484
485 changes.clear(); 485 changes.clear();
486 EXPECT_EQ(SYNC_STATUS_OK, 486 EXPECT_EQ(SYNC_STATUS_OK,
487 PrepareForSync(file_system2.file_system_context(), kURL2, 487 PrepareForSync(file_system2.file_system_context(), kURL2,
488 LocalFileSyncContext::SYNC_EXCLUSIVE, 488 LocalFileSyncContext::SYNC_EXCLUSIVE,
489 &metadata, &changes, NULL)); 489 &metadata, &changes, nullptr));
490 EXPECT_EQ(1U, changes.size()); 490 EXPECT_EQ(1U, changes.size());
491 EXPECT_FALSE(changes.list().back().IsFile()); 491 EXPECT_FALSE(changes.list().back().IsFile());
492 EXPECT_TRUE(changes.list().back().IsAddOrUpdate()); 492 EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
493 EXPECT_EQ(SYNC_FILE_TYPE_DIRECTORY, metadata.file_type); 493 EXPECT_EQ(SYNC_FILE_TYPE_DIRECTORY, metadata.file_type);
494 EXPECT_EQ(0, metadata.size); 494 EXPECT_EQ(0, metadata.size);
495 495
496 sync_context_->ShutdownOnUIThread(); 496 sync_context_->ShutdownOnUIThread();
497 sync_context_ = NULL; 497 sync_context_ = nullptr;
498 498
499 file_system1.TearDown(); 499 file_system1.TearDown();
500 file_system2.TearDown(); 500 file_system2.TearDown();
501 } 501 }
502 502
503 TEST_F(LocalFileSyncContextTest, PrepareSync_SyncSuccess_Exclusive) { 503 TEST_F(LocalFileSyncContextTest, PrepareSync_SyncSuccess_Exclusive) {
504 PrepareForSync_Basic(LocalFileSyncContext::SYNC_EXCLUSIVE, 504 PrepareForSync_Basic(LocalFileSyncContext::SYNC_EXCLUSIVE,
505 SYNC_STATUS_OK); 505 SYNC_STATUS_OK);
506 } 506 }
507 507
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 // Kick file write on IO thread. 554 // Kick file write on IO thread.
555 StartModifyFileOnIOThread(&file_system, kURL1); 555 StartModifyFileOnIOThread(&file_system, kURL1);
556 556
557 // Until the operation finishes PrepareForSync should return BUSY error. 557 // Until the operation finishes PrepareForSync should return BUSY error.
558 SyncFileMetadata metadata; 558 SyncFileMetadata metadata;
559 metadata.file_type = SYNC_FILE_TYPE_UNKNOWN; 559 metadata.file_type = SYNC_FILE_TYPE_UNKNOWN;
560 FileChangeList changes; 560 FileChangeList changes;
561 EXPECT_EQ(SYNC_STATUS_FILE_BUSY, 561 EXPECT_EQ(SYNC_STATUS_FILE_BUSY,
562 PrepareForSync(file_system.file_system_context(), kURL1, 562 PrepareForSync(file_system.file_system_context(), kURL1,
563 LocalFileSyncContext::SYNC_EXCLUSIVE, 563 LocalFileSyncContext::SYNC_EXCLUSIVE,
564 &metadata, &changes, NULL)); 564 &metadata, &changes, nullptr));
565 EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type); 565 EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type);
566 566
567 // Register PrepareForSync method to be invoked when kURL1 becomes 567 // Register PrepareForSync method to be invoked when kURL1 becomes
568 // syncable. (Actually this may be done after all operations are done 568 // syncable. (Actually this may be done after all operations are done
569 // on IO thread in this test.) 569 // on IO thread in this test.)
570 metadata.file_type = SYNC_FILE_TYPE_UNKNOWN; 570 metadata.file_type = SYNC_FILE_TYPE_UNKNOWN;
571 changes.clear(); 571 changes.clear();
572 sync_context_->RegisterURLForWaitingSync( 572 sync_context_->RegisterURLForWaitingSync(
573 kURL1, GetPrepareForSyncClosure(file_system.file_system_context(), kURL1, 573 kURL1, GetPrepareForSyncClosure(file_system.file_system_context(), kURL1,
574 LocalFileSyncContext::SYNC_EXCLUSIVE, 574 LocalFileSyncContext::SYNC_EXCLUSIVE,
575 &metadata, &changes, NULL)); 575 &metadata, &changes, nullptr));
576 576
577 // Wait for the completion. 577 // Wait for the completion.
578 EXPECT_EQ(base::File::FILE_OK, WaitUntilModifyFileIsDone()); 578 EXPECT_EQ(base::File::FILE_OK, WaitUntilModifyFileIsDone());
579 579
580 // The PrepareForSync must have been started; wait until DidPrepareForSync 580 // The PrepareForSync must have been started; wait until DidPrepareForSync
581 // is done. 581 // is done.
582 base::MessageLoop::current()->Run(); 582 base::MessageLoop::current()->Run();
583 ASSERT_FALSE(has_inflight_prepare_for_sync_); 583 ASSERT_FALSE(has_inflight_prepare_for_sync_);
584 584
585 // Now PrepareForSync should have run and returned OK. 585 // Now PrepareForSync should have run and returned OK.
586 EXPECT_EQ(SYNC_STATUS_OK, status_); 586 EXPECT_EQ(SYNC_STATUS_OK, status_);
587 EXPECT_EQ(1U, changes.size()); 587 EXPECT_EQ(1U, changes.size());
588 EXPECT_TRUE(changes.list().back().IsFile()); 588 EXPECT_TRUE(changes.list().back().IsFile());
589 EXPECT_TRUE(changes.list().back().IsAddOrUpdate()); 589 EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
590 EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type); 590 EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type);
591 EXPECT_EQ(1, metadata.size); 591 EXPECT_EQ(1, metadata.size);
592 592
593 sync_context_->ShutdownOnUIThread(); 593 sync_context_->ShutdownOnUIThread();
594 sync_context_ = NULL; 594 sync_context_ = nullptr;
595 file_system.TearDown(); 595 file_system.TearDown();
596 } 596 }
597 597
598 TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion) { 598 TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion) {
599 CannedSyncableFileSystem file_system(GURL(kOrigin1), 599 CannedSyncableFileSystem file_system(GURL(kOrigin1),
600 in_memory_env_.get(), 600 in_memory_env_.get(),
601 io_task_runner_.get(), 601 io_task_runner_.get(),
602 file_task_runner_.get()); 602 file_task_runner_.get());
603 file_system.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); 603 file_system.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED);
604 604
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 urls.clear(); 672 urls.clear();
673 file_system.GetChangedURLsInTracker(&urls); 673 file_system.GetChangedURLsInTracker(&urls);
674 EXPECT_TRUE(urls.empty()); 674 EXPECT_TRUE(urls.empty());
675 675
676 // The quota usage data must have reflected the deletion. 676 // The quota usage data must have reflected the deletion.
677 EXPECT_EQ(storage::kQuotaStatusOk, 677 EXPECT_EQ(storage::kQuotaStatusOk,
678 file_system.GetUsageAndQuota(&new_usage, &quota)); 678 file_system.GetUsageAndQuota(&new_usage, &quota));
679 EXPECT_EQ(new_usage, initial_usage); 679 EXPECT_EQ(new_usage, initial_usage);
680 680
681 sync_context_->ShutdownOnUIThread(); 681 sync_context_->ShutdownOnUIThread();
682 sync_context_ = NULL; 682 sync_context_ = nullptr;
683 file_system.TearDown(); 683 file_system.TearDown();
684 } 684 }
685 685
686 TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion_ForRoot) { 686 TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion_ForRoot) {
687 CannedSyncableFileSystem file_system(GURL(kOrigin1), 687 CannedSyncableFileSystem file_system(GURL(kOrigin1),
688 in_memory_env_.get(), 688 in_memory_env_.get(),
689 io_task_runner_.get(), 689 io_task_runner_.get(),
690 file_task_runner_.get()); 690 file_task_runner_.get());
691 file_system.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); 691 file_system.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED);
692 692
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 FileSystemURLSet urls; 739 FileSystemURLSet urls;
740 file_system.GetChangedURLsInTracker(&urls); 740 file_system.GetChangedURLsInTracker(&urls);
741 EXPECT_TRUE(urls.empty()); 741 EXPECT_TRUE(urls.empty());
742 742
743 // The quota usage data must have reflected the deletion. 743 // The quota usage data must have reflected the deletion.
744 EXPECT_EQ(storage::kQuotaStatusOk, 744 EXPECT_EQ(storage::kQuotaStatusOk,
745 file_system.GetUsageAndQuota(&new_usage, &quota)); 745 file_system.GetUsageAndQuota(&new_usage, &quota));
746 EXPECT_EQ(new_usage, initial_usage); 746 EXPECT_EQ(new_usage, initial_usage);
747 747
748 sync_context_->ShutdownOnUIThread(); 748 sync_context_->ShutdownOnUIThread();
749 sync_context_ = NULL; 749 sync_context_ = nullptr;
750 file_system.TearDown(); 750 file_system.TearDown();
751 } 751 }
752 752
753 TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) { 753 TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) {
754 base::ScopedTempDir temp_dir; 754 base::ScopedTempDir temp_dir;
755 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 755 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
756 756
757 CannedSyncableFileSystem file_system(GURL(kOrigin1), 757 CannedSyncableFileSystem file_system(GURL(kOrigin1),
758 in_memory_env_.get(), 758 in_memory_env_.get(),
759 io_task_runner_.get(), 759 io_task_runner_.get(),
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 950
951 // Make sure kDir and kFile are created by ApplyRemoteChange. 951 // Make sure kDir and kFile are created by ApplyRemoteChange.
952 EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile)); 952 EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile));
953 EXPECT_EQ(base::File::FILE_OK, file_system.DirectoryExists(kDir)); 953 EXPECT_EQ(base::File::FILE_OK, file_system.DirectoryExists(kDir));
954 954
955 sync_context_->ShutdownOnUIThread(); 955 sync_context_->ShutdownOnUIThread();
956 file_system.TearDown(); 956 file_system.TearDown();
957 } 957 }
958 958
959 } // namespace sync_file_system 959 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698